Module:data/magic words

From Linguifex
Jump to navigation Jump to search

Documentation for this module may be created at Module:data/magic words/doc

local next = next

local date_and_time = "mw:Help:Magic words#Date and time"
local formatting = "mw:Help:Magic words#Formatting"
local labeled_section_transclusion = "mw:Extension:Labeled Section Transclusion"
local liquidthreads = "mw:Extension:LiquidThreads"
local localization = "mw:Help:Magic words#Localization"
local miscellaneous = "mw:Help:Magic words#Miscellaneous"
local namespaces = "mw:Help:Magic words#Namespaces"
local namespaces_2 = "mw:Help:Magic words#Namespaces 2"
local noexternallanglinks = "mw:Wikibase/Installation/Advanced configuration#noexternallanglinks"
local other = "mw:Help:Magic words#Other"
local page_names = "mw:Help:Magic words#Page names"
local parser_functions_ext = "mw:Help:Extension:ParserFunctions##" -- ## is not a typo
local statistics = "mw:Help:Magic words#Statistics"
local substitution = "mw:Manual:Substitution"
local technical_metadata = "mw:Help:Magic words#Technical metadata"
local technical_metadata_of_another_page = "mw:Help:Magic words#Technical metadata of another page"
local transclusion_modifiers = "mw:Help:Magic words#Transclusion modifiers"
local url_data = "mw:Help:Magic words#URL data"

local data = {}

