From ebfe00b112a69fdea0ea9a50116e5529f1e620db Mon Sep 17 00:00:00 2001 From: myk002 Date: Fri, 5 Aug 2022 10:08:23 -0700 Subject: [PATCH] editing pass of short descriptions and fix some short description parsing --- docs/plugins/jobutils.rst | 2 ++ docs/plugins/pathable.rst | 3 ++- docs/plugins/prospector.rst | 4 ++-- docs/plugins/resume.rst | 2 +- docs/plugins/search.rst | 7 ++++--- docs/plugins/xlsxreader.rst | 2 +- library/lua/helpdb.lua | 29 +++++++++++++++++++---------- 7 files changed, 31 insertions(+), 18 deletions(-) diff --git a/docs/plugins/jobutils.rst b/docs/plugins/jobutils.rst index e8434abdc..2ecf2b591 100644 --- a/docs/plugins/jobutils.rst +++ b/docs/plugins/jobutils.rst @@ -7,6 +7,8 @@ Tags: :dfhack-keybind:`job-duplicate` :dfhack-keybind:`job-material` +Inspect or modify details of workshop jobs. + Usage: ``job`` diff --git a/docs/plugins/pathable.rst b/docs/plugins/pathable.rst index daf7697bc..7a906ad89 100644 --- a/docs/plugins/pathable.rst +++ b/docs/plugins/pathable.rst @@ -1,6 +1,7 @@ pathable ======== -Provides a Lua API for marking tiles that are reachable from the cursor. +Marks tiles that are reachable from the cursor. This plugin provides a Lua API, +but no direct commands. See `pathable-api` for details. diff --git a/docs/plugins/prospector.rst b/docs/plugins/prospector.rst index 95436abec..718f92fa6 100644 --- a/docs/plugins/prospector.rst +++ b/docs/plugins/prospector.rst @@ -5,8 +5,8 @@ prospector Tags: :dfhack-keybind:`prospect` -Shows a summary of resources that exist on the map or an estimate of resources -available in the selected embark area. +Shows a summary of resources that exist on the map. It can also calculate an +estimate of resources available in the selected embark area. Usage:: diff --git a/docs/plugins/resume.rst b/docs/plugins/resume.rst index d8feb0896..7afb9be0d 100644 --- a/docs/plugins/resume.rst +++ b/docs/plugins/resume.rst @@ -1,7 +1,7 @@ resume ====== Tags: -:dfhack-keybind:`` +:dfhack-keybind:`resume` Color planned buildings based on their suspend status. When enabled, this plugin will display a colored 'X' over suspended buildings. When run as a command, it diff --git a/docs/plugins/search.rst b/docs/plugins/search.rst index c8f5d68b3..edf6fb47c 100644 --- a/docs/plugins/search.rst +++ b/docs/plugins/search.rst @@ -4,9 +4,10 @@ search ====== Tags: -The search plugin adds search capabilities to the Stocks, Animals, Trading, -Stockpile, Noble (assignment candidates), Military (position candidates), -Burrows (unit list), Rooms, Announcements, Job List, and Unit List screens. +Adds search capabilities to the UI. The Stocks, Animals, Trading, Stockpile, +Noble (assignment candidates), Military (position candidates), Burrows (unit +list), Rooms, Announcements, Job List, and Unit List screens all get hotkeys +that allow you to dynamically filter the displayed lists. Usage:: diff --git a/docs/plugins/xlsxreader.rst b/docs/plugins/xlsxreader.rst index 6429ceedc..d09b69644 100644 --- a/docs/plugins/xlsxreader.rst +++ b/docs/plugins/xlsxreader.rst @@ -1,6 +1,6 @@ xlsxreader ========== -Provides a Lua API for reading .xlsx files. +Provides a Lua API for reading xlsx files. See `xlsxreader-api` for details. diff --git a/library/lua/helpdb.lua b/library/lua/helpdb.lua index cf8e86af5..a23002e57 100644 --- a/library/lua/helpdb.lua +++ b/library/lua/helpdb.lua @@ -142,11 +142,11 @@ end -- value is the comment character.) local function update_entry(entry, iterator, opts) opts = opts or {} - local lines = {} + local lines, tags = {}, '' local first_line_is_short_help = opts.first_line_is_short_help local begin_marker_found,header_found = not opts.begin_marker,opts.no_header local tags_found, short_help_found = false, opts.skip_short_help - local in_short_help = false + local in_tags, in_keybinding, in_short_help = false, false, false for line in iterator do if not short_help_found and first_line_is_short_help then line = line:trim() @@ -179,16 +179,21 @@ local function update_entry(entry, iterator, opts) end if not header_found and line:find('%w') then header_found = true - elseif not tags_found and line:find('^[*]*Tags:[*]* [%w, ]+$') then - local _,_,tags = line:trim():find('[*]*Tags:[*]* *(.*)') - entry.tags = {} - for _,tag in ipairs(tags:split('[ ,]+')) do - entry.tags[tag] = true + elseif in_tags then + if #line == 0 then + in_tags = false + else + tags = tags .. line end - tags_found = true + elseif not tags_found and line:find('^[*]*Tags:[*]*') then + _,_,tags = line:trim():find('[*]*Tags:[*]* *(.*)') + in_tags, tags_found = true, true + elseif in_keybinding then + if #line == 0 then in_keybinding = false end + elseif line:find('^[*]*Keybinding:') then + in_keybinding = true elseif not short_help_found and - not line:find('^[*]*Keybinding:') and - line:find('%w') then + line:find('^%w') then if in_short_help then entry.short_help = entry.short_help .. ' ' .. line else @@ -205,6 +210,10 @@ local function update_entry(entry, iterator, opts) table.insert(lines, line) ::continue:: end + entry.tags = {} + for _,tag in ipairs(tags:split('[ ,]+')) do + entry.tags[tag] = true + end if #lines > 0 then entry.long_help = table.concat(lines, '\n') end