Module:Sandbox: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| Line 27: | Line 27: | ||
return nil | return nil | ||
end | end | ||
end | |||
-- Helper function to preprocess text with proper newline handling | |||
local function preprocess_text(text) | |||
if not text then return text end | |||
-- First replace \"n with actual newlines | |||
text = text:gsub('\\"n', '\n') | |||
-- Then let MediaWiki's preprocess handle the newlines and other wikitext | |||
return mw.text.preprocess(text) | |||
end | end | ||
| Line 78: | Line 87: | ||
end | end | ||
-- | -- Preprocess the text (handles newlines and other wikitext) | ||
return preprocess_text(label) | |||
return label | |||
end | end | ||
| Line 118: | Line 125: | ||
-- Default to input label if localized string is not found | -- Default to input label if localized string is not found | ||
if (key == nil) then | if (key == nil) then | ||
return label | return preprocess_text(label) | ||
end | end | ||
if (data_lang[key] == nil) then | if (data_lang[key] == nil) then | ||
return label | return preprocess_text(label) | ||
end | end | ||
-- | -- Preprocess the text (handles newlines and other wikitext) | ||
return preprocess_text(data_lang[key]) | |||
end | end | ||