fix: tighten keyword detection to avoid preamble false positives

Problem: the 2-space inline keyword pattern matched preamble lines
like "The  possible keywords" where "The" was detected as a keyword.

Solution: require an uppercase letter after the 2 spaces, matching
real inline definitions (Tunnel  Request, SetEnv  Directly) but not
preamble text where the next word is lowercase.
This commit is contained in:
Barrett Ruth 2026-02-22 23:37:06 -05:00
parent e9bb8de70f
commit a145b2648a
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -52,7 +52,9 @@ local function extract_enums_from_man(man_stdout)
local defs = {}
for i, line in ipairs(lines) do
local kw = line:match('^ (%u[%a%d]+)%s*$') or line:match('^ (%u[%a%d]+) ')
local kw = line:match('^ (%u[%a%d]+)%s*$')
or line:match('^ (%u[%a%d]+) ')
or line:match('^ (%u[%a%d]+) %u')
if kw then
defs[#defs + 1] = { line = i, keyword = kw }
end
@ -163,7 +165,9 @@ local function parse_keywords(stdout)
local defs = {}
for i, line in ipairs(lines) do
local kw = line:match('^ (%u[%a%d]+)%s*$') or line:match('^ (%u[%a%d]+) ')
local kw = line:match('^ (%u[%a%d]+)%s*$')
or line:match('^ (%u[%a%d]+) ')
or line:match('^ (%u[%a%d]+) %u')
if kw then
local inline = line:match('^ %u[%a%d]+%s%s+(.+)')
defs[#defs + 1] = { line = i, keyword = kw, inline = inline }