Skip to content
8 changes: 4 additions & 4 deletions scripts/panvimdoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,15 @@ Writer.Block.OrderedList = function(items)
table.insert(buffer, ("%s. %s"):format(i, blocks(item)))
i = i + 1
end)
return "\n" .. table.concat(buffer) .. "\n\n"
return table.concat(buffer, "\n") .. "\n\n"
end

Writer.Block.BulletList = function(items)
local buffer = {}
items.content:map(function(item)
table.insert(buffer, indent(blocks(item, "\n"), "- ", " "))
end)
return "\n" .. table.concat(buffer, "\n") .. "\n\n"
return table.concat(buffer, "\n") .. "\n\n"
end

Writer.Block.DefinitionList = function(el)
Expand Down Expand Up @@ -390,8 +390,8 @@ end
Writer.Block.CodeBlock = function(el)
local attr = el.attr
local s = el.text
if attr.class == "vimdoc" then
return s
if #attr.classes > 0 and attr.classes[1] == "vimdoc" then
return s .. "\n\n"
else
local lang = ""
if TREESITTER and #attr.classes > 0 then
Expand Down
4 changes: 2 additions & 2 deletions test/dedupheadings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
toc = true,
dedup_subheadings = true,
)
@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand Down Expand Up @@ -53,5 +53,5 @@ SUMMARY 2 *test-tldr-summary-2*
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""" == doc
end
12 changes: 6 additions & 6 deletions test/definition-lists.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
demojify = true,
doc_mapping_project_name = true,
)
@test doc == raw"""
@test raw"""
*test.txt* Test Description

*test-:FnlCompileBuffer*
Expand All @@ -48,7 +48,7 @@
:Fnl {expr} Executes and Evalutate {expr} of fennel
>fennel
:Fnl (print "Hello World")

:Fnl (values some_var)
<
Testing
Expand All @@ -58,7 +58,7 @@
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

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

doc = test_pandoc(
raw"""
Expand Down Expand Up @@ -87,7 +87,7 @@ vim:tw=78:ts=8:noet:ft=help:norl:
demojify = true,
doc_mapping_project_name = false,
)
@test doc == raw"""
@test raw"""
*test.txt* Test Description

*:FnlCompileBuffer*
Expand All @@ -109,7 +109,7 @@ vim:tw=78:ts=8:noet:ft=help:norl:
:Fnl {expr} Executes and Evalutate {expr} of fennel
>fennel
:Fnl (print "Hello World")

:Fnl (values some_var)
<
Testing
Expand All @@ -119,5 +119,5 @@ vim:tw=78:ts=8:noet:ft=help:norl:
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""" == doc
end
8 changes: 4 additions & 4 deletions test/demojify.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@testset "demojify" begin
doc = test_pandoc("Hello world :wave:"; demojify = true)

@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand All @@ -12,11 +12,11 @@ Hello world
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

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

doc = test_pandoc("Hello world :wave:"; demojify = false)

@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand All @@ -27,5 +27,5 @@ Hello world :wave:
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""" == doc
end
18 changes: 12 additions & 6 deletions test/description.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# TODO: reimplement first line spacing in Julia
function remove_first_line(s::String)
lines = split(s, '\n')
return join(lines[2:end], '\n')
end

@testset "Treesitter" begin
doc = test_pandoc(
"""
Expand All @@ -16,8 +22,8 @@ jobs:
""";
description = nothing,
)
@test doc == """
*test.txt* For NVIM v0.8.0 Last change: $(CURRENT_DATE)
@test remove_first_line("""
*test.txt* For NVIM v0.8.0 Last change: $(CURRENT_DATE)

==============================================================================
Table of Contents *test-table-of-contents*
Expand All @@ -38,7 +44,7 @@ Here’s a YAML codeblock:
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""") == remove_first_line(doc)

doc = test_pandoc(
"""
Expand All @@ -58,8 +64,8 @@ jobs:
vimversion = "VIM v9.0.0",
description = nothing,
)
@test doc == """
*test.txt* For VIM v9.0.0 Last change: $(CURRENT_DATE)
@test remove_first_line(doc) == remove_first_line("""
*test.txt* For VIM v9.0.0 Last change: $(CURRENT_DATE)

==============================================================================
Table of Contents *test-table-of-contents*
Expand All @@ -80,5 +86,5 @@ Here’s a YAML codeblock:
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""")
end
12 changes: 6 additions & 6 deletions test/headinglevelsby.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
shift_heading_level_by = 0,
increment_heading_level_by = 0,
)
@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand Down Expand Up @@ -53,7 +53,7 @@ SUMMARY 2 *test-summary-2*
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

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

doc = test_pandoc(
"""
Expand All @@ -71,7 +71,7 @@ vim:tw=78:ts=8:noet:ft=help:norl:
shift_heading_level_by = 0,
increment_heading_level_by = 2,
)
@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand Down Expand Up @@ -108,7 +108,7 @@ SUMMARY 2 *test-summary-2*
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

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

doc = test_pandoc(
"""
Expand All @@ -126,7 +126,7 @@ vim:tw=78:ts=8:noet:ft=help:norl:
shift_heading_level_by = 1,
increment_heading_level_by = 2,
)
@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand Down Expand Up @@ -157,5 +157,5 @@ REFERENCES *test-references*
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""" == doc
end
8 changes: 4 additions & 4 deletions test/ignore_rawblock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ this is my great software, and this is a demo of it
<img alt="bla" src="blabla"/>
</h2>
""")
@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand All @@ -17,7 +17,7 @@ this is my great software, and this is a demo of it
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

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

doc = test_pandoc(
"""
Expand All @@ -29,7 +29,7 @@ this is my great software, and this is a demo of it
""";
ignore_rawblocks = false,
)
@test doc == """
@test """
*test.txt* Test Description

==============================================================================
Expand All @@ -42,5 +42,5 @@ this is my great software, and this is a demo of it
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""" == doc
end
8 changes: 4 additions & 4 deletions test/mapping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Diff compiles all indexed fennel files
toc = false,
demojify = true,
)
@test doc == raw"""
@test raw"""
*test.txt* Test Description

:FnlCompile[!] *:FnlCompile*
Expand All @@ -37,7 +37,7 @@ Diff compiles all indexed fennel files
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

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

doc = test_pandoc(
raw"""
Expand All @@ -57,7 +57,7 @@ Diff compiles all indexed fennel files
demojify = true,
doc_mapping = false,
)
@test doc == raw"""
@test raw"""
*test.txt* Test Description

:FNLCOMPILE[!]
Expand All @@ -78,5 +78,5 @@ Diff compiles all indexed fennel files
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:
"""
""" == doc
end
Loading