Пређи на садржај

Модул:category tree/poscatboiler/data/wiktionary maintenance

Документацију овог модула можете да направите на страници Модул:category tree/poscatboiler/data/wiktionary maintenance/док

local raw_categories = {}
local raw_handlers = {}

-----------------------------------------------------------------------------
--                                                                         --
--                              RAW CATEGORIES                             --
--                                                                         --
-----------------------------------------------------------------------------

raw_categories["Викиречник одржавање"] = {
	description = "Categories containing pages that are being tracked for attention and improvement by editors.",
	breadcrumb = "Одржавање",
	parents = "Викиречник",
}

raw_categories["Pages using lite templates"] = {
	description = "Pages which use at least one of the lite templates.",
	additional = "See [[:Категорија:Lua-free templates]].",
	breadcrumb = "Using lite templates",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with tab characters"] = {
	description = "Pages which contain a tab character in their wikitext.",
	additional = "These should either be removed or replaced with spaces, because they go against [[WT:NORM]].",
	breadcrumb = "Tab characters",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with language headings in the wrong order"] = {
	description = "Pages in which the headings for each language's entry are in the wrong order.",
	additional = "Level 2 language headings should be in alphabetical order, except for Translingual and English, which go at the top (in that order).",
	breadcrumb = "Language headings in the wrong order",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with nonstandard language headings"] = {
	description = "Pages which contain a level 2 heading which does not match any language's canonical name.",
	additional = "The level 2 language heading for each language should always be that language's canonical name.",
	breadcrumb = "Nonstandard language headings",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with unwanted L1 headings"] = {
	description = "Pages which contain an unwanted level 1 heading.",
	additional = "Level 1 headings are not used in Wiktionary content pages, and only occur due to user error or vandalism.",
	breadcrumb = "Unwanted L1 headings",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with raw triple-brace template arguments"] = {
	description = "Pages which contain raw template arguments in the form of triple braces.",
	additional = "Triple-brace template arguments (e.g. {{code|<nowiki>{{{arg}}}</nowiki>}}) are intended for use in templates, as they are substituted with the relevant template argument when the page is transcluded. Although they can theoretically be used on any page, there are currently no legitimate uses for them in content namespaces.\n\nTemplate arguments usually occur due to typos, or when {{tl|subst:}} has been used with a template that isn't supposed to be substed.",
	breadcrumb = "Raw template arguments",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with DEFAULTSORT conflicts"] = {
	topright = "{{shortcut|CAT:DEFAULTSORT}}",
	description = "Pages on which the {{tl|DEFAULTSORT:}} magic word has been used multiple times with different values.",
	additional = "In some (but not all) cases, this causes a warning to display on the page. In the vast majority of instances, an explicit use of {{tl|DEFAULTSORT:}} in wikitext should be <u>removed</u>.This is because the {{tl|head}} template handles it automatically. The only instances where it should be used in wikitext is outside of entries (i.e. outside of mainspace or the Reconstruction namespace)." ..
		"\n\nSee also [[:Category:Pages with DISPLAYTITLE conflicts]].",
	breadcrumb = "DEFAULTSORT conflicts",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with DISPLAYTITLE conflicts"] = {
	topright = "{{shortcut|CAT:DISPLAYTITLE}}",
	description = "Pages on which the {{tl|DISPLAYTITLE:}} magic word has been used multiple times with different values.",
	additional = "In some (but not all) cases, this causes a warning to display on the page. In the vast majority of instances, an explicit use of {{tl|DISPLAYTITLE:}} in wikitext should be <u>removed</u>.This is because the {{tl|head}} template handles it automatically. The only instances where it should be used in wikitext is outside of entries (i.e. outside of maiespace)." ..
		"\n\nSee also [[:Категорија:Pages with DEFAULTSORT conflicts]].",
	breadcrumb = "DISPLAYTITLE conflicts",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with raw sortkeys"] = {
	description = "Pages on which a sortkey has been used with a raw category.",
	additional = "For example, {{code|<nowiki>[[Category:IPA symbols|B]]</nowiki>}}." ..
	"\n\nThese are a priority to replace with category templates, since they are hard-coded and override the {{tl|DEFAULTSORT:}} value for the page. This causes problems if there are any changes to the sorting scheme for the category, because there is no way of changing them centrally.\n\n" ..
	"By comparison, raw categories which have no sortkey are less of a problem, because they will use the {{tl|DEFAULTSORT:}} value; this can be centrally controlled and is designed to be language-neutral, so avoids the issue of different editors using multiple different sorting schemes for the same category. However, they should still be replaced with category templates, since there may be additional language-specific sorting rules which cannot otherwise be applied.",
	breadcrumb = "Raw sortkeys",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Стране са модул грешкама"] = {
	topright = "{{shortcut|CAT:E|CAT:ERR|CAT:ERROR}}",
	description = "Pages that have errors in a [[Wiktionary:Scribunto|Lua]] module.",
	additional = "If entries are listed here for more than a day or two, the error should probably be reported at [[Wiktionary:GP|the Grease Pit]]. Memory errors are a common source of these errors; see the discussion at [[Wiktionary:Lua memory errors]]." ..
		"\n\nBecause the software does not immediately update pages when a change occurs in a template or module, errors listed here may have already been fixed. Therefore, please ensure that the error is still present before reporting problems. You can do this by performing a \"[[meta:Help:Dummy_edit#Null_edit|null edit]]\" (editing the page and saving without making changes). If the error goes away then, it has already been fixed." ..
		"\n\n<u>You can use [https://sr.wiktionary.org/wiki/Special:ApiSandbox#action=purge&format=json&forcelinkupdate=1&generator=categorymembers&utf8=1&formatversion=2&gcmtitle=Category%3APages%20with%20module%20errors&gcmlimit=20 this link] and press \"Make request\" to purge the cache of up to 20 pages from this category in one click.</u> This number can be adjusted up to 5,000, but anything above 30-100 will likely cause time-outs (depending on the size of the pages)." ..
		"\n\nThe contents of this category is controlled by [[Template:maintenance category]]. It is currently set to place talk pages, user pages{{,}} and user sandbox modules and templates in a separate category." ..
		"\n\nSee also [[:Category:Pages with ParserFunction errors]].",
	breadcrumb = "Модули са грешком",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages with ParserFunction errors"] = {
	topright = "{{shortcut|CAT:PFE}}",
	description = "Pages that have errors in a [[mw:Help:Extension:ParserFunctions|ParserFunction]] magic word.",
	additional = "Examples of these magic words are {{tl|#expr:}} and {{tl|#time:}}. If entries are listed here for more than a day or two, the error should probably be reported at [[Wiktionary:GP|the Grease Pit]]." ..
		"\n\nBecause the software does not immediately update pages when a change occurs in a template or module, errors listed here may have already been fixed. Therefore, please ensure that the error is still present before reporting problems. You can do this by performing a \"[[meta:Help:Dummy_edit#Null_edit|null edit]]\" (editing the page and saving without making changes). If the error goes away then, it has already been fixed." ..
		"\n\n<u>You can use [https://sr.wiktionary.org/wiki/Special:ApiSandbox#action=purge&format=json&forcelinkupdate=1&generator=categorymembers&utf8=1&formatversion=2&gcmtitle=Category%3APages%20with%20ParserFunction%20errors&gcmlimit=20 this link] and press \"Make request\" to purge the cache of up to 20 pages from this category in one click.</u> This number can be adjusted up to 5,000, but anything above 30-100 will likely cause time-outs (depending on the size of the pages)." ..
		"\n\nThe contents of this category is controlled by [[Template:maintenance category]]. It is currently set to place talk pages, user pages{{,}} and user sandbox modules and templates in a separate category." ..
		"\n\nSee also [[:Категорија:Странице са грешкама у скрипти]].",
	breadcrumb = "ParserFunction errors",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Requests for moves, mergers and splits"] = {
	description = "Pages and categories which have been tagged with a request for them to be moved, merged or split.",
	breadcrumb = "Moves, mergers and splits",
	parents = {"Викиречник одржавање", "Захтеви"},
	can_be_empty = true,
	hidden = true,
}

