Content deleted Content added
better error handling |
Sophivorus (talk | contribs) Merge falsy() and is() functions |
||
Line 11:
end
-- Helper function to test for truthy and falsy values
local function
if not value or value == "" or value == "0" or value == "false" or value == "no" then
return
end
return
end
Line 425:
t = t .. token -- keep wanted block templates
elseif
t = t .. token -- keep tables
Line 492:
text = mw.ustring.gsub(text, "</[Oo][Nn][Ll][Yy][Ii][Nn][Cc][Ll][Uu][Dd][Ee]>.*", "") -- remove text after last onlyinclude section
end
if
local escapedFragment = mw.ustring.gsub( options.fragment, "[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%0" )
local fragments = ""
Line 507:
text = fragments
end
if
text = mw.ustring.gsub(text, "\n==.*","") -- remove first ==Heading== and everything after it
text = mw.ustring.gsub(text, "^==.*","") -- ...even if the lead is empty
end
if
text = mw.ustring.gsub(text, "<%s*[Rr][Ee][Ff][^>]-/%s*>", "") -- remove refs cited elsewhere
text = mw.ustring.gsub(text, "<%s*[Rr][Ee][Ff].->.-<%s*/%s*[Rr][Ee][Ff]%s*>", "") -- remove refs
Line 650:
-- remove '''bold text''' if requested
if
text = filetext .. text
Line 763:
return frame:preprocess(text)
end
end
|