aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_help_html.lua
diff options
context:
space:
mode:
authorJongwook Choi <wookayin@gmail.com>2024-01-28 20:53:14 -0500
committerGitHub <noreply@github.com>2024-01-28 17:53:14 -0800
commit5b1b765610ae12ebd6400aafd068903569ee441a (patch)
treeab2372e5d076ed31472e4be2f03117f8fe87c1d3 /scripts/gen_help_html.lua
parentb0e85010fe8128a73d6aeae1af3a308d3791140f (diff)
downloadrneovim-5b1b765610ae12ebd6400aafd068903569ee441a.tar.gz
rneovim-5b1b765610ae12ebd6400aafd068903569ee441a.tar.bz2
rneovim-5b1b765610ae12ebd6400aafd068903569ee441a.zip
docs: enforce "treesitter" spelling #27110
It's the "tree-sitter" project, but "treesitter" in our code and docs.
Diffstat (limited to 'scripts/gen_help_html.lua')
-rw-r--r--scripts/gen_help_html.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua
index 20174bab97..8bc7d99985 100644
--- a/scripts/gen_help_html.lua
+++ b/scripts/gen_help_html.lua
@@ -42,9 +42,14 @@ local spell_dict = {
VimL = 'Vimscript',
vimL = 'Vimscript',
viml = 'Vimscript',
+ ['tree-sitter'] = 'treesitter',
+ ['Tree-sitter'] = 'Treesitter',
}
+--- specify the list of keywords to ignore (i.e. allow), or true to disable spell check completely.
+--- @type table<string, true|string[]>
local spell_ignore_files = {
- ['backers.txt'] = 'true',
+ ['backers.txt'] = true,
+ ['news.txt'] = { 'tree-sitter' }, -- in news, may refer to the upstream "tree-sitter" library
}
local language = nil
@@ -398,9 +403,15 @@ local function visit_validate(root, level, lang_tree, opt, stats)
then
local text_nopunct = vim.fn.trim(text, '.,', 0) -- Ignore some punctuation.
local fname_basename = assert(vim.fs.basename(opt.fname))
- if spell_dict[text_nopunct] and not spell_ignore_files[fname_basename] then
- invalid_spelling[text_nopunct] = invalid_spelling[text_nopunct] or {}
- invalid_spelling[text_nopunct][fname_basename] = node_text(root:parent())
+ if spell_dict[text_nopunct] then
+ local should_ignore = (
+ spell_ignore_files[fname_basename] == true
+ or vim.tbl_contains(spell_ignore_files[fname_basename] --[[ @as string[] ]], text_nopunct)
+ )
+ if not should_ignore then
+ invalid_spelling[text_nopunct] = invalid_spelling[text_nopunct] or {}
+ invalid_spelling[text_nopunct][fname_basename] = node_text(root:parent())
+ end
end
elseif node_name == 'url' then
local fixed_url, _ = fix_url(trim(text))