Module:Category Header

local p = {}

local Franchise = require('Module:Franchise') local utilsError = require('Module:UtilsError') local utilsPage = require('Module:UtilsPage') local frame = mw.getCurrentFrame

function p.Main(frame) return p.main(frame.args) end

function p.main(args) local pagename = args[1] --Calls, unless the user has manually defined it with "|page=" local game = args[2] --User input; the gamecode relating to the category (Uses Data:Franchise) local displaytitle = "" local returnHeader = "" --MAINSPACE CATEGORIES if (string.match(string.lower(pagename), "bosses in")) then local gallery = frame:expandTemplate{title= 'Gallery', args= {pagename}} displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s\nThe following is a list of all Bosses featured in %s.\n%s\n", displaytitle, Franchise.shortName(game), Franchise.link(game), gallery, Franchise.shortName(game)) elseif (string.match(string.lower(pagename), "characters in")) then local gallery = frame:expandTemplate{title= 'Gallery', args= {pagename}} displaytitle = frame:preprocess(string.format("{{DISPLAYTITLE:Category:Characters in %s}", Franchise.display(game))) returnHeader = string.format("%s\nThe following is a list of all characters featured in %s.\n%s\n", displaytitle, Franchise.link(game), gallery, Franchise.shortName(game)) --MAINTENANCE CATEGORIES elseif (string.match(string.lower(pagename), "articles needing attention")) then if (pagename == "Community articles needing attention") then returnHeader = "__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following is a list of articles in the Community: namespace that have been flagged with maintenance templates. They are grouped into sub-categories according to the nature of their defects. This category and all subcategories are hidden from view in the mainspace.\n*Category:Community articles lacking sources contains articles with unsourced content that need citations added to them.\n*Category:Community articles needing improvement contains articles that have multiple non-specific flaws and are in general need of improvement.\n*Category:Community articles needing reorganization contains articles that are disorganized and/or outdated and need reorganization.\n*Category:Community articles with files requested contains articles that are lacking files throughout the article.\n" else if (utilsPage.exists("Category:Articles lacking information from " .. Franchise.shortName(game))) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following is a list of articles pertaining to %s that have been flagged with maintenance templates. They are grouped into sub-categories according to the nature of their defects. This category is hidden from view in the mainspace.\n*Category:Articles lacking information from %s contains articles that are outdated and require modern information from the latest release.\n*Category:%s articles lacking files contains articles that do not have an file in their infobox.\n*Category:%s articles lacking sources contains articles that have one or more statements or claims that do not have a citation to support it.\n*Category:%s articles needing improvement contains articles that have multiple non-specific flaws and are poorly written overall.\n*Category:%s articles needing reorganization contains articles that are disorganized and use outdated formatting.\n*Category:%s articles with invalid or missing terms contains articles that call the  template for a term that is not stored.\n*Category:Incomplete %s articles contains articles that are incomplete or stubs and need to be expanded upon.\n\n", displaytitle, Franchise.link(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game)) else displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following is a list of articles pertaining to %s that have been flagged with maintenance templates. They are grouped into sub-categories according to the nature of their defects. This category is hidden from view in the mainspace.\n*Category:%s articles lacking files contains articles that do not have an file in their infobox.\n*Category:%s articles lacking sources contains articles that have one or more statements or claims that do not have a citation to support it.\n*Category:%s articles needing improvement contains articles that have multiple non-specific flaws and are poorly written overall.\n*Category:%s articles needing reorganization contains articles that are disorganized and use outdated formatting.\n*Category:%s articles with invalid or missing terms contains articles that call the  template for a term that is not stored.\n*Category:Incomplete %s articles contains articles that are incomplete or stubs and need to be expanded upon.\n\n", displaytitle, Franchise.link(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game)) local gameCategory = "Category:"..Franchise.shortName(game) -- Without this existence check a lot of categories appear in Special:WantedCategories that no one seems to care enough about to add (e.g. Category:A Link to the Past (Barcode Battler II)) -- We may want to consider removing this existence check and create those categories. if utilsPage.exists(gameCategory) then returnHeader = returnHeader..""..gameCategory.."" end end end elseif (string.match(string.lower(pagename), "articles lacking files")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles lack files pertaining to %s. In the infobox, any tabs that do not have files are instead filled with a \"No Image\" notice, which you may click to be taken to a place to upload a file. This category is almost entirely automated by the  template, so when all files are uploaded for an article, the article will automatically be taken out of this category. This category is hidden from view in the mainspace.\n\nOther subcategories:\n*Category:%s files requested contains articles that are marked with the   template; these articles have been marked as needing more files outside of the infobox in the article content and/or the gallery section.\n\n", displaytitle, Franchise.link(game), Franchise.shortName(game), game, Franchise.shortName(game)) elseif (string.match(string.lower(pagename), "articles lacking sources")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles lack citations pertaining to %s. All articles in this category contain pieces of information that are possibly false and require verification to be kept on the article. This category is hidden on mainspace articles.\n\nOther subcategories:\n*Category:%s articles lacking name references contains articles that are lacking official names, which are marked by the  template.\n\n===Fixing Unsourced Claims===\nTo remove articles from this category, you must either:\n*Add a citation next to the skeptical information on the article. For more information on how to add citations effectively, see Guidelines:References.\n*Remove the information from the article if you are confident that it is untrue and cannot find any references to back it up. If the information in question is an entire article, you may use the   template to mark the article for deletion.\n\n===Reporting Unsourced Claims===\nTo add articles to this category, you can use one of these two templates:\n*, if whole articles or sections generally lack citations. Place this underneath the header for the section in question, or in the case of an article, place it underneath the lead sentence and infobox.\n*, if a specific portion of info needs a citation. Place this after the punctuation in the skeptical sentence.\n\n", displaytitle, Franchise.link(game), Franchise.shortName(game), game, game, Franchise.shortName(game))   elseif (string.match(string.lower(pagename), "articles lacking name references")) then		displaytitle = frame:preprocess(string.format("", Franchise.display(game)))	        returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles lack official names pertaining to %s. All articles in this category have a name that is not confirmed to be official and needs a reference added. This category is hidden from view in the mainspace.\n\n===Fixing Unsourced Names===\nTo remove articles from this category, you must either:\n*Add a citation in the lead sentence(s) about where an offical name can be found, making sure it fits the Terminology Guidelines.\n*If you are confident that there is no official name for the subject anywhere, you may mark the article with the  template. From there, the article will be reviewed and determined if the content is better fit elsewhere or if the article should just be deleted.\n\n===Reporting Unsourced Names===\nTo add articles to this category, you can use the  template, putting it after the first lead sentence on the article.\n\n", displaytitle, Franchise.link(game), game, Franchise.shortName(game), Franchise.shortName(game))    elseif (string.match(string.lower(pagename), "articles needing improvement")) then		if (pagename == "Community articles needing improvement") then	        returnHeader = "__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following community articles (or sections within community articles) are in general need of improvement. They may be poorly written, disorganized, unprofessional, or otherwise not up to Zelda Wiki's quality standards. These articles require general clean up and fixes throughout a large area of the article, and in some cases complete rewrites may be required. This category is hidden from view in the mainspace.\n\nMore articles can be added to this list by tagging them with the  template, which should be formatted as \" ,\" or by tagging them with the   template if the problem is with the article's formallity and style, which should be formatted as \" .\" (For examples on what to enter for, see here.) When a article on this list is fixed, be sure to remove the template from the article to remove it from this category.\n\n"		else			displaytitle = frame:preprocess(string.format("", Franchise.display(game)))	        returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles (or sections within articles) relating to %s are in general need of improvement. They may be poorly written, disorganized, unprofessional, or otherwise not up to Zelda Wiki's quality standards. These articles require general clean up and fixes throughout a large area of the article, and in some cases complete rewrites may be required. This category is hidden from view in the mainspace.\n\nMore articles can be added to this list by tagging them with the  template, which should be formatted as \" ,\" or by tagging them with the   template if the problem is with the article's formallity and style, which should be formatted as \" .\" (For examples on what to enter for, see here.) When a article on this list is fixed, be sure to remove the template from the article to remove it from this category.\n\nOther subcategories:\n*Category:%s statements needing clarification contains articles with unclear statements.\n*Category:%s statements needing verification contains articles with statements that may be false and need to be proven.\n\n", displaytitle, Franchise.link(game), game, game, Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game))		end	elseif (string.match(string.lower(pagename), "statements needing clarification")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles contain one or more vague and unspecific statements pertaining to %s. For example, they may contain weasel words such as \"in some games,\" \"a certain amount,\" \"some people,\" etc., which should be clarified to make the information more accurate and reliable.\n\nTo add articles to this category, you can tag a sentence with any of these templates:\n* can be used to mark statements that vaguely point towards a group without specifying one subject. (\"in some games,\" \"in some areas\")\n*  can be used to mark statements that are very opinionated and less fact-based, especially if they do not have a citation to do along with them. (\"Fi is the most popular character in The Legend of Zelda series,\" \"The Fire Rod is the coolest Item\")\n*  can be used to mark vague time periods. (\"eventually,\" \"after some time\")\n* can be used to mark vague statements relating to actions. (\"Link defeated Ganon,\" \"The layout of the room was changed in the final version,\" \"Big Switches can open paths forward\")\n* can be used to mark statements with unspecific quantifiers. (\"a certain amount,\" \"lots of,\" \"many,\" \"some\")\n* can be used when none of the previous templates fit.\n\n", displaytitle, Franchise.link(game), game, game, game, game, game, game, Franchise.shortName(game))	elseif (string.match(string.lower(pagename), "statements needing verification")) then		displaytitle = frame:preprocess(string.format("", Franchise.display(game)))		returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles contain one or more unsourced and possibly dubious statements pertaining to %s. More articles can be added to this category by using the  template. If a reliable citation cannot be found to verify the claim, you may instead either test the claim in-game yourself or find a video or image that proves the statement. Once you have verified the statement, you may remove the  tag (or remove the claim if you find it to be false). When removing the tag, please add the citation or provide visual proof (i.e. a video or image) if possible; verification tags removed without proof may be re-added.\n\n", displaytitle, Franchise.link(game), game, game, Franchise.shortName(game))   elseif (string.match(string.lower(pagename), "articles needing reorganization")) then		if (pagename == "Community articles needing reorganization") then			returnHeader = "__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following community articles (or sections within community articles) are in need of reorganization. They may use an outdated article structure, outdated formatting, or are generally disorganized and otherwise not up to Zelda Wiki's quality standards. These articles need content and sometimes entire sections moved around, either to other locations in the article or to a different article entirely. This category is hidden from view in the mainspace.\n\nMore articles can be added to this list by tagging them with the   template. When an article on this list is fixed, be sure to remove the template from the article to remove it from this category.\n\n"		else			displaytitle = frame:preprocess(string.format("", Franchise.display(game)))			returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles (or sections within articles) pertaining to %s are in need of reorganization. They may use an outdated article structure, outdated formatting, or are generally disorganized and otherwise not up to Zelda Wiki's quality standards. These articles need content and sometimes entire sections moved around, either to other locations in the article or to a different article entirely. This category is hidden from view in the mainspace.\n\nMore articles can be added to this list by tagging them with the  template. When an article on this list is fixed, be sure to remove the template from the article to remove it from this category.\n\n", displaytitle, Franchise.link(game), game, Franchise.shortName(game)) end elseif (string.match(string.lower(pagename), "articles lacking information from")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles pertaining to %s are outdated and need to be updated following the release of new information. All articles in this category are marked with the  template which should be removed after the article content is updated. This category is hidden from view in the mainspace.\n\n", displaytitle, Franchise.link(game), game, Franchise.shortName(game)) elseif (string.match(string.lower(pagename), "articles with invalid or missing terms")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles use the  template to call terms in %s that do not exist in the cargo table. This can be caused by either a typo causing an invalid term, which the solution would be fixing the typo, or by a term that has yet to be stored, which the solution is to store the term after a name reference is added.\n\nAll articles in this category are automatically added by the   template and once the terms are fixed or stored, they will automatically be removed. This category is hidden from view in the mainspace.\n", displaytitle, Franchise.link(game)) if game ~= "Series" then returnHeader = returnHeader..string.format("", Franchise.shortName(game)) end elseif string.find(pagename, "[Aa]rticles with incomplete data") then returnHeader = mw.getCurrentFrame:expandTemplate({			title = "Category Header/Incomplete Data",			args = {game}		}) elseif (string.match(string.lower(pagename), "incomplete") and string.match(string.lower(pagename), "sections")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following is a list of articles contain one or more sections pertaining to %s that are largely incomplete. These articles may lack general content, have incomplete tables, or generally do not cover the topic well. All articles in this category are marked with the  template which should be removed once the holes in the articles are filled in. This category is hidden from view in the mainspace.\n\n", displaytitle, Franchise.link(game), game, Franchise.shortName(game)) elseif (string.match(string.lower(pagename), "incomplete") and string.match(string.lower(pagename), "articles")) then displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following is a list of articles pertaining to %s that are largely incomplete. These articles may lack general content, have incomplete tables, or generally do not cover the topic well. All articles in this category are marked with the  template which should be removed once the holes in the articles are filled in. This category and its subcategory are hidden from view in the mainspace.\n\nOther subcategories:\n*Category:Incomplete %s sections contains %s articles that have only sections of a page that are incomplete.\n\n", displaytitle, Franchise.link(game), game, Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game)) elseif (string.match(string.lower(pagename), "files requested")) then if (pagename == "Community articles with files requested") then returnHeader = "__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following community articles have been requested to have more files added to them. Articles in this category have been marked with the  template; these articles have been marked as needing more files outside of just the infobox, in the article content and/or the gallery section. This category has been sorted into subcategories grouped by piece of media.\n\n" else displaytitle = frame:preprocess(string.format("", Franchise.display(game))) returnHeader = string.format("%s__HIDDENCAT__ __EXPECTUNUSEDCATEGORY__\nThe following articles pertaining to %s have been requested to have more files added to them. Articles in this category have been marked with the  template; these articles have been marked as needing more files throughout the article content and/or the gallery section. This category is hidden in the mainspace.\n\nSee also:\n*Category:%s articles lacking files contains %s articles that are lacking files in the infobox.\n\n", displaytitle, Franchise.link(game), game, Franchise.shortName(game), Franchise.shortName(game), Franchise.shortName(game)) end else --Activates when someone enters an invalid value for "game" utilsError.warn(string.format("\"%s\" is not a valid media code, see here for all accepted values. If this is a mistake, please contact a staff member on the Discord server.", game)) end return returnHeader end

return p