From 6da110d617dba6378f770c5d66d523df92f2d355 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 3 Jul 2023 05:04:43 -0700 Subject: [PATCH] docs(gen_help_html): accept "~/" in file/dir params #24240 --- scripts/gen_help_html.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua index 7f84a4d54d..5575de5b36 100644 --- a/scripts/gen_help_html.lua +++ b/scripts/gen_help_html.lua @@ -1089,7 +1089,7 @@ end --- @returns info dict function M.gen(help_dir, to_dir, include, commit, parser_path) vim.validate{ - help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'}, + help_dir={help_dir, function(d) return vim.fn.isdirectory(vim.fn.expand(d)) == 1 end, 'valid directory'}, to_dir={to_dir, 's'}, include={include, 't', true}, commit={commit, 's', true}, @@ -1098,8 +1098,9 @@ function M.gen(help_dir, to_dir, include, commit, parser_path) local err_count = 0 ensure_runtimepath() - tagmap = get_helptags(help_dir) + tagmap = get_helptags(vim.fn.expand(help_dir)) helpfiles = get_helpfiles(include) + to_dir = vim.fn.expand(to_dir) parser_path = parser_path and vim.fn.expand(parser_path) or nil print(('output dir: %s'):format(to_dir)) @@ -1134,14 +1135,14 @@ end -- @returns results dict function M.validate(help_dir, include, parser_path) vim.validate{ - help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'}, + help_dir={help_dir, function(d) return vim.fn.isdirectory(vim.fn.expand(d)) == 1 end, 'valid directory'}, include={include, 't', true}, parser_path={parser_path, function(f) return f == nil or vim.fn.filereadable(vim.fn.expand(f)) == 1 end, 'valid vimdoc.{so,dll} filepath'}, } local err_count = 0 local files_to_errors = {} ensure_runtimepath() - tagmap = get_helptags(help_dir) + tagmap = get_helptags(vim.fn.expand(help_dir)) helpfiles = get_helpfiles(include) parser_path = parser_path and vim.fn.expand(parser_path) or nil