Module:T-Campaign: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
-- T-Campaign.lua | -- Module:T-Campaign.lua | ||
-- Generic campaign template that dynamically loads campaign data from JSON files | -- Generic campaign template that dynamically loads campaign data from JSON files | ||
-- Usage: {{#invoke:T-Campaign|render|campaign_name= | -- Usage: {{#invoke:T-Campaign|render|campaign_name=NAME}} | ||
local p = {} | local p = {} | ||
| Line 185: | Line 185: | ||
end | end | ||
-- | -- Use the centralized NoticeFactory to create the notice | ||
local | local noticeOptions = { | ||
type = "campaign-js", | type = "campaign-js", | ||
position = "top", | position = "top", | ||
content = bannerContent, | content = bannerContent, | ||
| Line 194: | Line 194: | ||
} | } | ||
return WikitextProcessor.createNoticeForJS(noticeOptions) .. ErrorHandling.formatCombinedOutput(context) | |||
end | end | ||
} | } | ||
| Line 412: | Line 396: | ||
end | end | ||
-- Add campaign-specific category | -- Add campaign-specific category, defaulting to template_id | ||
template.config.categories.base = { | local category_value = campaignData.category or campaignData.template_id | ||
template.config.categories.base = {category_value} | |||
return args | return args | ||