Skip to content

Commit 8370079

Browse files
committed
Update links
1 parent 6e98f33 commit 8370079

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

scripts/panvimdoc.lua

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,20 @@ function Doc(body, metadata, variables)
141141
add(renderToc(vim_doc_title))
142142
end
143143
add(body)
144-
local left = header_count .. ". Links"
145-
local right = "links"
146-
local right_link = string.format("|%s-%s|", stringify(meta.project), right)
147-
right = string.format("*%s-%s*", stringify(meta.project), right)
148-
local padding = string.rep(" ", 78 - #left - #right)
149-
table.insert(toc, { 1, left, right_link })
150-
add(string.rep("=", 78) .. "\n" .. string.format("%s%s%s", left, padding, right))
151-
add("")
152-
for i, v in ipairs(links) do
153-
add(i .. ". *" .. v[1] .. "*" .. ": " .. v[2])
144+
if #links > 0 then
145+
local left = header_count .. ". Links"
146+
local right = "links"
147+
local right_link = string.format("|%s-%s|", stringify(meta.project), right)
148+
right = string.format("*%s-%s*", stringify(meta.project), right)
149+
local padding = string.rep(" ", 78 - #left - #right)
150+
table.insert(toc, { 1, left, right_link })
151+
add(string.rep("=", 78) .. "\n" .. string.format("%s%s%s", left, padding, right))
152+
add("")
153+
for i, v in ipairs(links) do
154+
add(i .. ". *" .. v[1] .. "*" .. ": " .. v[2])
155+
end
154156
end
157+
add("Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>")
155158
add("")
156159
add("vim:tw=78:ts=8:noet:ft=help:norl:")
157160
return table.concat(buffer, "\n") .. "\n"

0 commit comments

Comments
 (0)