Skip to content

Commit 25fe55a

Browse files
authored
Merge pull request #54 from kdheepak/remove-emojis-only-outside-code
fix: Remove emojis only outside code 🐛
2 parents e315c68 + a2da337 commit 25fe55a

File tree

3 files changed

+36
-13
lines changed

3 files changed

+36
-13
lines changed

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
build:
22
@./panvimdoc.sh "--project-name" "panvimdoc" "--input-file" "doc/panvimdoc.md" "--vim-version" "NVIM v0.8.0" "--toc" "true" "--description" "" "--dedup-subheadings" "true" "--demojify" "false" "--treesitter" "true" "--ignore-rawblocks" "true" "--doc-mapping" "false" "--doc-mapping-project-name" "true" --shift-heading-level-by 0 --increment-heading-level-by 0
3+
4+
test:
5+
julia --project -e 'using Pkg; Pkg.test()'

scripts/remove-emojis.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function string.ends_with(str, ends)
1616
end
1717

1818
local function cleanup(elem)
19+
-- Don't touch code blocks
20+
if elem.t == "Code" or elem.t == "CodeBlock" then
21+
return elem
22+
end
1923
-- get rid of the space after the emoji, reset
2024
if elem.t == "Space" and prevEmoji then
2125
prevEmoji = false

test/demojify.jl

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
@testset "demojify" begin
2-
doc = test_pandoc("""
2+
doc = test_pandoc(
3+
"""
34
Hello world :wave:
45

5-
```sh
6-
echo 😎cool # comment
6+
echo 😎 cool # comment
7+
8+
```lua
9+
"some/**/glob*"
710
```
8-
"""; demojify = true)
11+
12+
`"some/**/glob*"`
13+
14+
15+
""";
16+
demojify = true,
17+
)
918

1019
@test """
1120
*test.txt* Test Description
@@ -15,22 +24,30 @@ Table of Contents *test-table-of-contents*
1524

1625
Hello world
1726

18-
>sh
19-
echo cool # comment
27+
echocool # comment
28+
29+
>lua
30+
\"some/**/glob*\"
2031
<
2132

33+
`\"some/**/glob*\"`
34+
2235
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
2336

2437
vim:tw=78:ts=8:noet:ft=help:norl:
2538
""" == doc
2639

27-
doc = test_pandoc("""
28-
Hello world :wave:
40+
doc = test_pandoc(
41+
"""
42+
Hello world :wave:
2943

30-
```sh
31-
echo 😎cool # comment
32-
```
33-
"""; demojify = false)
44+
```sh
45+
echo 😎cool # comment
46+
```
47+
48+
""";
49+
demojify = false,
50+
)
3451

3552
@test """
3653
*test.txt* Test Description
@@ -63,5 +80,4 @@ Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
6380

6481
vim:tw=78:ts=8:noet:ft=help:norl:
6582
""" == doc
66-
6783
end

0 commit comments

Comments
 (0)