Module:AbilityTable: Difference between revisionsGive feedback
Jump to navigation
Jump to search
compact view: include auto-notes alongside human notes; change note concatenation separator to semicolon (with help from vergir-bot LLM) |
Refactor human note merging: full table uses ". " separator with capitalisation/period normalisation; compact uses "; " with decapitalisation/period stripping (with T1/T2/T3 prefix guard) (with help from vergir-bot LLM) |
||
| Line 184: | Line 184: | ||
end | end | ||
return nil, nil, nil | return nil, nil, nil | ||
end | |||
-- ============================================================ | |||
-- Human-note formatters | |||
-- ============================================================ | |||
-- Full-table mode: capitalise first letter, ensure trailing ".". | |||
local function human_note_full(note) | |||
if not note or note == "" then return note end | |||
note = note:sub(1,1):upper() .. note:sub(2) | |||
if note:sub(-1) ~= "." then note = note .. "." end | |||
return note | |||
end | |||
-- Compact mode: decapitalise first letter unless it looks like a tier prefix | |||
-- (e.g. "T1", "T2") — i.e. uppercase letter immediately followed by a digit. | |||
-- Also strips any trailing ".". | |||
local function human_note_compact(note) | |||
if not note or note == "" then return note end | |||
local first = note:sub(1,1) | |||
if first:match("%u") and not note:sub(2,2):match("%d") then | |||
note = first:lower() .. note:sub(2) | |||
end | |||
if note:sub(-1) == "." then note = note:sub(1, -2) end | |||
return note | |||
end | end | ||
| Line 775: | Line 800: | ||
local extra = get_cells(ability) | local extra = get_cells(ability) | ||
if stat_notes and stat_notes[name] then | if stat_notes and stat_notes[name] then | ||
local human = stat_notes[name] | local human = human_note_compact(stat_notes[name]) | ||
extra["Notes"] = extra["Notes"] and (extra["Notes"] .. "; " .. human) or human | extra["Notes"] = extra["Notes"] and (extra["Notes"] .. "; " .. human) or human | ||
end | end | ||
| Line 830: | Line 855: | ||
if stat_notes and stat_notes[ability["Name"]] then | if stat_notes and stat_notes[ability["Name"]] then | ||
local human = stat_notes[ability["Name"]] | local human = human_note_full(stat_notes[ability["Name"]]) | ||
extra["Notes"] = extra["Notes"] and (extra["Notes"] .. " | extra["Notes"] = extra["Notes"] and (extra["Notes"] .. ". " .. human) or human | ||
end | end | ||