Module:TemplateStarter: Difference between revisions
// via Wikitext Extension for VSCode |
Maintenance update // via Wikitext Extension for VSCode |
||
| Line 152: | Line 152: | ||
templateType = mw.text.trim(tostring(templateType)) | templateType = mw.text.trim(tostring(templateType)) | ||
-- Handle "None" special case | |||
if templateType == "None" then | |||
return "" | |||
end | |||
-- Parse template to check if it's a variant | -- Parse template to check if it's a variant | ||
| Line 232: | Line 237: | ||
-- Sort the final combined list | -- Sort the final combined list | ||
table.sort(templatesWithCampaigns) | table.sort(templatesWithCampaigns) | ||
-- Add "None" option at the beginning | |||
table.insert(templatesWithCampaigns, 1, "None") | |||
return templatesWithCampaigns | return templatesWithCampaigns | ||
| Line 238: | Line 246: | ||
-- Parse campaign template name to get base template and campaign info | -- Parse campaign template name to get base template and campaign info | ||
function p.parseVariantTemplate(templateName) | function p.parseVariantTemplate(templateName) | ||
if not templateName or templateName == "" then | if not templateName or templateName == "" or templateName == "None" then | ||
return nil | return nil | ||
end | end | ||
| Line 325: | Line 333: | ||
-- Get creator fields for a specific template type | -- Get creator fields for a specific template type | ||
function p.getCreatorFields(templateType) | function p.getCreatorFields(templateType) | ||
if not templateType or templateType == "" then | if not templateType or templateType == "" or templateType == "None" then | ||
return {} | return {} | ||
end | end | ||