From 88b45614e945f94bf91629e7078634fad9c80958 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 27 Oct 2025 18:36:59 -0400 Subject: [PATCH] fix(build): gen_help_html fails #36359 Problem: fe4faaf81a6f3 added an invalid "redirect" item, which caused the assert() to fail, which then caused the neovim/doc/ CI to fail: https://github.com/neovim/doc/actions/runs/18830779387/job/53721736276 : The previous commit e69beb9b1aba tried to fix a different issue, which has gone hidden because the "invalid tags" failure has been present on the neovim/doc/ but was silently failing. invalid tags: { ["g:netrw_keepdir"] = "usr_22.txt", netrw = "vi_diff.txt", ... plugins = "editorconfig" } Solution: - Fix the invalid redirect. - Improve the redirects assertion. --- runtime/doc/plugins.txt | 2 +- src/gen/gen_help_html.lua | 58 +++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/runtime/doc/plugins.txt b/runtime/doc/plugins.txt index 99c7593877..8c5b707c60 100644 --- a/runtime/doc/plugins.txt +++ b/runtime/doc/plugins.txt @@ -6,7 +6,7 @@ Type |gO| to see the table of contents. ============================================================================== -Plugins and modules included with Nvim +Plugins and modules included with Nvim *plugins* Nvim includes various Lua and Vim plugins or modules which may provide commands (such as :TOhtml) or modules that you can optionally require() or diff --git a/src/gen/gen_help_html.lua b/src/gen/gen_help_html.lua index 19023556a0..a89eb69f69 100644 --- a/src/gen/gen_help_html.lua +++ b/src/gen/gen_help_html.lua @@ -87,15 +87,15 @@ local new_layout = { ['vim_diff.txt'] = true, } --- Map of new:old pages, to redirect renamed pages. +-- Map of new-page:old-page, to redirect renamed pages. local redirects = { - ['api-ui-events'] = 'ui', - ['credits'] = 'backers', - ['dev'] = 'develop', - ['dev-tools'] = 'debug', - ['plugins'] = 'editorconfig', - ['terminal'] = 'nvim_terminal_emulator', - ['tui'] = 'term', + ['api-ui-events.txt'] = 'ui.txt', + ['credits.txt'] = 'backers.txt', + ['dev.txt'] = 'develop.txt', + ['dev_tools.txt'] = 'debug.txt', + ['plugins.txt'] = 'editorconfig.txt', + ['terminal.txt'] = 'nvim_terminal_emulator.txt', + ['tui.txt'] = 'term.txt', } -- TODO: These known invalid |links| require an update to the relevant docs. @@ -1297,10 +1297,11 @@ local function ok(cond, expected, actual, message) vim.inspect(actual) ) ) - return cond else - return assert(cond) + assert(cond) end + + return true end local function eq(expected, actual, message) return ok(vim.deep_equal(expected, actual), expected, actual, message) @@ -1407,29 +1408,27 @@ function M.gen(help_dir, to_dir, include, commit, parser_path) ) -- Generate redirect pages for renamed help files. - local helpfile_tag = (helpfile:gsub('%.txt$', '')) - local redirect_from = redirects[helpfile_tag] + local helpfile_tag = (helpfile:gsub('%.txt$', '')):gsub('_', '-') -- "dev_tools.txt" => "dev-tools" + local redirect_from = redirects[helpfile] if redirect_from then - local redirect_text = ([[ -*%s* Nvim + local redirect_text = vim.text + .indent( + 0, + [[ + *%s* Nvim -This document moved to: |%s| + This document moved to: |%s| -============================================================================== -This document moved to: |%s| + ============================================================================== + This document moved to: |%s| -This document moved to: |%s| + This document moved to: |%s| -============================================================================== - vim:tw=78:ts=8:ft=help:norl: - ]]):format( - redirect_from, - helpfile_tag, - helpfile_tag, - helpfile_tag, - helpfile_tag, - helpfile_tag - ) + ============================================================================== + vim:tw=78:ts=8:ft=help:norl: + ]] + ) + :format(redirect_from, helpfile_tag, helpfile_tag, helpfile_tag, helpfile_tag, helpfile_tag) local redirect_to = ('%s/%s'):format(to_dir, get_helppage(redirect_from)) local redirect_html, _ = gen_one(redirect_from, redirect_text, redirect_to, false, commit or '?', parser_path) @@ -1453,8 +1452,9 @@ This document moved to: |%s| print(('\ngenerated %d html pages'):format(#helpfiles + redirects_count)) print(('total errors: %d'):format(err_count)) + -- Why aren't the netrw tags found in neovim/docs/ CI? print(('invalid tags: %s'):format(vim.inspect(invalid_links))) - assert(#(include or {}) > 0 or redirects_count == vim.tbl_count(redirects)) -- sanity check + eq(redirects_count, include and redirects_count or vim.tbl_count(redirects)) -- sanity check print(('redirects: %d'):format(redirects_count)) print('\n')