raw_categories["Pages to be merged"] = {
	description = "Pages tagged to be merged by the {{tl|merge}} template.",
	parents = {"Requests for moves, mergers and splits"},
	can_be_empty = true,
}

raw_categories["Pages to be moved"] = {
	description = "Pages tagged to be moved by the {{tl|move}} template.",
	parents = {"Requests for moves, mergers and splits"},
	can_be_empty = true,
}

raw_categories["Pages to be split"] = {
	description = "Pages tagged to be split by the {{tl|split}} template.",
	parents = {"Requests for moves, mergers and splits"},
	can_be_empty = true,
}

raw_categories["Странице које користе лоше параметре приликом позивања шаблона"] = {
	description = "Pages that use unrecognized parameters when calling a template.",
	breadcrumb = "Bad template params",
	parents = {"Викиречник одржавање"},
	can_be_empty = true,
}

table.insert(raw_handlers, function(data)
	local template_type = data.category:match("^Странице које користе лоше параметре приликом позивања (.+) шаблона$")
	if template_type then
		local parents = {{
			name = "Странице које користе лоше параметре приликом позивања шаблона",
			sort = template_type == "general use" and "*" or template_type,
		}}
		local lang = require("Модул:languages").getByCanonicalName(template_type, nil, true)
		if lang then
			table.insert(parents, {name = "приступ сервисирању", is_label = true, lang = lang:getCode()})
		end
		return {
			lang = lang and lang:getCode() or nil,
			description = "Pages that use unrecognized parameters when calling " .. template_type .. " templates.",
			parents = parents,
			breadcrumb = template_type,
		}
	end
end)

table.insert(raw_handlers, function(data)
	local template = data.category:match("^Странице које користе лоше параметре приликом позивања (.+)$")

	function get_template_language(template_name)
        -- convert "R:es:DRAE" and "RQ:es:DRAE" to "es-DRAE" for language matching
        template_name = template_name:gsub("^RQ?:", "")
        template_name = template_name:gsub(":", "-")

		-- Check if the template name starts with a hyphenated language code
		local lang
		possible_language_code = template_name:match("^([a-z][a-z][a-z]?-[a-z][a-z][a-z])-")
		if possible_language_code ~= nil then
			lang = require("Модул:languages").getByCode(possible_language_code)
		end

		-- Check if the template name starts with a two or three character language code
		if lang == nil then
			possible_language_code = template_name:match("^([a-z][a-z][a-z]?)-")
			if possible_language_code ~= nil then
				lang = require("Модул:languages").getByCode(possible_language_code)
			end
		end

 		return lang
	end


	if template then
        template_name_without_namespace = template:gsub("^Шаблон:", "")

		lang = get_template_language(template_name_without_namespace)

		local template_type
		if lang == nil then
			template_type = "general use"
		else
			template_type = lang:getCanonicalName()
		end

		return {
			lang = lang and lang:getCode() or nil,
			description = "Pages that use unrecognized parameters when calling [[" .. template .. "]].",
	        additional = "These template calls should be reviewed and the bad parameter should be corrected or removed.",
			breadcrumb = template,
			parents = {{
				name = "Странице које користе лоше параметре приликом позивања " .. template_type .. " шаблона",
				sort = template_name_without_namespace,
			}},
			can_be_empty = true,
			hidden = true,
		}
	end
end)

return {RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers}