Module:NormalizationText: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode Tag: Reverted |
||
| Line 83: | Line 83: | ||
-- Core text normalization function | -- Core text normalization function | ||
function p.normalizeText(text) | function p.normalizeText(text) | ||
if not text | -- Handle nil, empty string, or non-string input | ||
if not text then | |||
return "" | |||
end | |||
-- Convert to string if it's not already a string | |||
if type(text) ~= "string" then | |||
text = tostring(text) | |||
end | |||
if text == "" then | |||
return text | return text | ||
end | end | ||