Module:T-Campaign: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 183: | Line 183: | ||
end | end | ||
-- | -- WORKAROUND for Scribunto bug: Launder the string and replace directly. | ||
-- 1. Get the raw title value | |||
local rawTitle = args._campaign_data.defaults.title or "Campaign" | local rawTitle = args._campaign_data.defaults.title or "Campaign" | ||
-- | -- 2. Launder the string to create a clean copy | ||
local function launderString(inputStr) | local function launderString(inputStr) | ||
if type(inputStr) ~= 'string' then return tostring(inputStr) end | if type(inputStr) ~= 'string' then return tostring(inputStr) end | ||
| Line 195: | Line 197: | ||
return newStr | return newStr | ||
end | end | ||
local cleanTitle = launderString(rawTitle) | local cleanTitle = launderString(rawTitle) | ||
-- | -- 3. Directly replace the placeholder in the banner content string | ||
bannerContent = bannerContent:gsub("%$CAMPAIGN_NAME%$", cleanTitle) | |||
-- | -- 4. Pass the processed content to the WikitextProcessor for link handling only | ||
bannerContent = WikitextProcessor.processWikiLinksToHTML(bannerContent, context) | |||
bannerContent = WikitextProcessor. | |||
local noticeData = { | local noticeData = { | ||