Module:T-Campaign: Difference between revisions
// via Wikitext Extension for VSCode Tags: Manual revert Reverted |
// via Wikitext Extension for VSCode Tag: Reverted |
||
| Line 183: | Line 183: | ||
end | end | ||
-- | -- INLINE PLACEHOLDER REPLACEMENT (copied from working T-Campaign-Git.lua) | ||
local | local placeholderValues = { | ||
CAMPAIGN_NAME = args._campaign_data.defaults.title or "Campaign" | |||
} | |||
if | -- Apply TemplateStarter's proven placeholder replacement strategy (exact copy from working version) | ||
local | local function replacePlaceholders(text, values) | ||
if not text or not values then | |||
return text | |||
end | |||
local result = text | |||
for key, value in pairs(values) do | |||
if value and value ~= "" then | |||
result = result:gsub("%$" .. key .. "%$", value) | |||
end | |||
end | end | ||
return result | |||
end | end | ||
-- | -- Apply placeholder replacement inline (no module boundary crossing) | ||
bannerContent = replacePlaceholders(bannerContent, placeholderValues) | |||
-- | -- Clean up any remaining unfilled placeholders (TemplateStarter's removeEmptyPlaceholders logic) | ||
bannerContent = bannerContent:gsub("%$[A-Z_]+%$", "") | |||
bannerContent = bannerContent:gsub("%s+", " "):gsub("^%s+", ""):gsub("%s+$", "") | |||
bannerContent = WikitextProcessor. | -- Now only send to WikitextProcessor for wiki link processing (no placeholder data needed) | ||
bannerContent = WikitextProcessor.processWikiLinksToHTML(bannerContent, context) | |||
local noticeData = { | local noticeData = { | ||