[Backport release-0.8] docs: fix/remove invalid URLs (#20735)

docs: fix/remove invalid URLs

(cherry picked from commit ec1e71109c)

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This commit is contained in:
github-actions[bot]
2022-10-19 05:06:20 -07:00
committed by GitHub
parent e7ed53286e
commit 5a14c820a9
39 changed files with 129 additions and 310 deletions

View File

@@ -318,6 +318,16 @@ local function validate_link(node, bufnr, fname)
return helppage, tagname, ignored
end
local function validate_url(text, fname)
local ignored = false
if vim.fs.basename(fname) == 'pi_netrw.txt' then
ignored = true
elseif text:find('http%:') then
invalid_urls[text] = vim.fs.basename(fname)
end
return ignored
end
-- Traverses the tree at `root` and checks that |tag| links point to valid helptags.
local function visit_validate(root, level, lang_tree, opt, stats)
level = level or 0
@@ -352,9 +362,7 @@ local function visit_validate(root, level, lang_tree, opt, stats)
end
end
elseif node_name == 'url' then
if text:find('http%:') then
invalid_urls[text] = vim.fs.basename(opt.fname)
end
validate_url(text, opt.fname)
elseif node_name == 'taglink' or node_name == 'optionlink' then
local _, _, _ = validate_link(root, opt.buf, opt.fname)
end

View File

@@ -12,15 +12,10 @@ Flow:
update_params_map /
render_node
This would be easier using lxml and XSLT, but:
TODO: eliminate this script and use Lua+treesitter (requires parsers for C and
Lua markdown-style docstrings).
1. This should avoid needing Python dependencies, especially ones that are
C modules that have library dependencies (lxml requires libxml and
libxslt).
2. I wouldn't know how to deal with nested indentation in <para> tags using
XSLT.
Each function :help block is formatted as follows:
The generated :help text for each function is formatted as follows:
- Max width of 78 columns (`text_width`).
- Indent with spaces (not tabs).