aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_help_html.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-09 19:17:50 +0800
committerGitHub <noreply@github.com>2024-07-09 19:17:50 +0800
commit487f44a6c14f83a4f80a4d03a4a8c16ad690927a (patch)
treea6b9a3ee145bc0588940cda4852cd92528ce9ca0 /scripts/gen_help_html.lua
parentfb6c059dc55c8d594102937be4dd70f5ff51614a (diff)
downloadrneovim-487f44a6c14f83a4f80a4d03a4a8c16ad690927a.tar.gz
rneovim-487f44a6c14f83a4f80a4d03a4a8c16ad690927a.tar.bz2
rneovim-487f44a6c14f83a4f80a4d03a4a8c16ad690927a.zip
fix(lua): change some vim.fn.expand() to vim.fs.normalize() (#29583)
Unlike vim.fn.expand(), vim.fs.normalize() doesn't expand wildcards.
Diffstat (limited to 'scripts/gen_help_html.lua')
-rw-r--r--scripts/gen_help_html.lua24
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua
index 4584d87bf5..003f3efa03 100644
--- a/scripts/gen_help_html.lua
+++ b/scripts/gen_help_html.lua
@@ -1223,7 +1223,7 @@ end
function M._test()
tagmap = get_helptags('$VIMRUNTIME/doc')
- helpfiles = get_helpfiles(vim.fn.expand('$VIMRUNTIME/doc'))
+ helpfiles = get_helpfiles(vim.fs.normalize('$VIMRUNTIME/doc'))
ok(vim.tbl_count(tagmap) > 3000, '>3000', vim.tbl_count(tagmap))
ok(
@@ -1285,7 +1285,7 @@ function M.gen(help_dir, to_dir, include, commit, parser_path)
help_dir = {
help_dir,
function(d)
- return vim.fn.isdirectory(vim.fn.expand(d)) == 1
+ return vim.fn.isdirectory(vim.fs.normalize(d)) == 1
end,
'valid directory',
},
@@ -1295,7 +1295,7 @@ function M.gen(help_dir, to_dir, include, commit, parser_path)
parser_path = {
parser_path,
function(f)
- return f == nil or vim.fn.filereadable(vim.fn.expand(f)) == 1
+ return f == nil or vim.fn.filereadable(vim.fs.normalize(f)) == 1
end,
'valid vimdoc.{so,dll} filepath',
},
@@ -1303,10 +1303,10 @@ function M.gen(help_dir, to_dir, include, commit, parser_path)
local err_count = 0
ensure_runtimepath()
- tagmap = get_helptags(vim.fn.expand(help_dir))
+ tagmap = get_helptags(vim.fs.normalize(help_dir))
helpfiles = get_helpfiles(help_dir, include)
- to_dir = vim.fn.expand(to_dir)
- parser_path = parser_path and vim.fn.expand(parser_path) or nil
+ to_dir = vim.fs.normalize(to_dir)
+ parser_path = parser_path and vim.fs.normalize(parser_path) or nil
print(('output dir: %s'):format(to_dir))
vim.fn.mkdir(to_dir, 'p')
@@ -1358,7 +1358,7 @@ function M.validate(help_dir, include, parser_path)
help_dir = {
help_dir,
function(d)
- return vim.fn.isdirectory(vim.fn.expand(d)) == 1
+ return vim.fn.isdirectory(vim.fs.normalize(d)) == 1
end,
'valid directory',
},
@@ -1366,7 +1366,7 @@ function M.validate(help_dir, include, parser_path)
parser_path = {
parser_path,
function(f)
- return f == nil or vim.fn.filereadable(vim.fn.expand(f)) == 1
+ return f == nil or vim.fn.filereadable(vim.fs.normalize(f)) == 1
end,
'valid vimdoc.{so,dll} filepath',
},
@@ -1374,9 +1374,9 @@ function M.validate(help_dir, include, parser_path)
local err_count = 0 ---@type integer
local files_to_errors = {} ---@type table<string, string[]>
ensure_runtimepath()
- tagmap = get_helptags(vim.fn.expand(help_dir))
+ tagmap = get_helptags(vim.fs.normalize(help_dir))
helpfiles = get_helpfiles(help_dir, include)
- parser_path = parser_path and vim.fn.expand(parser_path) or nil
+ parser_path = parser_path and vim.fs.normalize(parser_path) or nil
for _, f in ipairs(helpfiles) do
local helpfile = vim.fs.basename(f)
@@ -1411,7 +1411,7 @@ end
---
--- @param help_dir? string e.g. '$VIMRUNTIME/doc' or './runtime/doc'
function M.run_validate(help_dir)
- help_dir = vim.fn.expand(help_dir or '$VIMRUNTIME/doc')
+ help_dir = vim.fs.normalize(help_dir or '$VIMRUNTIME/doc')
print('doc path = ' .. vim.uv.fs_realpath(help_dir))
local rv = M.validate(help_dir)
@@ -1438,7 +1438,7 @@ end
--- @param help_dir? string e.g. '$VIMRUNTIME/doc' or './runtime/doc'
function M.test_gen(help_dir)
local tmpdir = vim.fs.dirname(vim.fn.tempname())
- help_dir = vim.fn.expand(help_dir or '$VIMRUNTIME/doc')
+ help_dir = vim.fs.normalize(help_dir or '$VIMRUNTIME/doc')
print('doc path = ' .. vim.uv.fs_realpath(help_dir))
-- Because gen() is slow (~30s), this test is limited to a few files.