%s
'):format(
language,
@@ -718,13 +752,15 @@ end
---
--- @param fname string help file to parse
--- @param parser_path string? path to non-default vimdoc.so
---- @returns lang_tree, bufnr
+--- @return LanguageTree, integer (lang_tree, bufnr)
local function parse_buf(fname, parser_path)
- local buf
+ local buf ---@type integer
if type(fname) == 'string' then
vim.cmd('split ' .. vim.fn.fnameescape(fname)) -- Filename.
buf = vim.api.nvim_get_current_buf()
else
+ -- Left for debugging
+ ---@diagnostic disable-next-line: no-unknown
buf = fname
vim.cmd('sbuffer ' .. tostring(fname)) -- Buffer number.
end
@@ -741,7 +777,7 @@ end
---
--- @param fname string help file to validate
--- @param parser_path string? path to non-default vimdoc.so
---- @returns { invalid_links: number, parse_errors: string[] }
+--- @return { invalid_links: number, parse_errors: string[] }
local function validate_one(fname, parser_path)
local stats = {
parse_errors = {},
@@ -762,7 +798,8 @@ end
--- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace)
--- @param parser_path string? path to non-default vimdoc.so
---
---- @returns html, stats
+--- @return string html
+--- @return table stats
local function gen_one(fname, to_fname, old, commit, parser_path)
local stats = {
noise_lines = {},
@@ -770,6 +807,7 @@ local function gen_one(fname, to_fname, old, commit, parser_path)
first_tags = {}, -- Track the first few tags in doc.
}
local lang_tree, buf = parse_buf(fname, parser_path)
+ ---@type nvim.gen_help_html.heading[]
local headings = {} -- Headings (for ToC). 2-dimensional: h1 contains h2/h3.
local title = to_titlecase(basename_noext(fname))
@@ -903,6 +941,7 @@ local function gen_one(fname, to_fname, old, commit, parser_path)
main
)
+ ---@type string
local toc = [[