Module:SemanticAnnotations: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 5: | Line 5: | ||
-- Trim whitespace helper | -- Trim whitespace helper | ||
local function trim(s) return (s:gsub("^%s+", ""):gsub("%s+$", "")) end | -- Trim function that handles nil values gracefully | ||
local function trim(s) | |||
if s == nil then | |||
return "" | |||
end | |||
return (s:gsub("^%s+", ""):gsub("%s+$", "")) | |||
end | |||
--[[ Generates semantic annotations using #set parser function | --[[ Generates semantic annotations using #set parser function | ||