for k, v in next, {
	["!"] = {
		parser_variable = other,
		case_sensitive = false
	},
	
	["#BABEL"] = {
		parser_function = "mw:Extension:Babel#Usage",
		case_sensitive = false
	},
	
	["#CATEGORYTREE"] = {
		parser_function = "mw:Extension:CategoryTree#The {{#categorytree}} parser function",
		case_sensitive = false
	},
	
	["#COMMASEPARATEDLIST"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["#EXPR"] = {
		parser_function = parser_functions_ext .. "expr",
		case_sensitive = false
	},
	
	["#FORMATDATE"] = {
		aliases = {"#DATEFORMAT"},
		parser_function = formatting,
		case_sensitive = false
	},
	
	["#IF"] = {
		parser_function = parser_functions_ext .. "if",
		case_sensitive = false
	},
	
	["#IFEQ"] = {
		parser_function = parser_functions_ext .. "ifeq",
		case_sensitive = false
	},
	
	["#IFERROR"] = {
		parser_function = parser_functions_ext .. "iferror",
		case_sensitive = false
	},
	
	["#IFEXIST"] = {
		parser_function = parser_functions_ext .. "ifexist",
		case_sensitive = false
	},
	
	["#IFEXPR"] = {
		parser_function = parser_functions_ext .. "ifexpr",
		case_sensitive = false
	},
	
	["#INVOKE"] = {
		parser_function = "mw:Extension:Scribunto#Usage",
		case_sensitive = false
	},
	
	["#LANGUAGE"] = {
		parser_function = miscellaneous,
		case_sensitive = false
	},
	
	["#LQTPAGELIMIT"] = {
		parser_function = liquidthreads,
		case_sensitive = false
	},
	
	["#LST"] = {
		aliases = {"#SECTION"},
		parser_function = labeled_section_transclusion,
		case_sensitive = false
	},
	
	["#LSTH"] = {
		aliases = {"#SECTION-H"},
		parser_function = labeled_section_transclusion,
		case_sensitive = false
	},
	
	["#LSTX"] = {
		aliases = {"#SECTION-X"},
		parser_function = labeled_section_transclusion,
		case_sensitive = false
	},
	
	["#PROPERTY"] = {
		parser_function = "m:Wikidata/Notes/Inclusion syntax",
		case_sensitive = false
	},
	
	["#REL2ABS"] = {
		parser_function = parser_functions_ext .. "rel2abs",
		case_sensitive = false
	},
	
	["#SPECIAL"] = {
		parser_function = miscellaneous,
		case_sensitive = false
	},
	
	["#SPECIALE"] = {
		parser_function = miscellaneous,
		case_sensitive = false
	},
	
	["#STATEMENTS"] = {
		parser_function = "d:WD:How to use data on Wikimedia projects#Parser function",
		case_sensitive = false
	},
	
	["#SWITCH"] = {
		parser_function = parser_functions_ext .. "switch",
		case_sensitive = false
	},
	
	["#TAG"] = {
		parser_function = miscellaneous,
		case_sensitive = false
	},
	
	["#TARGET"] = {
		parser_function = "mw:Extension:MassMessage#Parser function delivery lists",
		case_sensitive = false
	},
	
	["#TIME"] = {
		parser_function = parser_functions_ext .. "time",
		case_sensitive = false
	},
	
	["#TIMEL"] = {
		parser_function = parser_functions_ext .. "timel",
		case_sensitive = false
	},
	
	["#TITLEPARTS"] = {
		parser_function = parser_functions_ext .. "titleparts",
		case_sensitive = false
	},
	
	["#USELIQUIDTHREADS"] = {
		parser_function = liquidthreads,
		case_sensitive = false
	},
	
	["="] = {
		parser_variable = other,
		case_sensitive = false
	},
	
	["ANCHORENCODE"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["ARTICLEPATH"] = {
		parser_variable = technical_metadata,
		case_sensitive = false
	},
	
	["BASEPAGENAME"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["BASEPAGENAMEE"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["BIDI"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["CANONICALURL"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["CANONICALURLE"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["CASCADINGSOURCES"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["CONTENTLANGUAGE"] = {
		aliases = {"CONTENTLANG"},
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["CURRENTDAY"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTDAY2"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTDAYNAME"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTDOW"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTHOUR"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTMONTH"] = {
		aliases = {"CURRENTMONTH2"},
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTMONTH1"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTMONTHABBREV"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTMONTHNAME"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTMONTHNAMEGEN"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTTIME"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTTIMESTAMP"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTVERSION"] = {
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["CURRENTWEEK"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["CURRENTYEAR"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["DEFAULTSORT"] = {
		aliases = {"DEFAULTCATEGORYSORT", "DEFAULTSORTKEY"},
		parser_function = technical_metadata,
		case_sensitive = true
	},
	
	["DIRECTIONMARK"] = {
		aliases = {"DIRMARK"},
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["DISPLAYTITLE"] = {
		parser_function = technical_metadata,
		case_sensitive = true
	},
	
	["FILEPATH"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["FORMATNUM"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["FULLPAGENAME"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["FULLPAGENAMEE"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["FULLURL"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["FULLURLE"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["GENDER"] = {
		parser_function = localization,
		case_sensitive = false
	},
	
	["GRAMMAR"] = {
		parser_function = localization,
		case_sensitive = false
	},
	
	["INT"] = {
		parser_function = localization,
		case_sensitive = false
	},
	
	["LC"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["LCFIRST"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["LOCALDAY"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALDAY2"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALDAYNAME"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALDOW"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALHOUR"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALMONTH"] = {
		aliases = {"LOCALMONTH2"},
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALMONTH1"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALMONTHABBREV"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALMONTHNAME"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALMONTHNAMEGEN"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALTIME"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALTIMESTAMP"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALURL"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["LOCALURLE"] = {
		parser_function = url_data,
		case_sensitive = false
	},
	
	["LOCALWEEK"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["LOCALYEAR"] = {
		parser_variable = date_and_time,
		case_sensitive = true
	},
	
	["MSG"] = {
		transclusion_modifier = transclusion_modifiers,
		priority = 2,
		case_sensitive = false
	},
	
	["MSGNW"] = {
		transclusion_modifier = transclusion_modifiers,
		priority = 2,
		case_sensitive = false
	},
	
	["NAMESPACE"] = {
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["NAMESPACEE"] = {
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["NAMESPACENUMBER"] = {
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["NOEXTERNALLANGLINKS"] = {
		parser_function = noexternallanglinks,
		parser_variable = noexternallanglinks,
		case_sensitive = false
	},
	
	["NS"] = {
		parser_function = namespaces_2,
		case_sensitive = false
	},
	
	["NSE"] = {
		parser_function = namespaces_2,
		case_sensitive = false
	},
	
	["NUMBERINGROUP"] = {
		aliases = {"NUMINGROUP"},
		parser_function = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFACTIVEUSERS"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFADMINS"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFARTICLES"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFEDITS"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFFILES"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFPAGES"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["NUMBEROFUSERS"] = {
		parser_function = statistics,
		parser_variable = statistics,
		case_sensitive = true
	},
	
	["PADLEFT"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["PADRIGHT"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["PAGEID"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = false
	},
	
	["PAGELANGUAGE"] = {
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["PAGENAME"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["PAGENAMEE"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["PAGESINCATEGORY"] = {
		aliases = {"PAGESINCAT"},
		parser_function = statistics,
		case_sensitive = true
	},
	
	["PAGESIZE"] = {
		parser_function = technical_metadata_of_another_page,
		case_sensitive = true
	},
	
	["PLURAL"] = {
		parser_function = localization,
		case_sensitive = false
	},
	
	["PROTECTIONEXPIRY"] = {
		parser_function = {
			[0] = technical_metadata,
			[1] = technical_metadata_of_another_page
		},
		case_sensitive = true
	},
	
	["PROTECTIONLEVEL"] = {
		parser_function = {
			[0] = technical_metadata,
			[1] = technical_metadata_of_another_page
		},
		case_sensitive = true
	},
	
	["RAW"] = {
		transclusion_modifier = transclusion_modifiers,
		priority = 3,
		case_sensitive = false
	},
	
	["REVISIONDAY"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONDAY2"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONID"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONMONTH"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONMONTH1"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONSIZE"] = {
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONTIMESTAMP"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONUSER"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["REVISIONYEAR"] = {
		parser_function = technical_metadata_of_another_page,
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["ROOTPAGENAME"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["ROOTPAGENAMEE"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["SAFESUBST"] = {
		transclusion_modifier = substitution,
		priority = 1,
		case_sensitive = false
	},
	
	["SCRIPTPATH"] = {
		parser_variable = technical_metadata,
		case_sensitive = false
	},
	
	["SERVER"] = {
		parser_variable = technical_metadata,
		case_sensitive = false
	},
	
	["SERVERNAME"] = {
		parser_variable = technical_metadata,
		case_sensitive = false
	},
	
	["SITENAME"] = {
		parser_variable = technical_metadata,
		case_sensitive = true
	},
	
	["STYLEPATH"] = {
		parser_variable = technical_metadata,
		case_sensitive = false
	},
	
	["SUBJECTPAGENAME"] = {
		aliases = {"ARTICLEPAGENAME"},
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["SUBJECTPAGENAMEE"] = {
		aliases = {"ARTICLEPAGENAMEE"},
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["SUBJECTSPACE"] = {
		aliases = {"ARTICLESPACE"},
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["SUBJECTSPACEE"] = {
		aliases = {"ARTICLESPACEE"},
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["SUBPAGENAME"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["SUBPAGENAMEE"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["SUBST"] = {
		transclusion_modifier = substitution,
		priority = 1,
		case_sensitive = false
	},
	
	["TALKPAGENAME"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["TALKPAGENAMEE"] = {
		parser_function = page_names,
		parser_variable = page_names,
		case_sensitive = true
	},
	
	["TALKSPACE"] = {
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["TALKSPACEE"] = {
		parser_function = namespaces,
		parser_variable = namespaces,
		case_sensitive = true
	},
	
	["UC"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["UCFIRST"] = {
		parser_function = formatting,
		case_sensitive = false
	},
	
	["URLENCODE"] = {
		parser_function = url_data,
		case_sensitive = false
	},
} do
	data[k] = v
	if not v.name then
		v.name = k
	end
	local aliases = v.aliases
	if aliases then
		for i = 1, #aliases do
			data[aliases[i]] = v
		end
		v.aliases = nil
	end
end

return data