From 4ed15ffcc4032dec4b31def7d02ad8e100c91d5a Mon Sep 17 00:00:00 2001 From: myk002 Date: Sun, 10 Jul 2022 20:48:24 -0700 Subject: [PATCH] fix parsing of first line as the short_help --- library/lua/helpdb.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/library/lua/helpdb.lua b/library/lua/helpdb.lua index 83a281884..a145ab5f7 100644 --- a/library/lua/helpdb.lua +++ b/library/lua/helpdb.lua @@ -92,9 +92,10 @@ end -- end_marker (string that marks the end of the help text; text will stop -- being parsed after this marker is seen) -- no_header (don't try to find the entity name at the top of the help text) --- first_line_is_short_help (read the short help text from the first commented --- line of the script instead of using the first --- sentence of the long help text) +-- first_line_is_short_help (if set, then read the short help text from the +-- first commented line of the script instead of +-- using the first sentence of the long help text. +-- value is the comment character.) local function update_entry(entry, iterator, opts) opts = opts or {} local lines = {} @@ -104,7 +105,7 @@ local function update_entry(entry, iterator, opts) for line in iterator do if not short_help_found and first_line_is_short_help then line = line:trim() - local _,_,text = line:find('^%-%-%s*(.*)') or line:find('^#%s*(.*)') + local _,_,text = line:find('^'..first_line_is_short_help..'%s*(.*)') if not text then -- if no first-line short help found, fall back to getting the -- first sentence of the help text. @@ -212,7 +213,7 @@ local function make_script_entry(old_entry, entry_name, script_source_path) update_entry(entry, lines, {begin_marker=(is_rb and SCRIPT_DOC_BEGIN_RUBY or SCRIPT_DOC_BEGIN), end_marker=(is_rb and SCRIPT_DOC_BEGIN_RUBY or SCRIPT_DOC_END), - first_line_is_short_help=true}) + first_line_is_short_help=(is_rb and '#' or '%-%-')}) return entry end