Wiktionary
tnwiktionary
https://tn.wiktionary.org/wiki/Tsebe_ya_konokono
MediaWiki 1.39.0-wmf.21
case-sensitive
Media
Special
Talk
User
User talk
Wiktionary
Wiktionary talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
TimedText
TimedText talk
Module
Module talk
Gadget
Gadget talk
Gadget definition
Gadget definition talk
Setswana
0
2921
8243
8233
2022-07-21T16:12:04Z
Rebel Agent
2678
/* Setswana */Added content
wikitext
text/x-wiki
==Setswana==
* Setswana
* Setswana ke teme
===Sekai===
* Ke bua Setswana
* Setswana ke teme e e buiwang ko lefatsheng la [[Botswana]]
===Le buiwa jaana===
{{audio|en|en-uk-setswana.ogg|Lentswe}}
{{wikipedia}}
515ptqblljery4i0no408bl0chy8kke
8256
8243
2022-07-21T17:55:34Z
Rebel Agent
2678
/* Setswana */Added content
wikitext
text/x-wiki
==Setswana==
* Setswana
* Setswana ke teme
===Sekai===
* Ke bua Setswana
* Setswana ke teme e e buiwang ko lefatsheng la [[Botswana]]
===Le buiwa jaana===
{{audio|en|en-uk-setswana.ogg|Lentswe}}
{{wikipedia}}
==Sekgoa==
on42abrh2e7zz1ng96kak2uroq5i1e7
8257
8256
2022-07-21T17:56:13Z
Rebel Agent
2678
/* Setswana */Removed content
wikitext
text/x-wiki
==Setswana==
* Setswana
* Setswana ke teme
===Sekai===
* Ke bua Setswana
* Setswana ke teme e e buiwang ko lefatsheng la [[Botswana]]
===Le buiwa jaana===
{{audio|en|en-uk-setswana.ogg|Lentswe}}
==Sekgoa==
kn6rrwjb35hg4swgp3d4v0u14tcz4nz
8258
8257
2022-07-21T17:56:41Z
Rebel Agent
2678
/* Sekgoa */Added content
wikitext
text/x-wiki
==Setswana==
* Setswana
* Setswana ke teme
===Sekai===
* Ke bua Setswana
* Setswana ke teme e e buiwang ko lefatsheng la [[Botswana]]
===Le buiwa jaana===
{{audio|en|en-uk-setswana.ogg|Lentswe}}
==Sekgoa==
{{wikipedia}}
ae1h8trqumiil1yi6sxq3qherp2q7t0
8259
8258
2022-07-21T17:58:59Z
Rebel Agent
2678
/* Sekgoa */Added content
wikitext
text/x-wiki
==Setswana==
* Setswana
* Setswana ke teme
===Sekai===
* Ke bua Setswana
* Setswana ke teme e e buiwang ko lefatsheng la [[Botswana]]
===Le buiwa jaana===
{{audio|en|en-uk-setswana.ogg|Lentswe}}
==Sekgoa==
{{wikipedia}}
===Etymology===
Borrowed from {{bor|en|tn|Setswana}}.
===Pronunciation===
* {{a|UK}} {{IPA|en|/sɛtˈswɑːnə/}}
* {{a|US}} {{enPR|sĕt-swäʹnə}}, {{IPA|en|/sɛtˈswɑnə/}}
* {{rhymes|en|ɑːnə|s=3}}
* {{audio|en|en-uk-setswana.ogg|Audio (UK)}}
{{rfap|en|US|US}}
===Proper noun===
{{en-proper noun}}
# A language spoken widely in Southern Africa, mainly in [[Botswana]] and [[South Africa]] in the [[w:Northern Cape|Northern Cape]], the central and western [[w:Free State|Free State]] and in the [[w:North West (South African province)|North West province]], and also, to a lesser extent, in [[Namibia]], also known as [[Tswana]].
====Synonyms====
* {{l|en|Tswana}}
====Translations====
{{trans-see|Tswana}}
====See also====
* {{l|en|Sekgalagadi}}
* {{l|en|Shilozi}}
* {{ethnologue|code=tsn}}
====References====
September 2000 UNESCO. World Languages Survey Report - Prepared by the Department of Arts, Culture, Science and Technology (South Africa).
===Anagrams===
* {{anagrams|en|a=aaensstw|seawants}}
o891cmpezobml4959ddk8cg8bkawsjq
buka
0
2935
8242
2022-07-21T16:09:36Z
Rebel Agent
2678
Ke dirile tsebe
wikitext
text/x-wiki
== Setswana ==
* Buka
* Buka ke sedirisiwa se se dirisiwang go kwalelwa mafoko
'''bontsi''' ke “dibuka"
j8csach96ro74jq6ydhqacfz72prqyq
Module:interproject
828
2936
8244
2022-07-21T16:15:45Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local function track(page)
require("Module:debug/track")("interproject/" .. page)
return true
end
local function process_links(linkdata, prefix, name, wmlang, sc)
prefix = prefix .. ":" .. (wmlang:getCode() == "en" and "" or wmlang:getCode() .. ":")
local links = {}
local iplinks = {}
local m_links = require("Module:links")
local lang = wmlang:getWiktionaryLanguage()
local ipalt = name .. " " .. (wmlang:getCode() == "en" and "" or "<sup>" .. wmlang:getCode() .. "</sup>")
for i, link in ipairs(linkdata) do
link.lang = lang
link.sc = sc
link.term = prefix .. link.term
link.tr = "-"
table.insert(iplinks, "<span class=\"interProject\">[[" .. link.term .. "|" .. ipalt .. "]]</span>")
table.insert(links, m_links.full_link(link, "bold"))
end
return links, iplinks
end
function export.wikipedia_box(frame)
local params = {
[1] = {},
[2] = {},
["cat"] = {},
["category"] = {alias_of = "cat"},
["i"] = {type = "boolean"},
["lang"] = {default = "en"},
["mul"] = {},
["mullabel"] = {},
["mulcat"] = {},
["mulcatlabel"] = {},
["portal"] = {},
["sc"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
if args.mul or args.mullabel or args.mulcat or args.mulcatlabel then
track("wikipedia-box-mul")
end
local wmlang = require("Module:wikimedia languages").getByCodeWithFallback(args["lang"]) or error("The Wikimedia language code \"" .. args["lang"] .. "\" is not valid.")
local sc = args["sc"] and require("Module:scripts").getByCode(args["sc"], "sc") or nil
local linkdata = {}
if args["cat"] then
table.insert(linkdata, {term = "Category:" .. args["cat"], alt = args[1] or args["cat"]})
elseif args["portal"] then
table.insert(linkdata, {term = "Portal:" .. args["portal"], alt = args[1] or args["portal"]})
else
local term = args[1] or mw.title.getCurrentTitle().text
table.insert(linkdata, {term = term, alt = args[2] or term})
end
if args["mul"] or args["mulcat"] then
if args["mulcat"] then
table.insert(linkdata, {term = "Category:" .. args["mulcat"], alt = args["mulcatlabel"] or args["mulcat"]})
else
table.insert(linkdata, {term = args["mul"], alt = args["mullabel"] or args["mul"]})
end
end
local links, iplinks = process_links(linkdata, "w", "Wikipedia", wmlang, sc)
if frame.args["slim"] then
return
"<div class=\"sister-wikipedia sister-project noprint floatright\" style=\"border: solid #aaa 1px; font-size: 90%; background: #f9f9f9; width: 250px; padding: 4px; text-align: left;\">" ..
"<div style=\"float: left;\">[[File:Wikipedia-logo.png|14px|none| ]]</div>" ..
"<div style=\"margin-left: 15px;\">" ..
" " ..
table.concat(links, " and ") ..
" on " ..
(wmlang:getCode() == "en" and "" or wmlang:getCanonicalName() .. " ") ..
"Wikipedia" ..
"</div>" ..
"</div>"
else
local linktype
if args["cat"] then
linktype = "a category"
elseif args["mul"] then
linktype = "articles"
elseif args["mulcat"] then
linktype = "categories"
elseif args["portal"] then
linktype = "a portal"
else
linktype = "an article"
end
return
"<div class=\"sister-wikipedia sister-project noprint floatright\" style=\"border: 1px solid #aaa; font-size: 90%; background: #f9f9f9; width: 250px; padding: 4px; text-align: left;\">" ..
"<div style=\"float: left;\">[[File:Wikipedia-logo-v2.svg|44px|none|link=|alt=]]</div>" ..
"<div style=\"margin-left: 60px;\">" ..
wmlang:getCanonicalName() .. " [[Wikipedia]] has " .. linktype .. " on:" ..
"<div style=\"margin-left: 10px;\">" .. table.concat(links, " and ") .. "</div>" ..
"</div>" ..
table.concat(iplinks) .. ((args[1] == mw.title.getCurrentTitle().text and not args[2]) and "[[Category:wikipedia with redundant first parameter]]" or "") ..
"</div>"
end
end
function export.projectlink(frame, compat)
local m_params = require("Module:parameters")
local iparams = {
["prefix"] = {required = true},
["name"] = {required = true},
["image"] = {required = true},
["compat"] = {type = "boolean"},
}
iargs = m_params.process(frame.args, iparams)
compat = compat or iargs.compat
local lang_param = compat and "lang" or 1
local term_param = compat and 1 or 2
local alt_param = compat and 2 or 3
local params = {
[lang_param] = {},
[term_param] = {},
[alt_param] = {},
["i"] = {type = "boolean"},
["nodot"] = {},
["sc"] = {},
}
local args = m_params.process(frame:getParent().args, params)
local wmlang = args[lang_param] or "en"
wmlang = require("Module:wikimedia languages").getByCodeWithFallback(wmlang) or error("The Wikimedia language code \"" .. wmlang .. "\" is not valid.")
local sc = args["sc"] and require("Module:scripts").getByCode(args["sc"], "sc") or nil
local term = args[term_param] or mw.title.getCurrentTitle().text
local linkdata = {term = term, alt = args[alt_param] or term}
if args["i"] then
linkdata.alt = "''" .. linkdata.alt .. "''"
end
local links, iplinks = process_links({linkdata}, iargs["prefix"], iargs["name"], wmlang, sc)
return
"[[Image:" .. iargs["image"] .. "|15px|link=" .. linkdata.term .. "]] " ..
table.concat(links, " and ") ..
" on " ..
(wmlang:getCode() == "en" and "" or "the " .. wmlang:getCanonicalName() .. " ") ..
" " .. iargs["name"] .. (args["nodot"] and "" or ".") ..
table.concat(iplinks)
end
return export
iqfi2fi38bam1z1ski9ljdunohbs1v9
Module:parameters
828
2937
8245
2022-07-21T16:17:30Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
-- A helper function to escape magic characters in a string
-- Magic characters: ^$()%.[]*+-?
local plain = require("Module:string/pattern_escape")
-- A helper function that removes empty numeric indexes in a table,
-- so that the values are tightly packed like in a normal Lua table.
-- equivalent to require("Module:table").compressSparseArray
local function remove_holes(t)
local ret = {}
local index = 1
local highest = 0
for num, _ in pairs(t) do
if type(num) == "number" and num > 0 and num < math.huge and math.floor(num) == num then
highest = math.max(highest, num)
end
end
for i = 1, highest do
if t[i] then
ret[index] = t[i]
index = index + 1
end
end
return ret
end
function export.process(args, params, return_unknown)
local args_new = {}
-- Process parameters for specific properties
local required = {}
local patterns = {}
local names_with_equal_sign = {}
local list_from_index = nil
for name, param in pairs(params) do
if param.required then
if param.alias_of then
require("Module:debug/track")("parameters/required alias")
end
required[name] = true
end
if param.list then
local key = name
if type(name) == "string" then
key = string.gsub(name, "=", "")
end
if param.default ~= nil then
args_new[key] = {param.default, maxindex = 1}
else
args_new[key] = {maxindex = 0}
end
if type(param.list) == "string" then
-- If the list property is a string, then it represents the name
-- to be used as the prefix for list items. This is for use with lists
-- where the first item is a numbered parameter and the
-- subsequent ones are named, such as 1, pl2, pl3.
if string.find(param.list, "=") then
patterns["^" .. string.gsub(plain(param.list), "=", "(%%d+)") .. "$"] = name
else
patterns["^" .. plain(param.list) .. "(%d+)$"] = name
end
elseif type(name) == "number" then
-- If the name is a number, then all indexed parameters from
-- this number onwards go in the list.
list_from_index = name
else
if string.find(name, "=") then
patterns["^" .. string.gsub(plain(name), "=", "(%%d+)") .. "$"] = string.gsub(name, "=", "")
else
patterns["^" .. plain(name) .. "(%d+)$"] = name
end
end
if string.find(name, "=") then
-- DO NOT SIDE-EFFECT A TABLE WHILE ITERATING OVER IT.
-- Some elements may be skipped or processed twice if you do.
-- Instead, track the changes we want to make to `params`, and
-- do them after the iteration over `params` is done.
table.insert(names_with_equal_sign, name)
end
elseif param.default ~= nil then
args_new[name] = param.default
end
end
--Process required changes to `params`
for _, name in ipairs(names_with_equal_sign) do
require("Module:debug/track")("parameters/name with equals")
params[string.gsub(name, "=", "")] = params[name]
params[name] = nil
end
-- Process the arguments
local args_unknown = {}
for name, val in pairs(args) do
local index = nil
if type(name) == "number" then
if list_from_index ~= nil and name >= list_from_index then
index = name - list_from_index + 1
name = list_from_index
end
else
-- Does this argument name match a pattern?
for pattern, pname in pairs(patterns) do
index = mw.ustring.match(name, pattern)
-- It matches, so store the parameter name and the
-- numeric index extracted from the argument name.
if index then
index = tonumber(index)
name = pname
break
end
end
end
local param = params[name]
-- If a parameter without the trailing index was found, and
-- require_index is set on the param, set the param to nil to treat it
-- as if it isn't recognized.
if not index and param and param.require_index then
param = nil
end
-- If no index was found, use 1 as the default index.
-- This makes list parameters like g, g2, g3 put g at index 1.
index = index or 1
-- If the argument is not in the list of parameters, trigger an error.
-- return_unknown suppresses the error, and stores it in a separate list instead.
if not param then
if return_unknown then
args_unknown[name] = val
else
error("The parameter \"" .. name .. "\" is not used by this template.", 2)
end
else
-- Remove leading and trailing whitespace unless allow_whitespace is true.
if not param.allow_whitespace then
val = mw.text.trim(val)
end
-- Empty string is equivalent to nil unless allow_empty is true.
if val == "" and not param.allow_empty then
val = nil
end
-- Convert to proper type if necessary.
if param.type == "boolean" then
val = not (not val or val == "" or val == "0" or val == "no" or val == "n" or val == "false")
elseif param.type == "number" then
val = tonumber(val)
elseif param.type then
require("Module:debug/track") {
"parameters/unrecognized type",
"parameters/unrecognized type/" .. tostring(param.type)
}
end
-- Can't use "if val" alone, because val may be a boolean false.
if val ~= nil then
-- Mark it as no longer required, as it is present.
required[param.alias_of or name] = nil
-- Store the argument value.
if param.list then
-- If the parameter is an alias of another, store it as the original,
-- but avoid overwriting it; the original takes precedence.
if not param.alias_of then
args_new[name][index] = val
-- Store the highest index we find.
args_new[name].maxindex = math.max(index, args_new[name].maxindex)
elseif args[param.alias_of] == nil then
if params[param.alias_of] and params[param.alias_of].list then
args_new[param.alias_of][index] = val
-- Store the highest index we find.
args_new[param.alias_of].maxindex = math.max(index, args_new[param.alias_of].maxindex)
else
args_new[param.alias_of] = val
end
end
else
-- If the parameter is an alias of another, store it as the original,
-- but avoid overwriting it; the original takes precedence.
if not param.alias_of then
args_new[name] = val
elseif args[param.alias_of] == nil then
if params[param.alias_of] and params[param.alias_of].list then
args_new[param.alias_of][1] = val
-- Store the highest index we find.
args_new[param.alias_of].maxindex = math.max(1, args_new[param.alias_of].maxindex)
else
args_new[param.alias_of] = val
end
end
end
end
end
end
-- The required table should now be empty.
-- If any entry remains, trigger an error, unless we're in the template namespace.
if mw.title.getCurrentTitle().nsText ~= "Template" then
local list = {}
for name, param in pairs(required) do
table.insert(list, name)
end
local count = #list
if count == 1 then
error('The parameter "' .. list[1] .. '" is required.', 2)
elseif count == 2 then
error('The parameters "' .. table.concat(list, '" and "') .. '" are required.', 2)
elseif count > 2 then
error('The parameters "' .. mw.text.listToText(list, '", "', '", and "') .. '" are required.', 2)
end
end
-- Remove holes in any list parameters if needed.
for name, val in pairs(args_new) do
if type(val) == "table" and not params[name].allow_holes then
args_new[name] = remove_holes(val)
end
end
if return_unknown then
return args_new, args_unknown
else
return args_new
end
end
return export
0nt3o8rxqgvpf7q9r5ol60nr1atmz12
Module:string/pattern escape
828
2938
8246
2022-07-21T16:24:41Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
return function (str)
return mw.ustring.gsub(str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1")
end
b97lzgihya1ilvmrqr6a3ng2jjomdnw
Module:wikimedia languages
828
2939
8247
2022-07-21T16:29:00Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local WikimediaLanguage = {}
function WikimediaLanguage:getCode()
return self._code
end
function WikimediaLanguage:getCanonicalName()
return self._rawData.canonicalName
end
--function WikimediaLanguage:getAllNames()
-- return self._rawData.names
--end
function WikimediaLanguage:getType()
return "Wikimedia"
end
function WikimediaLanguage:getWiktionaryLanguage()
if not self._wiktionaryLanguageObject then
self._wiktionaryLanguageObject = require("Module:languages").getByCode(self._rawData.wiktionary_code)
end
return self._wiktionaryLanguageObject
end
-- Do NOT use this method!
-- All uses should be pre-approved on the talk page!
function WikimediaLanguage:getRawData()
return self._rawData
end
WikimediaLanguage.__index = WikimediaLanguage
function export.getByCode(code)
-- Only accept codes the software recognises
if not mw.language.isKnownLanguageTag(code) then
return nil
end
local rawData = mw.loadData("Module:wikimedia languages/data")[code]
-- If there is no specific Wikimedia code, then "borrow" the information
-- from the general Wiktionary language code
if not rawData then
local lang = require("Module:languages").getByCode(code)
if not lang then
return nil
end
rawData = {canonicalName = lang:getCanonicalName(), wiktionary_code = code}
elseif not rawData.canonicalName then
rawData = {canonicalName = require("Module:languages").getByCode(rawData.wiktionary_code):getCanonicalName(), wiktionary_code = rawData.wiktionary_code}
end
return setmetatable({ _rawData = rawData, _code = code }, WikimediaLanguage)
end
function export.getByCodeWithFallback(code)
local object = export.getByCode(code)
if object then
return object
end
local lang = require("Module:languages").getByCode(code)
if not lang then
return nil
end
return lang:getWikimediaLanguages()[1]
end
return export
8aqgh0h89a1ndi0gs8h7gojtvnwa8lb
Module:wikimedia languages/data
828
2940
8248
2022-07-21T16:44:19Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local m = {}
m["als"] = {
wiktionary_code = "gsw",
}
m["bat-smg"] = {
wiktionary_code = "sgs",
}
m["bs"] = {
canonicalName = "Bosnian",
wiktionary_code = "sh",
}
m["bxr"] = {
wiktionary_code = "bua",
}
m["diq"] = {
wiktionary_code = "zza",
}
m["eml"] = {
canonicalName = "Emiliano-Romagnolo",
wiktionary_code = "egl",
}
m["fiu-vro"] = {
wiktionary_code = "vro",
}
m["hr"] = {
canonicalName = "Croatian",
wiktionary_code = "sh",
}
m["ksh"] = {
wiktionary_code = "gmw-cfr",
}
m["ku"] = {
canonicalName = "Kurdish",
wiktionary_code = "kmr",
}
m["kv"] = {
canonicalName = "Komi",
wiktionary_code = "kpv",
}
m["mhr"] = {
wiktionary_code = "chm",
}
m["nrm"] = {
wiktionary_code = "nrf",
}
m["roa-rup"] = {
wiktionary_code = "rup",
}
m["roa-tara"] = {
wiktionary_code = "roa-tar",
}
m["simple"] = {
canonicalName = "Simple English",
wiktionary_code = "en",
}
m["sr"] = {
canonicalName = "Serbian",
wiktionary_code = "sh",
}
m["zh-classical"] = {
wiktionary_code = "ltc",
}
m["zh-min-nan"] = {
wiktionary_code = "nan",
}
m["zh-yue"] = {
wiktionary_code = "yue",
}
return m
9iotoc6wxyrnnh9zao3h6hxl2p4qe6j
Module:links
828
2941
8249
2022-07-21T16:47:28Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
--[=[
[[Unsupported titles]], pages with high memory usage,
extraction modules and part-of-speech names are listed
at [[Module:links/data]].
Other modules used:
[[Module:script utilities]]
[[Module:scripts]]
[[Module:languages]] and its submodules
[[Module:gender and number]]
[[Module:debug]]
]=]
-- These are prefixed with u to avoid confusion with the default string methods
-- of the same name.
local usub = mw.ustring.sub
local table_insert = table.insert
local table_concat = table.concat
local ignore_cap
local phonetic_extraction
local pos_tags
local unsupported_titles
function export.getLinkPage(target, lang)
unsupported_titles = unsupported_titles or mw.loadData("Module:links/data").unsupported_titles
if unsupported_titles[target] then
return "Unsupported titles/" .. unsupported_titles[target]
end
-- If the link contains unexpanded template parameters, then don't create a link.
if target:find("{{{") then
return nil
end
if target:sub(1, 1) == ":" or target:sub(1, 2) == "w:" or target:sub(1, 10) == "wikipedia:" then
return target
end
-- Remove diacritics from the page name
target = lang:makeEntryName(target)
if target:sub(1, 1) == "/" then
return ":" .. target
-- Link to appendix for reconstructed terms and terms in appendix-only languages
elseif target:sub(1, 1) == "*" and #target > 1 then
if lang:getCode() == "und" then
return nil
end
target = "Reconstruction:" .. lang:getCanonicalName() .. "/" .. usub(target, 2)
elseif lang:getType() == "reconstructed" then
error("The specified language " .. lang:getCanonicalName()
.. " is unattested, while the given word is not marked with '*' to indicate that it is reconstructed")
elseif lang:getType() == "appendix-constructed" then
target = "Appendix:" .. lang:getCanonicalName() .. "/" .. target
end
return target
end
-- Make a language-specific link from given link's parts
local function makeLangLink(link, lang, id, allow_self_link)
-- Temporary tracking code
local langCode = lang:getCode()
if langCode == "se" or langCode == "sia" or langCode:find("^sm[ajns]$")
or langCode:find("^sj[dektu]$") then
if link.display and link.display:find("'") then
require("Module:debug/track")("links/Sami apostrophe display")
elseif link.target and link.target:find("'") then
require("Module:debug/track")("links/Sami apostrophe target")
end
end
-- Find fragments (when link didn't come from parseLink).
-- Prevents {{l|en|word#Etymology 2|word}} from linking to [[word#Etymology 2#English]].
if link.fragment == nil then
-- Replace numeric character references with the corresponding character ( → '),
-- as they contain #, which causes the numeric character reference to be
-- misparsed (wa'a → waa → pagename wa&, fragment 29;a).
link.target = link.target:gsub("&#(%d+);",
function(number) return mw.ustring.char(tonumber(number)) end)
local first, second = link.target:match("^([^#]+)#(.+)$")
if first then
link.target, link.fragment = first, second
end
end
-- If there is no display form, then create a default one
if not link.display then
link.display = link.target
-- Strip the prefix from the displayed form
-- TODO: other interwiki links?
if link.display:sub(1, 1) == ":" and not mw.loadData("Module:links/data").unsupported_titles[link.display] then
link.display = link.display:sub(2) -- remove colon from beginning
else
local prefix = link.display:match("^([^:]+):")
local prefixes = {
w = true,
wikipedia = true,
}
if prefixes[prefix] then
link.display = link.display:sub(#prefix + 2) -- remove prefix plus colon
end
end
end
-- Process the target
link.target = export.getLinkPage(link.target, lang)
if not link.target then
return link.display
end
-- If the target is the same as the current page and there is no sense id
-- and linking to the same page hasn't been turned on, then return a "self-link"
-- like the software does.
if not (allow_self_link or id) and link.target:gsub("^:", "") == mw.title.getCurrentTitle().prefixedText then
return "<strong class=\"selflink\">" .. link.display .. "</strong>"
end
--[[
Add fragment
Do not add a section link to "Undetermined", as such sections do not exist and are invalid.
TabbedLanguages handles links without a section by linking to the "last visited" section,
but adding "Undetermined" would break that feature.
For localized prefixes that make syntax error, please use the format: ["xyz"] = true,
]]
local prefix = link.target:match("^:?([^:]+):")
local prefixes = {
w = true,
wikipedia = true,
Category = true,
}
if not prefixes[prefix] then
if link.fragment or link.target:find("#$") then
require("Module:debug/track") {
"links/fragment",
"links/fragment/" .. lang:getCode()
}
end
if not link.fragment and lang:getCode() ~= "und" then
if id then
link.fragment = require("Module:senseid").anchor(lang, id)
elseif not mw.ustring.find(link.target, "^Appendix:")
and not mw.ustring.find(link.target, "^Reconstruction:") then
link.fragment = lang:getCanonicalName()
end
end
-- This allows linking to pages like [[sms:a]] without it being treated weirdly.
link.target = link.target:gsub(":", ":")
end
return "[[" .. link.target .. (link.fragment and "#" .. link.fragment or "") .. "|" .. link.display .. "]]"
end
-- Split a link into its parts
local function parseLink(linktext)
local link = { target = linktext }
local first, second = link.target:match("^([^|]+)|(.+)$")
if first then
link.target = first
link.display = second
else
link.display = link.target
end
first, second = link.target:match("^(.+)#(.+)$")
if first then
link.target = first
link.fragment = second
else
-- So that makeLangLink does not look for a fragment again
link.fragment = false
end
return link
end
-- Creates a basic wikilink to the given term. If the text already contains
-- links, these are replaced with links to the correct section.
function export.language_link(data, allow_self_link)
if type(data) ~= "table" then
error("The first argument to the function language_link must be a table. See Module:links/documentation for more information.")
end
local text = data.term
ignore_cap = ignore_cap or mw.loadData("Module:links/data").ignore_cap
if ignore_cap[data.lang:getCode()] and text then
text = text:gsub("%^", "")
end
-- If the text begins with * and another character,
-- then act as if each link begins with *
local allReconstructed = false
if text:find("^*.") then
allReconstructed = true
end
-- Do we have embedded wikilinks?
if text:find("[[", nil, true) then
--[=[
[[Special:WhatLinksHere/Template:tracking/links/alt-ignored]]
[[Special:WhatLinksHere/Template:tracking/links/id-ignored]]
]=]
if data.alt then
require("Module:debug/track")("links/alt-ignored")
mw.log("(from Module:links)", "text with embedded wikilinks:", text,
"ignored alt:", data.alt, "lang:", data.lang:getCode())
end
if data.id then
require("Module:debug/track")("links/id-ignored")
mw.log("(from Module:links)", "text with embedded wikilinks:", text,
"ignored id:", data.id, "lang:", data.lang:getCode())
end
-- Begins and ends with a wikilink tag
if text:find("^%[%[(.+)%]%]$") then
-- There are no [ ] in between.
-- This makes the wikilink tag redundant.
if text:find("^%[%[[^%[%]]+%]%]$") then
require("Module:debug/track")("links/redundant wikilink")
else
local temp = text:gsub("^%[%[(.+)%]%]$", "%1")
temp = temp:gsub("%]%], %[%[", "|")
if not temp:find("[%[%]]") then
require("Module:debug/track")("links/list")
end
end
end
text = text:gsub("%[%[([^%]]+)%]%]",
function(linktext)
local link = parseLink(linktext)
if allReconstructed then
link.target = "*" .. link.target
end
return makeLangLink(link, data.lang, data.id, allow_self_link)
end)
-- Remove the extra * at the beginning if it's immediately followed
-- by a link whose display begins with * too
if allReconstructed then
text = text:gsub("^%*%[%[([^|%]]+)|%*", "[[%1|*")
end
else
-- There is no embedded wikilink, make a link using the parameters.
text = makeLangLink({ target = text, display = data.alt }, data.lang, data.id, allow_self_link)
end
return text
end
function export.mark(text, itemType, face, lang)
local tag = { "", "" }
if itemType == "gloss" then
tag = { '<span class="mention-gloss-double-quote">“</span><span class="mention-gloss">',
'</span><span class="mention-gloss-double-quote">”</span>' }
elseif itemType == "tr" then
if face == "term" then
tag = { '<span lang="' .. lang:getCode() .. '" class="tr mention-tr Latn">',
'</span>' }
else
tag = { '<span lang="' .. lang:getCode() .. '" class="tr Latn">', '</span>' }
end
elseif itemType == "ts" then
tag = { '<span class="ts mention-ts Latn">/', '/</span>' }
elseif itemType == "pos" then
tag = { '<span class="ann-pos">', '</span>' }
elseif itemType == "annotations" then
tag = { '<span class="mention-gloss-paren annotation-paren">(</span>',
'<span class="mention-gloss-paren annotation-paren">)</span>' }
end
if type(text) == "string" then
return tag[1] .. text .. tag[2]
else
return ""
end
end
-- Format the annotations (things following the linked term)
function export.format_link_annotations(data, face)
local output = {}
-- Interwiki link
if data.interwiki then
table_insert(output, data.interwiki)
end
-- Genders
if type(data.genders) ~= "table" then
data.genders = { data.genders }
end
if data.genders and #data.genders > 0 then
local m_gen = require("Module:gender and number")
table_insert(output, " " .. m_gen.format_list(data.genders, data.lang))
end
local annotations = {}
-- Transliteration and transcription
if data.tr or data.ts then
local kind
if face == "term" then
kind = face
else
kind = "default"
end
if data.tr and data.ts then
table_insert(annotations,
require("Module:script utilities").tag_translit(data.tr, data.lang, kind)
.. " " .. export.mark(data.ts, "ts"))
elseif data.ts then
table_insert(annotations, export.mark(data.ts, "ts"))
else
table_insert(annotations,
require("Module:script utilities").tag_translit(data.tr, data.lang, kind))
end
end
-- Gloss/translation
if data.gloss then
table_insert(annotations, export.mark(data.gloss, "gloss"))
end
-- Part of speech
if data.pos then
-- debug category for pos= containing transcriptions
if data.pos:find("/[^><]*/") then
data.pos = data.pos .. "[[Category:links likely containing transcriptions in pos]]"
end
pos_tags = pos_tags or mw.loadData("Module:links/data").pos_tags
table_insert(annotations, export.mark(pos_tags[data.pos] or data.pos, "pos"))
end
-- Literal/sum-of-parts meaning
if data.lit then
table_insert(annotations, "literally " .. export.mark(data.lit, "gloss"))
end
if #annotations > 0 then
table_insert(output, " " .. export.mark(table_concat(annotations, ", "), "annotations"))
end
return table_concat(output)
end
-- A version of {{l}} or {{m}} that can be called from other modules too
function export.full_link(data, face, allow_self_link, no_check_redundant_translit)
if type(data) ~= "table" then
error("The first argument to the function full_link must be a table. "
.. "See Module:links/documentation for more information.")
end
-- Create the link
local output = {}
local categories = {}
local link = ""
local annotations
phonetic_extraction = phonetic_extraction or mw.loadData("Module:links/data").phonetic_extraction
-- Is there any text to show?
if (data.term or data.alt) then
-- Try to detect the script if it was not provided
if not data.sc then
data.sc = require("Module:scripts").findBestScript(data.alt or data.term, data.lang)
else
-- Track uses of sc parameter
local best = require("Module:scripts").findBestScript(data.alt or data.term, data.lang)
require("Module:debug/track")("links/sc")
if data.sc:getCode() == best:getCode() then
require("Module:debug/track")("links/sc/redundant")
require("Module:debug/track")("links/sc/redundant/" .. data.sc:getCode())
else
require("Module:debug/track")("links/sc/needed")
require("Module:debug/track")("links/sc/needed/" .. data.sc:getCode())
end
end
local class = ""
local function encode_accel_param_chars(param)
local retval = param:gsub("%%", "."):gsub(" ", "_") -- discard second return v laue
return retval
end
local function encode_accel_param(prefix, param)
if not param then
return ""
end
if type(param) == "table" then
local filled_params = {}
-- There may be gaps in the sequence, especially for translit params.
local maxindex = 0
for k, v in pairs(param) do
if type(k) == "number" and k > maxindex then
maxindex = k
end
end
for i=1,maxindex do
filled_params[i] = param[i] or ""
end
-- [[Module:accel]] splits these up again.
param = table.concat(filled_params, "*~!")
end
-- This is decoded again by [[WT:ACCEL]].
return prefix .. encode_accel_param_chars(param)
end
if data.accel then
local form = data.accel.form and encode_accel_param_chars(data.accel.form) .. "-form-of" or ""
local gender = encode_accel_param("gender-", data.accel.gender)
local pos = encode_accel_param("pos-", data.accel.pos)
local translit = encode_accel_param("transliteration-",
data.accel.translit or (data.tr ~= "-" and data.tr or nil))
local target = encode_accel_param("target-", data.accel.target)
local lemma = encode_accel_param("origin-", data.accel.lemma)
local lemma_translit = encode_accel_param("origin_transliteration-", data.accel.lemma_translit)
local no_store = data.accel.no_store and "form-of-nostore" or ""
local accel =
form .. " " ..
gender .. " " ..
pos .. " " ..
translit .. " " ..
target .. " " ..
lemma .. " " ..
lemma_translit .. " " ..
no_store .. " "
class = "form-of lang-" .. data.lang:getCode() .. " " .. accel
end
-- Only make a link if the term has been given, otherwise just show the alt text without a link
link = require("Module:script utilities").tag_text(
data.term and export.language_link(data, allow_self_link)
or data.alt, data.lang, data.sc, face, class)
else
--[[ No term to show.
Is there at least a transliteration we can work from? ]]
link = require("Module:script utilities").request_script(data.lang, data.sc)
if link == "" or not data.tr or data.tr == "-" then
-- No link to show, and no transliteration either. Show a term request.
local category = ""
if mw.title.getCurrentTitle().nsText ~= "Template" then
table_insert(categories, "[[Category:" .. data.lang:getCanonicalName() .. " term requests]]")
end
link = "<small>[Term?]</small>"
end
end
table_insert(output, link)
if data.tr == "" or data.tr == "-" then
data.tr = nil
elseif phonetic_extraction[data.lang:getCode()] then
local m_phonetic = require(phonetic_extraction[data.lang:getCode()])
data.tr = data.tr or m_phonetic.getTranslit(export.remove_links(data.term))
elseif (data.term or data.alt) and not data.sc:getCode():find("Lati?n") then
-- Try to generate a transliteration, unless transliteration has been supplied and either
-- no_check_redundant_translit is given or we are in a high-memory entry. (Checking for redundant
-- transliteration can use up significant amounts of memory so we don't want to do it if memory
-- is tight. `no_check_redundant_translit` is currently set when called ultimately from
-- {{multitrans|...|no-check-redundant-translit=1}}.)
if not (data.tr and (
no_check_redundant_translit or
mw.loadData("Module:links/data").high_memory_entries[mw.title.getCurrentTitle().text]
)) then
local automated_tr = data.lang:transliterate(export.remove_links(data.alt or data.term), data.sc)
if automated_tr then
local manual_tr = data.tr
if manual_tr then
if manual_tr == automated_tr then
table_insert(categories,
"[[Category:Terms with redundant transliterations]]"
.. "[[Category:Terms with redundant transliterations/" .. data.lang:getCode() .. "]]")
else
-- Prevents Arabic root categories from flooding the tracking categories.
if mw.title.getCurrentTitle().nsText ~= "Category" then
table_insert(categories,
"[[Category:Terms with manual transliterations different from the automated ones]]"
.. "[[Category:Terms with manual transliterations different from the automated ones/" .. data.lang:getCode() .. "]]")
end
end
end
if (not manual_tr) or data.lang:overrideManualTranslit() then
data.tr = automated_tr
end
end
end
end
-- Link to the transliteration entry for languages that require this
if data.tr and data.lang:link_tr() then
data.tr = export.language_link { lang = data.lang, term = data.tr }
end
table_insert(output, export.format_link_annotations(data, face))
return table_concat(output) .. table_concat(categories)
end
--[[ Strips links: deletes category links,
the targets of piped links,
and all double square brackets. ]]
function export.remove_links(text)
if type(text) == "table" then
text = text.args[1]
end
if not text or text == "" then
return ""
end
text = mw.ustring.gsub(text, "%[%[Category:[^|%]]-|?[^|%]]-%]%]", "")
text = text:gsub("%[%[[^|%]]-|", "")
text = text:gsub("%[%[", "")
text = text:gsub("%]%]", "")
return text
end
function export.english_links(text)
local lang = require("Module:languages").getByCode("en")
-- Parentheses around function call to remove second return value, the
-- number of replacements.
return (text:gsub("%[%[([^%]]+)%]%]",
function(linktext)
local link = parseLink(linktext)
return makeLangLink(link, lang, nil, true, false)
end))
end
--[=[
This decodes old section encodings.
For example, Norwegian_Bokm.C3.A5l → Norwegian_Bokmål.
It isn't picky about whether the section encodings represent the UTF-8 encoding
of a real Unicode character, so it will mangle section names that contain
a period followed by two uppercase hex characters. At least such section names
are probably pretty rare.
Wiktionary adds an additional id="" attribute for sections
using a legacy encoding, if it is different from the modern minimally modified attribute.
It is like percent encoding (URI or URL encoding) except with "." instead of "%".
See [[mw:Manual:$wgFragmentMode]] and the code that does the encoding at
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/7bf779524ab1fd8e1d74f79ea4840564d48eea4d/includes/parser/Sanitizer.php#893
]=]
-- The character class %x should not be used, as it includes the characters a-f,
-- which do not occur in these anchor encodings.
local capitalHex = "[0-9A-F]"
local function decodeAnchor(anchor)
return (anchor:gsub("%.(" .. capitalHex .. capitalHex .. ")",
function(hexByte)
return string.char(tonumber(hexByte, 16))
end))
end
function export.section_link(link)
if type(link) ~= "string" then
error("The first argument to section_link was a " .. type(link) .. ", but it should be a string.")
end
link = link:gsub("_", " ")
local numberSigns = select(2, mw.ustring.gsub(link, "#", ""))
if numberSigns > 1 then
error("The section link should only contain one number sign (#).")
end
link = mw.uri.decode(link, "WIKI")
local page, section = link:match("^([^#]*)#(.+)$")
if page == "" then
page = nil
end
if section then
section = decodeAnchor(section)
-- URI-encode (percent-encode) section to allow square brackets and
-- other dodgy characters in section name.
-- If not percent-encoded, they prevent the parser from creating a link.
-- Decode percent-encoding in the displayed text
if page then
return "[[" .. page .. "#" .. mw.uri.encode(section, "WIKI")
.. "|" .. page .. " § " .. section .. "]]"
else
return "[[#" .. mw.uri.encode(section, "WIKI")
.. "|§ " .. section .. "]]"
end
else
error("The function “section_link” could not find a number sign marking a section name.")
end
end
return export
qlkvbve4fbcj7vwfswne2sccn4a95uq
Module:links/data
828
2942
8250
2022-07-21T16:49:47Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local data = {}
data.ignore_cap = {
["ko"] = true,
}
data.phonetic_extraction = {
["th"] = "Module:th",
["km"] = "Module:km",
}
data.pos_tags = {
["a"] = "adjective",
["adv"] = "adverb",
["int"] = "interjection",
["n"] = "noun",
["pron"] = "pronoun",
["v"] = "verb",
["vi"] = "intransitive verb",
["vt"] = "transitive verb",
["vti"] = "transitive and intransitive verb",
}
data.high_memory_entries = {
"a",
"animal",
"book",
"coffee",
"do",
"e",
"language",
"night",
"o",
"smoke",
"son",
"sun",
"water",
"wind",
}
local U = mw.ustring.char
local soft_hyphen = U(0xAD)
--[[ The "actual title" is the page name with the prefix "Unsupported titles/" removed.
["displayed_title"] = "actual title" ]]
data.unsupported_titles = {
[" "] = "Space",
["{"] = "Left curly bracket",
["}"] = "Right curly bracket",
["["] = "Left square bracket",
["]"] = "Right square bracket",
["<"] = "Less than",
[">"] = "Greater than",
["=<"] = "Equal less than",
["=>"] = "Equal greater than",
[">="] = "Greater than equal",
["<="] = "Less than equal",
["->"] = "Hyphen greater than",
["<-"] = "Less than hyphen",
[">_<"] = "Greater than low line less than",
["::"] = "Double colon",
[": :"] = "Enclosing colons",
[":/"] = "Colon slash",
[":="] = "Colon equals",
[":Þ"] = "Colon capital thorn",
[":þ"] = "Colon lowercase thorn",
[":("] = "Colon left paren",
[":)"] = "Colon right paren",
[":3"] = "Colon three",
["<>"] = "Less than greater than",
["<3"] = "Less than three",
["</3"] = "Less than slash three",
["< >"] = "Enclosing less than greater than",
["< />"] = "Less than trailing slash greater than",
["< > </ >"] = "HTML start tag end tag",
["<!-- -->"] = "HTML comment",
["<g>"] = "g tag",
[":-("] = "Colon hyphen left paren",
[":-)"] = "Colon hyphen right paren",
["|"] = "Vertical line",
["||"] = "Vertical line vertical line",
["| |"] = "Enclosing vertical lines",
["C#"] = "C sharp",
["#"] = "Number sign",
["# #"] = "Enclosing number signs",
["&"] = "Amp",
[":"] = "Colon",
[".."] = "Double period",
["."] = "Full stop",
["_"] = "Low line",
["-_-"] = "Low line interfix",
[U(0xFFFD)] = "Replacement character",
[U(0x1680)] = "Ogham space",
["[ ]"] = "Square brackets",
["{ }"] = "Curly brackets",
["[…]"] = "Square bracketed ellipsis",
["_ _"] = "Enclosing low lines",
["C|N>K"] = "C through N to K",
["#MeToo"] = "MeToo",
["о/."] = "о slash dot",
["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλ" .. soft_hyphen .. "επικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
[":≠"] = ":≠",
["S:t"] = "S:t",
["S:ta"] = "S:ta",
["c:a"] = "c:a",
["eq #"] = "eq number sign",
["hr #"] = "hr number sign",
["n:a"] = "n:a",
["n:o"] = "n:o",
["n:r"] = "n:r",
["s:a"] = "s:a",
["st:a"] = "st:a",
["v:a"] = "v:a",
}
for i, item in ipairs(data.high_memory_entries) do
data.high_memory_entries[i] = nil
data.high_memory_entries[item] = true
end
return data
g64o5nvanq972b581i1wf6a1ntbxmt4
Module:scripts
828
2943
8251
2022-07-21T16:52:46Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local Script = {}
function Script:getCode()
return self._code
end
function Script:getCanonicalName()
return self._rawData.canonicalName
end
function Script:getDisplayForm()
return self:getCategoryName("nocap")
end
function Script:getOtherNames(onlyOtherNames)
return require("Module:language-like").getOtherNames(self, onlyOtherNames)
end
function Script:getAliases()
return self._rawData.aliases or {}
end
function Script:getVarieties(flatten)
return require("Module:language-like").getVarieties(self, flatten)
end
function Script:getParent()
return self._rawData.parent
end
function Script:getSystems()
if not self._systemObjects then
local m_systems = require("Module:writing systems")
self._systemObjects = {}
for _, sys in ipairs(self._rawData.systems or {}) do
table.insert(self._systemObjects, m_systems.getByCode(sys))
end
end
return self._systemObjects
end
--function Script:getAllNames()
-- return self._rawData.names
--end
function Script:getType()
return "script"
end
function Script:getCategoryName(nocap)
local name = self._rawData.canonicalName
-- If the name already has "code" or "semaphore" in it, don't add it.
-- No names contain "script".
if not name:find("[Cc]ode$") and not name:find("[Ss]emaphore$") then
name = name .. " script"
end
if not nocap then
name = mw.getContentLanguage():ucfirst(name)
end
return name
end
function Script:makeCategoryLink()
return "[[:Category:" .. self:getCategoryName() .. "|" .. self:getDisplayForm() .. "]]"
end
function Script:getWikipediaArticle()
return self._rawData.wikipedia_article or self:getCategoryName()
end
function Script:getCharacters()
if self._rawData.characters then
return self._rawData.characters
else
return nil
end
end
function Script:countCharacters(text)
if not self._rawData.characters then
return 0
else
local _, num = mw.ustring.gsub(text, "[" .. self._rawData.characters .. "]", "")
return num
end
end
function Script:getDirection()
local direction = self._rawData.direction
if not direction then
return nil
else
return direction
end
end
function Script:getRawData()
return self._rawData
end
function Script:toJSON()
local ret = {
canonicalName = self:getCanonicalName(),
categoryName = self:getCategoryName("nocap"),
code = self._code,
otherNames = self:getOtherNames(true),
aliases = self:getAliases(),
varieties = self:getVarieties(),
type = self:getType(),
direction = self:getDirection(),
characters = self:getCharacters(),
parent = self:getParent(),
systems = self._rawData.systems or {},
wikipediaArticle = self._rawData.wikipedia_article,
}
return require("Module:JSON").toJSON(ret)
end
Script.__index = Script
function export.makeObject(code, data)
return data and setmetatable({ _rawData = data, _code = code }, Script) or nil
end
function export.getByCode(code, paramForError, disallowNil)
if code == nil and not disallowNil then
return nil
end
if code == "IPAchar" then
require("Module:debug/track")("IPAchar")
end
local retval = export.makeObject(code, mw.loadData("Module:scripts/data")[code])
if not retval and paramForError then
require("Module:languages").err(code, paramForError, "script code", nil, "not real lang")
end
return retval
end
function export.getByCanonicalName(name)
local code = mw.loadData("Module:scripts/by name")[name]
if not code then
return nil
end
return export.makeObject(code, mw.loadData("Module:scripts/data")[code])
end
-- Find the best script to use, based on the characters of a string.
-- If forceDetect is set, run the detection algorithm even if there's only one
-- possible script; in that case, if the text isn't in the script, the return
-- value will be None.
function export.findBestScript(text, lang, forceDetect)
if not text or not lang or not lang.getScripts then
return export.getByCode("None")
end
local scripts = lang:getScripts()
if not scripts[2] and not forceDetect then
return scripts[1]
end
return require("Module:scripts/findBestScript")(export, text, lang, scripts, forceDetect)
end
--[=[
Takes a codepoint or a character and finds the script code (if any) that is
appropriate for it based on the codepoint, using the data module
[[Module:scripts/recognition data]]. The data module was generated from the
patterns in [[Module:scripts/data]] using [[Module:User:Erutuon/script recognition]].
Converts the character to a codepoint. Returns a script code if the codepoint
is in the list of individual characters, or if it is in one of the defined
ranges in the 4096-character block that it belongs to, else returns "None".
]=]
function export.charToScript(char)
return require("Module:scripts/charToScript").charToScript(char)
end
function export.findBestScriptWithoutLang(text)
return require("Module:scripts/charToScript").findBestScriptWithoutLang(text)
end
return export
2hz8vrw8h1kwohcji8xdwyxty49ftzr
Module:scripts/data
828
2944
8252
2022-07-21T16:55:19Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
--[=[
When adding new scripts to this file, please don't forget to add
style definitons for the script in [[MediaWiki:Common.css]].
]=]
local u = mw.ustring.char
local m = {}
m["Adlm"] = {
canonicalName = "Adlam",
characters = "𞤀-𞥟",
direction = "rtl",
}
m["Afak"] = {
canonicalName = "Afaka",
}
m["Aghb"] = {
canonicalName = "Caucasian Albanian",
characters = "𐔰-𐕣𐕯",
}
m["Ahom"] = {
canonicalName = "Ahom",
characters = "𑜀-𑝆",
systems = {"abugida"},
}
m["Arab"] = {
canonicalName = "Arabic",
varieties = {"Jawi", {"Nastaliq", "Nastaleeq"}},
characters = "-ۿݐ-ݿࢠ-ࣿﭐ-﷽ﹰ-ﻼ",
direction = "rtl",
systems = {"abjad"}, -- more precisely, impure abjad
}
m["fa-Arab"] = {
canonicalName = "Arabic",
otherNames = {"Perso-Arabic"},
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["kk-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ks-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ku-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ms-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["mzn-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ota-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["pa-Arab"] = {
canonicalName = "Shahmukhi",
otherNames = {"Arabic"},
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ps-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["sd-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["tt-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ug-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["ur-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
m["xka-Arab"] = {
canonicalName = "Arabic",
characters = m["Arab"].characters,
direction = "rtl",
parent = "Arab",
}
-- Aran (Nastaliq) is subsumed into Arab
m["Armi"] = {
canonicalName = "Imperial Aramaic",
characters = "𐡀-𐡟",
direction = "rtl",
systems = {"abjad"},
}
m["Armn"] = {
canonicalName = "Armenian",
characters = "Ա-֏ﬓ-ﬗ",
}
m["Avst"] = {
canonicalName = "Avestan",
characters = "𐬀-𐬿",
direction = "rtl",
}
m["pal-Avst"] = {
canonicalName = "Pazend",
characters = m["Avst"].characters,
direction = "rtl",
parent = "Avst",
}
m["Bali"] = {
canonicalName = "Balinese",
characters = "ᬀ-᭼",
systems = {"abugida"},
}
m["Bamu"] = {
canonicalName = "Bamum",
characters = "ꚠ-꛷𖠀-𖨸",
}
m["Bass"] = {
canonicalName = "Bassa",
aliases = {"Bassa Vah", "Vah"},
characters = "𖫐-𖫵",
}
m["Batk"] = {
canonicalName = "Batak",
characters = "ᯀ-᯿",
systems = {"abugida"},
}
m["Beng"] = {
canonicalName = "Bengali",
characters = "ঀ-ঃঅ-ঌএঐও-নপ-রললশ-হ়-ৄেৈো-ৎৗড়ঢ়য়়ৠ-ৣ০-৯",
systems = {"abugida"},
}
m["as-Beng"] = {
canonicalName = "Assamese",
otherNames = {"Bengali-Assamese", "Eastern Nagari"},
characters = "ঁ-ঃঅ-ঌএঐও-নপ-যশ-হ়-ৄেৈো-ৎৗড়ঢ়য়়ৠ-ৣ০-ৱ",
systems = {"abugida"},
}
m["Bhks"] = {
canonicalName = "Bhaiksuki",
characters = "𑰀-𑱬",
systems = {"abugida"},
}
m["Bopo"] = {
canonicalName = "Zhuyin",
aliases = {"Zhuyin Fuhao", "Bopomofo"},
characters = "ㄅ-ㄯㆠ-ㆿ",
}
m["Brah"] = {
canonicalName = "Brahmi",
characters = "𑀀-𑁿",
systems = {"abugida"},
}
m["Brai"] = {
canonicalName = "Braille",
characters = "⠀-⣿",
}
m["Bugi"] = {
canonicalName = "Buginese",
aliases = {"Lontara"},
characters = "ᨀ-᨟",
systems = {"abugida"},
}
m["Buhd"] = {
canonicalName = "Buhid",
characters = "ᝀ-ᝓ",
systems = {"abugida"},
}
m["Cakm"] = {
canonicalName = "Chakma",
characters = "𑄀-𑅇",
systems = {"abugida"},
}
m["Cans"] = {
canonicalName = "Canadian syllabics",
characters = "᐀-ᙿᢰ-ᣵ",
systems = {"abugida"},
}
m["Cari"] = {
canonicalName = "Carian",
characters = "𐊠-𐋐",
systems = {"alphabet"},
}
m["Cham"] = {
canonicalName = "Cham",
characters = "ꨀ-꩟",
systems = {"abugida"},
}
m["Chrs"] = {
canonicalName = "Chorasmian",
characters = "𐾰-𐿋",
direction = "rtl",
systems = {"abjad"},
}
m["Cher"] = {
canonicalName = "Cherokee",
characters = "Ꭰ-ᏽꭰ-ꮿ",
systems = {"syllabary"},
}
m["Copt"] = {
canonicalName = "Coptic",
characters = "Ϣ-ϯⲀ-⳿𐋠-𐋻", -- this is mostly "Coptic", not unified "Greek and Coptic"
systems = {"alphabet"},
}
m["Cpmn"] = {
canonicalName = "Cypro-Minoan",
aliases = {"Cypro Minoan"},
characters = "𒾐-𒿲",
systems = {"syllabary"},
}
m["Cprt"] = {
canonicalName = "Cypriot",
characters = "𐠀-𐠿",
direction = "rtl",
systems = {"syllabary"},
}
m["Cyrl"] = {
canonicalName = "Cyrillic",
characters = "Ѐ-џѢѣѪѫѬѭѲѳѴѵҊ-ԧꚀ-ꚗ",
systems = {"alphabet"},
}
m["Cyrs"] = {
canonicalName = "Old Cyrillic",
aliases = {"Early Cyrillic"},
characters = "Ѐ-ԧꙀ-ꚗ",
wikipedia_article = "Early Cyrillic alphabet",
systems = {"alphabet"},
}
m["Deva"] = {
canonicalName = "Devanagari",
characters = "ऀ-ॿ꣠-ꣿ",
systems = {"abugida"},
}
m["Diak"] = {
canonicalName = "Dhives Akuru",
characters = "𑤀-𑥙",
systems = {"abugida"},
}
m["Dogr"] = {
canonicalName = "Dogra",
characters = "𑠀-𑠻",
systems = {"abugida"},
}
m["Dsrt"] = {
canonicalName = "Deseret",
characters = "𐐀-𐑏",
systems = {"alphabet"},
}
m["Dupl"] = {
canonicalName = "Duployan",
characters = "𛰀-𛲟",
}
m["Egyd"] = {
canonicalName = "Demotic",
systems = {"abjad", "logography"},
}
m["Egyh"] = {
canonicalName = "Hieratic",
systems = {"abjad", "logography"},
}
m["Egyp"] = {
canonicalName = "Egyptian hieroglyphic",
varieties = {"Hieratic"},
characters = "𓀀-𓐮"..u(0x13430).."-"..u(0x13438),
wikipedia_article = "Egyptian hieroglyphs",
systems = {"abjad", "logography"},
}
m["Elba"] = {
canonicalName = "Elbasan",
characters = "𐔀-𐔧",
systems = {"alphabet"},
}
m["Ethi"] = {
canonicalName = "Ethiopic",
aliases = {"Ge'ez"},
characters = "ሀ-᎙ⶀ-ⷞꬁ-ꬮ",
systems = {"abugida"},
}
m["Geok"] = {
canonicalName = "Khutsuri",
varieties = {"Nuskhuri", "Asomtavruli"},
characters = "Ⴀ-Ⴭⴀ-ⴭ", -- Ⴀ-Ⴭ is Asomtavruli, ⴀ-ⴭ is Nuskhuri
systems = {"alphabet"},
}
m["Geor"] = {
canonicalName = "Georgian",
varieties = {"Mkhedruli", "Mtavruli"},
characters = "ა-ჿᲐ-Ჿ", -- ა-ჿ is lowercase Mkhedruli; Ა-Ჿ is uppercase Mkhedruli (Mtavruli)
systems = {"alphabet"},
}
m["Glag"] = {
canonicalName = "Glagolitic",
characters = "Ⰰ-ⱞ𞀀-𞀪",
systems = {"alphabet"},
}
m["Gong"] = {
canonicalName = "Gunjala Gondi",
characters = "𑵠-𑶩",
systems = {"abugida"},
}
m["Gonm"] = {
canonicalName = "Masaram Gondi",
characters = "𑴀-𑵙",
systems = {"abugida"},
}
m["Goth"] = {
canonicalName = "Gothic",
characters = "𐌰-𐍊",
systems = {"alphabet"},
}
m["Gran"] = {
canonicalName = "Grantha",
characters = "𑌀-𑍴",
systems = {"abugida"},
}
m["Grek"] = {
canonicalName = "Greek",
characters = "Ͱ-ϡϰ-Ͽ",
systems = {"alphabet"},
}
m["polytonic"] = {
canonicalName = "Greek",
characters = "ἀ-῾" .. m["Grek"].characters,
parent = "Grek",
systems = {"alphabet"},
}
m["Gujr"] = {
canonicalName = "Gujarati",
characters = "ઁ-૿",
systems = {"abugida"},
}
m["Guru"] = {
canonicalName = "Gurmukhi",
characters = "ਁ-੶",
systems = {"abugida"},
}
m["Hang"] = {
canonicalName = "Hangul",
aliases = {"Hangeul"},
characters = (
"가-힣".. -- Syllables
"ᄀ-ᇿ".. -- Jamo
"ꥠ-ꥼ".. -- Jamo Ext-A
"ힰ-ퟻ".. -- Jamo Ext-B
"ㄱ-ㆎ".. -- Compat Jamo
"ᅠ-ᅵ" -- Halfwidth
),
systems = {"syllabary"},
}
m["Hani"] = {
canonicalName = "Han",
varieties = {"Hanzi", "Kanji", "Hanja", "Chu Nom"},
characters = (
"一-鿿"..
"㐀-䶿".. -- ExtA
"𠀀-".. -- SIP
"𰀀-".. -- ExtG
"﨎﨏﨑﨓﨔﨟﨡﨣﨤﨧﨨﨩"..
"⺀-".. -- Radicals Supplement
" -〿".. -- CJK Symbols and Punctuation
"𖿢𖿣𖿰𖿱".. -- Ideographic Symbols and Punctuation
"㇀-".. -- Strokes
"㍻-㍿㋿" -- 組文字
),
systems = {"logography"},
}
m["Hans"] = {
canonicalName = "Simplified Han",
characters = m["Hani"].characters,
systems = {"logography"},
}
m["Hant"] = {
canonicalName = "Traditional Han",
characters = m["Hani"].characters,
systems = {"logography"},
}
m["Hatr"] = {
canonicalName = "Hatran",
characters = "𐣠-𐣿",
direction = "rtl",
systems = {"abjad"},
}
m["Hira"] = {
canonicalName = "Hiragana",
varieties = {"Hentaigana"},
characters = "ぁ-ゟ𛀁-𛄞𛅐𛅑𛅒🈀",
systems = {"syllabary"},
}
m["Hluw"] = {
canonicalName = "Anatolian Hieroglyphs",
characters = "𔐀-𔙆",
wikipedia_article = "Anatolian hieroglyphs",
}
m["Hung"] = {
canonicalName = "Old Hungarian",
aliases = {"Hungarian runic"},
characters = "𐲀-𐲲",
direction = "rtl",
}
m["Kana"] = {
canonicalName = "Katakana",
characters = "゠-ヿㇰ-ㇿ㌀-㍗ヲ-゚𛀀𛅤𛅥𛅦𛅧",
systems = {"syllabary"},
}
-- These should be defined after the scripts they are composed of
m["Kore"] = {
canonicalName = "Korean",
characters = m["Hang"].characters .. m["Hani"].characters,
systems = {"syllabary", "logography"},
}
m["Hano"] = {
canonicalName = "Hanunoo",
characters = "ᜠ-᜴",
systems = {"abugida"},
}
m["Hebr"] = {
canonicalName = "Hebrew",
characters = u(0x0590) .. "-" .. u(0x05FF) .. u(0xFB1D) .. "-" .. u(0xFB4F),
direction = "rtl",
systems = {"abjad"}, -- more precisely, impure abjad
}
m["Hmng"] = {
canonicalName = "Hmong",
aliases = {"Pahawh Hmong"},
characters = "𖬀-𖮏",
}
m["Ibrn"] = {
canonicalName = "Iberian",
}
m["Imag"] = {
-- To be used to avoid any formatting or link processing
canonicalName = "Image-rendered",
-- This should not have any characters listed
character_category = false,
}
m["Inds"] = {
canonicalName = "Indus",
aliases = {"Harappan", "Indus Valley"},
}
m["IPAchar"] = {
canonicalName = "International Phonetic Alphabet",
aliases = {"IPA"},
}
m["Ital"] = {
canonicalName = "Old Italic",
characters = "𐌀-𐌯",
systems = {"alphabet"},
}
m["Java"] = {
canonicalName = "Javanese",
characters = "ꦀ-꧟",
systems = {"abugida"},
}
m["Jurc"] = {
canonicalName = "Jurchen",
}
m["Kali"] = {
canonicalName = "Kayah Li",
characters = "꤀-꤯",
systems = {"abugida"},
}
m["Khar"] = {
canonicalName = "Kharoshthi",
characters = "𐨀-𐩘",
systems = {"abugida"},
direction = "rtl",
}
m["Khmr"] = {
canonicalName = "Khmer",
characters = "ក-៹᧠-᧿",
systems = {"abugida"},
}
m["Khoj"] = {
canonicalName = "Khojki",
characters = "𑈀-𑈾",
systems = {"abugida"},
}
m["Kitl"] = {
canonicalName = "Khitan Large",
systems = {"logography", "syllabary"},
}
m["Kits"] = {
canonicalName = "Khitan Small",
characters = "𘬀-𘳕"..u(0x16FE4),
systems = {"logography", "syllabary"},
}
m["Knda"] = {
canonicalName = "Kannada",
characters = "ಀ-ೲ",
systems = {"abugida"},
}
m["Kthi"] = {
canonicalName = "Kaithi",
characters = "𑂀-",
systems = {"abugida"},
}
m["Lana"] = {
canonicalName = "Tai Tham",
aliases = {"Tham", "Tua Mueang", "Lanna"},
characters = "ᨠ-᪭",
systems = {"abugida"},
}
m["Laoo"] = {
canonicalName = "Lao",
characters = "ກ-ໟ",
systems = {"abugida"},
}
m["Latn"] = {
canonicalName = "Latin",
aliases = {"Roman"},
varieties = {"Rumi", "Romaji", "Rōmaji", "Romaja"},
characters = "A-Za-zÀ-ÖØ-öø-ɏḀ-ỿ",
systems = {"alphabet"},
}
m["Latf"] = {
canonicalName = "Fraktur",
otherNames = {"Blackletter"}, -- Blackletter is actually the parent "script"
characters = m["Latn"].characters,
}
m["Latinx"] = {
canonicalName = "Latin",
characters = m["Latn"].characters .. "Ⱡ-Ɀ꜠-ꟿꬰ-ꭥ",
parent = "Latn",
}
m["pjt-Latn"] = {
canonicalName = "Latin",
characters = m["Latn"].characters,
parent = "Latn",
}
m["Jpan"] = {
canonicalName = "Japanese",
characters = m["Hira"].characters .. m["Kana"].characters .. m["Hani"].characters .. m["Latn"].characters,
systems = {"syllabary", "logography"},
}
m["Leke"] = {
canonicalName = "Leke",
systems = {"abugida"},
}
m["Lepc"] = {
canonicalName = "Lepcha",
characters = "ᰀ-ᱏ",
systems = {"abugida"},
}
m["Limb"] = {
canonicalName = "Limbu",
characters = "ᤀ-᥏",
systems = {"abugida"},
}
m["Lina"] = {
canonicalName = "Linear A",
characters = "𐘀-𐝧",
}
m["Linb"] = {
canonicalName = "Linear B",
characters = "𐀀-𐃺",
}
m["Lisu"] = {
canonicalName = "Lisu",
aliases = {"Fraser"},
characters = "ꓐ-꓿𑾰",
systems = {"alphabet"},
}
m["Lyci"] = {
canonicalName = "Lycian",
characters = "𐊀-𐊜",
systems = {"alphabet"},
}
m["Lydi"] = {
canonicalName = "Lydian",
characters = "𐤠-𐤿",
direction = "rtl",
systems = {"alphabet"},
}
m["Mahj"] = {
canonicalName = "Mahajani",
characters = "𑅐-𑅶",
systems = {"abugida"},
}
m["Maka"] = {
canonicalName = "Lontara",
aliases = {"Makasar"},
characters = "𑻠-𑻸",
systems = {"abugida"},
}
m["Mand"] = {
canonicalName = "Mandaic",
aliases = {"Mandaean"},
characters = "ࡀ-࡞",
direction = "rtl",
}
m["Mani"] = {
canonicalName = "Manichaean",
characters = "𐫀-𐫶",
direction = "rtl",
systems = {"abjad"},
}
m["Maya"] = {
canonicalName = "Maya",
aliases = {"Maya hieroglyphic", "Mayan", "Mayan hieroglyphic"},
characters = "𝋠-𝋳",
}
m["Medf"] = {
canonicalName = "Medefaidrin",
aliases = {"Oberi Okaime", "Oberi Ɔkaimɛ"},
characters = "𖹀-𖺚",
}
m["Mend"] = {
canonicalName = "Mende",
aliases = {"Mende Kikakui"},
characters = "𞠀-𞣖",
direction = "rtl",
}
m["Merc"] = {
canonicalName = "Meroitic cursive",
characters = "𐦠-𐦿",
direction = "rtl",
systems = {"abugida"},
}
m["Mero"] = {
canonicalName = "Meroitic hieroglyphic",
characters = "𐦀-𐦟",
direction = "rtl",
systems = {"abugida"},
}
m["Mlym"] = {
canonicalName = "Malayalam",
characters = "ഀ-ൿ",
systems = {"abugida"},
}
m["Modi"] = {
canonicalName = "Modi",
characters = "𑘀-𑙙",
systems = {"abugida"},
}
m["Mong"] = {
canonicalName = "Mongolian",
aliases = {"Uyghurjin"},
characters = "᠀-ᢪ𑙠-𑙬",
direction = "down",
}
m["Morse"] = {
canonicalName = "Morse code",
}
m["Mroo"] = {
canonicalName = "Mro",
characters = "𖩀-𖩯",
}
m["Mtei"] = {
canonicalName = "Meitei Mayek",
aliases = {"Meetei Mayek", "Manipuri"},
characters = "ꯀ-꯹ꫠ-꫶",
systems = {"abugida"},
}
m["Mult"] = {
canonicalName = "Multani",
characters = "𑊀-𑊩",
systems = {"abugida"},
}
m["musical"] = {
canonicalName = "Musical notation",
characters = "𝄀-𝇨",
systems = {"pictography"},
}
m["Mymr"] = {
canonicalName = "Burmese",
aliases = {"Myanmar"},
characters = "က-႟ꩠ-ꩿꧠ-ꧾ",
systems = {"abugida"},
}
m["Nand"] = {
canonicalName = "Nandinagari",
characters = "𑦠-𑧤",
systems = {"abugida"},
}
m["Narb"] = {
canonicalName = "Old North Arabian",
characters = "𐪀-𐪟",
direction = "rtl",
systems = {"abjad"},
}
m["Nbat"] = {
canonicalName = "Nabataean",
aliases = {"Nabatean"},
characters = "𐢀-𐢯",
direction = "rtl",
systems = {"abjad"},
}
m["Newa"] = {
canonicalName = "Newa",
aliases = {"Newar", "Newari", "Prachalit Nepal"}, -- and Ranjana?
characters = "𑐀-𑑡",
systems = {"abugida"},
}
m["Nkoo"] = {
canonicalName = "N'Ko",
characters = "߀-߿",
direction = "rtl",
systems = {"alphabet"},
}
m["None"] = {
canonicalName = "Unspecified", -- renders as 'unspecified script'
-- This should not have any characters listed
character_category = false, -- none
}
m["Nshu"] = {
canonicalName = "Nushu",
aliases = {"Nüshu"},
characters = "𖿡𛅰-𛋻",
systems = {"syllabary"},
}
m["Ogam"] = {
canonicalName = "Ogham",
characters = " -᚜",
}
m["Olck"] = {
canonicalName = "Ol Chiki",
characters = "᱐-᱿",
}
m["Orkh"] = {
canonicalName = "Orkhon runes",
characters = "𐰀-𐱈",
direction = "rtl",
}
m["Orya"] = {
canonicalName = "Oriya",
aliases = {"Odia"},
characters = "ଁ-୷",
systems = {"abugida"},
}
m["Osge"] = {
canonicalName = "Osage",
characters = "𐒰-𐓻",
}
m["Osma"] = {
canonicalName = "Osmanya",
characters = "𐒀-𐒩",
}
m["Ougr"] = {
canonicalName = "Old Uyghur",
characters = "𐽰-𐾉",
direction = "down",
systems = {"abjad", "alphabet"},
}
m["Palm"] = {
canonicalName = "Palmyrene",
characters = "𐡠-𐡿",
direction = "rtl",
}
m["Pauc"] = {
canonicalName = "Pau Cin Hau",
characters = "𑫀-𑫸",
}
m["Perm"] = {
canonicalName = "Old Permic",
characters = "𐍐-𐍺",
}
m["Phag"] = {
canonicalName = "Phags-pa",
characters = "ꡀ-꡷",
direction = "down",
systems = {"abugida"},
}
m["Marc"] = {
canonicalName = "Marchen",
characters = "𑱰-𑲶",
systems = {"abugida"},
}
m["Phli"] = {
canonicalName = "Inscriptional Pahlavi",
characters = "𐭠-𐭿",
direction = "rtl",
systems = {"abjad"},
}
m["Phlp"] = {
canonicalName = "Psalter Pahlavi",
characters = "𐮀-𐮯",
direction = "rtl",
systems = {"abjad"},
}
m["Phlv"] = {
canonicalName = "Book Pahlavi",
direction = "rtl",
systems = {"abjad"},
-- Not in Unicode
}
m["Phnx"] = {
canonicalName = "Phoenician",
characters = "𐤀-𐤟",
direction = "rtl",
systems = {"abjad"},
}
m["Plrd"] = {
canonicalName = "Pollard",
characters = "𖼀-𖾟",
systems = {"abugida"},
}
m["Prti"] = {
canonicalName = "Inscriptional Parthian",
characters = "𐭀-𐭟",
direction = "rtl",
}
m["Rjng"] = {
canonicalName = "Rejang",
characters = "ꤰ-꥟",
systems = {"abugida"},
}
m["Rohg"] = {
canonicalName = "Hanifi Rohingya",
characters = "𐴀-𐴹",
direction = "rtl",
systems = {"alphabet"},
}
m["Ruminumerals"] = {
canonicalName = "Rumi numerals",
characters = "𐹠-𐹾",
character_category = "Rumi numerals",
}
m["Runr"] = {
canonicalName = "Runic",
characters = "ᚠ-ᛰ",
systems = {"alphabet"},
}
m["Samr"] = {
canonicalName = "Samaritan",
characters = "ࠀ-࠾",
direction = "rtl",
systems = {"abjad"},
}
m["Sarb"] = {
canonicalName = "Old South Arabian",
characters = "𐩠-𐩿",
direction = "rtl",
systems = {"abjad"},
}
m["Saur"] = {
canonicalName = "Saurashtra",
characters = "ꢀ-꣙",
systems = {"abugida"},
}
m["Semap"] = {
canonicalName = "flag semaphore",
systems = {"pictography"},
}
m["Sgnw"] = {
canonicalName = "SignWriting",
characters = "𝠀-𝪯",
systems = {"pictography"},
}
m["Shaw"] = {
canonicalName = "Shavian",
characters = "𐑐-𐑿",
}
m["Shrd"] = {
canonicalName = "Sharada",
characters = "𑆀-𑇙",
systems = {"abugida"},
}
m["Sidd"] = {
canonicalName = "Siddham",
characters = "𑖀-𑗝",
systems = {"abugida"},
}
m["Sind"] = {
canonicalName = "Khudawadi",
characters = "𑊰-𑋹",
systems = {"abugida"},
}
m["Sinh"] = {
canonicalName = "Sinhalese",
characters = "ං-෴",
systems = {"abugida"},
}
m["Sogd"] = {
canonicalName = "Sogdian",
characters = "𐼰-𐽙",
direction = "rtl",
systems = {"abjad"},
}
m["Sogo"] = {
canonicalName = "Old Sogdian",
characters = "𐼀-𐼧",
direction = "rtl",
systems = {"abjad"},
}
m["Sora"] = {
canonicalName = "Sorang Sompeng",
aliases = {"Sora Sompeng"},
characters = "𑃐-𑃹",
}
m["Soyo"] = {
canonicalName = "Soyombo",
characters = "𑩐-𑪢",
systems = {"abugida"},
}
m["Sund"] = {
canonicalName = "Sundanese",
characters = "ᮀ-ᮿ",
systems = {"abugida"},
}
m["Sylo"] = {
canonicalName = "Syloti Nagri",
aliases = {"Sylheti Nagari"},
characters = "ꠀ-꠫",
systems = {"abugida"},
}
m["Syrc"] = {
canonicalName = "Syriac",
characters = "܀-ݏ"..u(0x0860).."-"..u(0x086A),
direction = "rtl",
systems = {"abjad"}, -- more precisely, impure abjad
}
-- Syre, Syrj, Syrn are apparently subsumed into Syrc; discuss if this causes issues
m["Tagb"] = {
canonicalName = "Tagbanwa",
characters = "ᝠ-ᝳ",
systems = {"abugida"},
}
m["Takr"] = {
canonicalName = "Takri",
characters = "𑚀-𑛉",
systems = {"abugida"},
}
m["Tale"] = {
canonicalName = "Tai Nüa",
aliases = {"Tai Nuea", "New Tai Nüa", "New Tai Nuea", "Dehong Dai", "Tai Dehong", "Tai Le"},
characters = "ᥐ-ᥴ",
systems = {"abugida"},
}
m["Talu"] = {
canonicalName = "New Tai Lue",
characters = "ᦀ-᧟",
systems = {"abugida"},
}
m["Taml"] = {
canonicalName = "Tamil",
characters = "ஂ-௺𑿀-𑿿",
systems = {"abugida"},
}
m["Tang"] = {
canonicalName = "Tangut",
characters = "𖿠𗀀-𘫿𘴀-𘴈",
systems = {"logography", "syllabary"},
}
m["Tavt"] = {
canonicalName = "Tai Viet",
characters = "ꪀ-꫟",
systems = {"abugida"},
}
m["Telu"] = {
canonicalName = "Telugu",
characters = "ఀ-౿",
systems = {"abugida"},
}
m["Teng"] = {
canonicalName = "Tengwar",
}
m["Tfng"] = {
canonicalName = "Tifinagh",
otherNames = {"Libyco-Berber", "Berber"}, -- per Wikipedia, Libyco-Berber is the parent
characters = "ⴰ-⵿",
systems = {"abjad", "alphabet"},
}
m["Tglg"] = {
canonicalName = "Baybayin",
aliases = {"Tagalog"},
characters = "ᜀ-᜔",
systems = {"abugida"},
}
m["Thaa"] = {
canonicalName = "Thaana",
characters = "ހ-ޱ",
systems = {"abugida"},
direction = "rtl",
}
m["Thai"] = {
canonicalName = "Thai",
characters = "ก-๛",
systems = {"abugida"},
}
m["Tibt"] = {
canonicalName = "Tibetan",
characters = "ༀ-࿚",
systems = {"abugida"},
}
m["Tirh"] = {
canonicalName = "Tirhuta",
characters = "𑒀-𑓙",
systems = {"abugida"},
}
m["xzh-Tibt"] = {
canonicalName = "Zhang-Zhung",
systems = {"abugida"},
}
m["Tnsa"] = {
canonicalName = "Tangsa",
characters = "𖩰-𖫉",
systems = {"alphabet"},
}
m["Toto"] = {
canonicalName = "Toto",
characters = "𞊐-𞊮",
systems = {"abugida"},
}
m["Ugar"] = {
canonicalName = "Ugaritic",
characters = "𐎀-𐎟",
systems = {"abjad"},
}
m["Vaii"] = {
canonicalName = "Vai",
characters = "ꔀ-ꘫ",
systems = {"syllabary"},
}
m["Vith"] = {
canonicalName = "Vithkuqi",
characters = "𐕰-𐖼",
systems = {"alphabet"},
}
m["Wara"] = {
canonicalName = "Varang Kshiti",
characters = "𑢠-𑣿",
}
m["Xpeo"] = {
canonicalName = "Old Persian",
characters = "𐎠-𐏕",
}
m["Xsux"] = {
canonicalName = "Cuneiform",
aliases = {"Sumero-Akkadian Cuneiform"},
characters = "𒀀-𒎙𒐀-𒑳",
}
m["Yiii"] = {
canonicalName = "Yi",
characters = "ꀀ-꓆",
systems = {"syllabary"},
}
m["Zanb"] = {
canonicalName = "Zanabazar Square",
characters = u(0x11A00).."-"..u(0x11A47),
}
m["Zmth"] = {
canonicalName = "mathematical notation",
characters = "ℵ∀-⋿⟀-⟯⦀-⫿𝐀-𝟿",
character_category = "Mathematical notation symbols", -- ?
}
m["Zsym"] = {
canonicalName = "symbol",
characters = "─-➿←-⇿⌀-⏿⬀-⯾🀀-🃵🌀-🩭",
character_category = false, -- none
systems = {"pictography"},
}
m["Zyyy"] = {
canonicalName = "undetermined",
-- This should not have any characters listed, probably
character_category = false, -- none
characters = m["Latn"].characters,
}
m["Zzzz"] = {
canonicalName = "uncoded",
-- This should not have any characters listed
character_category = false, -- none
}
return m
tm69ywxw1p65kbf625cw3xds4jrp1uq
Module:scripts/findBestScript
828
2945
8253
2022-07-21T16:58:14Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
return function (export, text, lang, scripts, forceDetect)
--[=[
Remove any HTML entities; catfix function in [[Module:utilities]]
adds tagging to a no-break space ( ), which contains Latin characters;
hence Latin was returned as the script if "Latn" is one of the language's scripts.
]=]
text = string.gsub(text, "&[a-zA-Z0-9]+;", "")
-- Try to match every script against the text,
-- and return the one with the most matching characters.
local bestcount = 0
local bestscript = nil
-- Get length of text minus any spacing or punctuation characters.
-- Counting instances of UTF-8 character pattern is faster than mw.ustring.len.
local _, length = string.gsub(mw.ustring.gsub(text, "[%s%p]+", ""), "[\1-\127\194-\244][\128-\191]*", "")
if length == 0 then
return export.getByCode("None")
end
for i, script in ipairs(scripts) do
local count = script:countCharacters(text)
if count >= length then
return script
end
if count > bestcount then
bestcount = count
bestscript = script
end
end
if bestscript then
return bestscript
end
-- No matching script was found. Return "None".
return export.getByCode("None")
end
2k718fyv9gb6qdxf079j9elt4xfrl9m
Module:script utilities
828
2946
8254
2022-07-21T17:11:02Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
--[=[
Modules used:
[[Module:script utilities/data]]
[[Module:scripts]]
[[Module:senseid]] (only when id's present)
[[Module:string utilities]] (only when hyphens in Korean text or spaces in vertical text)
[[Module:languages]]
[[Module:parameters]]
[[Module:utilities/format_categories]]
[[Module:debug/track]]
]=]
function export.is_Latin_script(sc)
-- Latn, Latf, Latinx, pjt-Latn
return sc:getCode():find("Lat") and true or false
end
-- Used by [[Template:lang]]
function export.lang_t(frame)
params = {
[1] = {},
[2] = { allow_empty = true, default = "" },
["sc"] = {},
["face"] = {},
["class"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local NAMESPACE = mw.title.getCurrentTitle().nsText
local lang = args[1] or (NAMESPACE == "Template" and "und") or error("Language code has not been specified. Please pass parameter 1 to the template.")
lang = require("Module:languages").getByCode(lang) or require("Module:languages").err(lang, 1)
local text = args[2]
local sc = args["sc"]
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
local face = args["face"]
return export.tag_text(text, lang, sc, face, class)
end
-- Ustring turns on the codepoint-aware string matching. The basic string function
-- should be used for simple sequences of characters, Ustring function for
-- sets – [].
local function trackPattern(text, pattern, tracking, ustring)
local find = ustring and mw.ustring.find or string.find
if pattern and find(text, pattern) then
require("Module:debug/track")("script/" .. tracking)
end
end
local function track(text, lang, sc)
local U = mw.ustring.char
if lang and text then
local langCode = lang:getCode()
-- [[Special:WhatLinksHere/Template:tracking/script/ang/acute]]
if langCode == "ang" then
local decomposed = mw.ustring.toNFD(text)
local acute = U(0x301)
trackPattern(decomposed, acute, "ang/acute")
--[=[
[[Special:WhatLinksHere/Template:tracking/script/Greek/wrong-phi]]
[[Special:WhatLinksHere/Template:tracking/script/Greek/wrong-theta]]
[[Special:WhatLinksHere/Template:tracking/script/Greek/wrong-kappa]]
[[Special:WhatLinksHere/Template:tracking/script/Greek/wrong-rho]]
ϑ, ϰ, ϱ, ϕ should generally be replaced with θ, κ, ρ, φ.
]=]
elseif langCode == "el" or langCode == "grc" then
trackPattern(text, "ϑ", "Greek/wrong-theta")
trackPattern(text, "ϰ", "Greek/wrong-kappa")
trackPattern(text, "ϱ", "Greek/wrong-rho")
trackPattern(text, "ϕ", "Greek/wrong-phi")
--[=[
[[Special:WhatLinksHere/Template:tracking/script/Ancient Greek/spacing-coronis]]
[[Special:WhatLinksHere/Template:tracking/script/Ancient Greek/spacing-smooth-breathing]]
[[Special:WhatLinksHere/Template:tracking/script/Ancient Greek/wrong-apostrophe]]
When spacing coronis and spacing smooth breathing are used as apostrophes,
they should be replaced with right single quotation marks (’).
]=]
if langCode == "grc" then
trackPattern(text, U(0x1FBD), "Ancient Greek/spacing-coronis")
trackPattern(text, U(0x1FBF), "Ancient Greek/spacing-smooth-breathing")
trackPattern(text, "[" .. U(0x1FBD) .. U(0x1FBF) .. "]", "Ancient Greek/wrong-apostrophe", true)
end
-- [[Special:WhatLinksHere/Template:tracking/script/Russian/grave-accent]]
elseif langCode == "ru" then
local decomposed = mw.ustring.toNFD(text)
trackPattern(decomposed, U(0x300), "Russian/grave-accent")
-- [[Special:WhatLinksHere/Template:tracking/script/Tibetan/trailing-punctuation]]
elseif langCode == "bo" then
trackPattern(text, "[་།]$", "Tibetan/trailing-punctuation", true)
trackPattern(text, "[་།]%]%]$", "Tibetan/trailing-punctuation", true)
--[=[
[[Special:WhatLinksHere/Template:tracking/script/Thai/broken-ae]]
[[Special:WhatLinksHere/Template:tracking/script/Thai/broken-am]]
[[Special:WhatLinksHere/Template:tracking/script/Thai/wrong-rue-lue]]
]=]
elseif langCode == "th" then
trackPattern(text, "เ".."เ", "Thai/broken-ae")
trackPattern(text, "ํ[่้๊๋]?า", "Thai/broken-am", true)
trackPattern(text, "[ฤฦ]า", "Thai/wrong-rue-lue", true)
--[=[
[[Special:WhatLinksHere/Template:tracking/script/Lao/broken-ae]]
[[Special:WhatLinksHere/Template:tracking/script/Lao/broken-am]]
[[Special:WhatLinksHere/Template:tracking/script/Lao/possible-broken-ho-no]]
[[Special:WhatLinksHere/Template:tracking/script/Lao/possible-broken-ho-mo]]
[[Special:WhatLinksHere/Template:tracking/script/Lao/possible-broken-ho-lo]]
]=]
elseif langCode == "lo" then
trackPattern(text, "ເ".."ເ", "Lao/broken-ae")
trackPattern(text, "ໍ[່້໊໋]?າ", "Lao/broken-am", true)
trackPattern(text, "ຫນ", "Lao/possible-broken-ho-no")
trackPattern(text, "ຫມ", "Lao/possible-broken-ho-mo")
trackPattern(text, "ຫລ", "Lao/possible-broken-ho-lo")
--[=[
[[Special:WhatLinksHere/Template:tracking/script/Lü/broken-ae]]
[[Special:WhatLinksHere/Template:tracking/script/Lü/possible-wrong-sequence]]
]=]
elseif langCode == "khb" then
trackPattern(text, "ᦵ".."ᦵ", "Lü/broken-ae")
trackPattern(text, "[ᦀ-ᦫ][ᦵᦶᦷᦺ]", "Lü/possible-wrong-sequence", true)
end
end
end
-- Wrap text in the appropriate HTML tags with language and script class.
function export.tag_text(text, lang, sc, face, class, id)
if not sc then
sc = require("Module:scripts").findBestScript(text, lang)
end
track(text, lang, sc)
-- Replace space characters with newlines in Mongolian-script text, which is written top-to-bottom.
if sc:getDirection() == "down" and text:find(" ") then
text = require("Module:munge_text")(text, function(txt)
-- having extra parentheses makes sure only the first return value gets through
return (txt:gsub(" +", "<br>"))
end)
end
-- Hack Korean script text to remove hyphens.
-- XXX: This should be handled in a more general fashion, but needs to
-- be efficient by not doing anything if no hyphens are present, and currently this is the only
-- language needing such processing.
-- 20220221: Also convert 漢字(한자) to ruby, instead of needing [[Template:Ruby]].
if sc:getCode() == "Kore" and (text:find("%-") or text:find("[()]")) then
text = require("Module:munge_text")(text, function(txt)
-- Hani/Hang regex is a reasonable subset of Hani/Hang from [[Module:scripts/data]],
-- last checked on 20220221
txt = txt:gsub("%-", "")
txt = mw.ustring.gsub(txt, "([一-鿿㐀-䶿𠀀-𰀀-]+)%(([가-힣ᄀ-ᇿꥠ-ꥼힰ-ퟻ]+)%)", "<ruby>%1<rp>(</rp><rt>%2</rt><rp>)</rp></ruby>")
return txt
end)
end
if sc:getCode() == "Imag" then
face = nil
end
local function class_attr(classes)
table.insert(classes, 1, sc:getCode())
if class and class ~= '' then
table.insert(classes, class)
end
return 'class="' .. table.concat(classes, ' ') .. '"'
end
local function tag_attr(...)
local output = {}
if id then
table.insert(output, 'id="' .. require("Module:senseid").anchor(lang, id) .. '"')
end
table.insert(output, class_attr({...}) )
if lang then
table.insert(output, 'lang="' .. lang:getCode() .. '"')
end
return table.concat(output, " ")
end
if face == "hypothetical" then
-- [[Special:WhatLinksHere/Template:tracking/script-utilities/face/hypothetical]]
require("Module:debug/track")("script-utilities/face/hypothetical")
end
local data = mw.loadData("Module:script utilities/data").faces[face or "nil"]
local post = ""
if sc:getDirection() == "rtl" and (face == "translation" or mw.ustring.find(text, "%p$")) then
post = "‎"
end
-- Add a script wrapper
if data then
return ( data.prefix or "" ) .. '<' .. data.tag .. ' ' .. tag_attr(data.class) .. '>' .. text .. '</' .. data.tag .. '>' .. post
else
error('Invalid script face "' .. face .. '".')
end
end
function export.tag_translit(translit, lang, kind, attributes, is_manual)
if type(lang) == "table" then
lang = lang.getCode and lang:getCode()
or error("Second argument to tag_translit should be a language code or language object.")
end
local data = mw.loadData("Module:script utilities/data").translit[kind or "default"]
local opening_tag = {}
table.insert(opening_tag, data.tag)
if lang == "ja" then
table.insert(opening_tag, 'class="' .. (data.classes and data.classes .. " " or "") .. (is_manual and "manual-tr " or "") .. 'tr"')
else
table.insert(opening_tag, 'lang="' .. lang .. '-Latn"')
table.insert(opening_tag, 'class="' .. (data.classes and data.classes .. " " or "") .. (is_manual and "manual-tr " or "") .. 'tr Latn"')
end
if data.dir then
table.insert(opening_tag, 'dir="' .. data.dir .. '"')
end
table.insert(opening_tag, attributes)
return "<" .. table.concat(opening_tag, " ") .. ">" .. translit .. "</" .. data.tag .. ">"
end
function export.tag_transcription(transcription, lang, kind, attributes)
if type(lang) == "table" then
lang = lang.getCode and lang:getCode()
or error("Third argument to tag_translit should be a language code or language object.")
end
local data = mw.loadData("Module:script utilities/data").transcription[kind or "default"]
local opening_tag = {}
table.insert(opening_tag, data.tag)
if lang == "ja" then
table.insert(opening_tag, 'class="' .. (data.classes and data.classes .. " " or "") .. 'ts"')
else
table.insert(opening_tag, 'lang="' .. lang .. '-Latn"')
table.insert(opening_tag, 'class="' .. (data.classes and data.classes .. " " or "") .. 'ts Latn"')
end
if data.dir then
table.insert(opening_tag, 'dir="' .. data.dir .. '"')
end
table.insert(opening_tag, attributes)
return "<" .. table.concat(opening_tag, " ") .. ">" .. transcription .. "</" .. data.tag .. ">"
end
-- Add a notice to request the native script of a word
function export.request_script(lang, sc, usex, nocat, sort_key)
local scripts = lang.getScripts and lang:getScripts() or error('The language "' .. lang:getCode() .. '" does not have the method getScripts. It may be unwritten.')
-- By default, request for "native" script
local cat_script = "native"
local disp_script = "script"
-- If the script was not specified, and the language has only one script, use that.
if not sc and #scripts == 1 then
sc = scripts[1]
end
-- Is the script known?
if sc then
-- If the script is Latin, return nothing.
if export.is_Latin_script(sc) then
return ""
end
if sc:getCode() ~= scripts[1]:getCode() then
disp_script = sc:getCanonicalName()
end
-- The category needs to be specific to script only if there is chance
-- of ambiguity. This occurs when lang=und, or when the language has
-- multiple scripts.
if lang:getCode() == "und" or scripts[2] then
cat_script = sc:getCanonicalName()
end
else
-- The script is not known.
-- Does the language have at least one non-Latin script in its list?
local has_nonlatin = false
for i, val in ipairs(scripts) do
if not export.is_Latin_script(val) then
has_nonlatin = true
break
end
end
-- If there are no non-Latin scripts, return nothing.
if not has_nonlatin then
return ""
end
end
local category
if usex then
category = "Requests for " .. cat_script .. " script in " .. lang:getCanonicalName() .. " usage examples"
else
category = "Requests for " .. cat_script .. " script for " .. lang:getCanonicalName() .. " terms"
end
return "<small>[" .. disp_script .. " needed]</small>" ..
(nocat and "" or require("Module:utilities/format_categories")({category}, lang, sort_key))
end
function export.template_rfscript(frame)
params = {
[1] = { required = true, default = "und" },
["sc"] = {},
["usex"] = { type = "boolean" },
["nocat"] = { type = "boolean" },
["sort"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = require("Module:languages").getByCode(args[1], 1)
local sc = args.sc and require("Module:scripts").getByCode(args.sc, true)
local ret = export.request_script(lang, sc, args.usex, args.nocat, args.sort)
if ret == "" then
error("This language is written in the Latin alphabet. It does not need a native script.")
else
return ret
end
end
function export.checkScript(text, scriptCode, result)
local scriptObject = require("Module:scripts").getByCode(scriptCode)
if not scriptObject then
error('The script code "' .. scriptCode .. '" is not recognized.')
end
local originalText = text
-- Remove non-letter characters.
text = mw.ustring.gsub(text, "[%A]", "")
-- Remove all characters of the script in question.
text = mw.ustring.gsub(text, "[" .. scriptObject:getCharacters() .. "]", "")
if text ~= "" then
if type(result) == "string" then
error(result)
else
error('The text "' .. originalText .. '" contains the letters "' .. text .. '" that do not belong to the ' .. scriptObject:getDisplayForm() .. '.', 2)
end
end
end
return export
9ngfwzgm248m0tf7f4w21s67ibt0yyw
Module:script utilities/data
828
2947
8255
2022-07-21T17:13:11Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local data = {}
data.translit = {
["term"] = {
--[=[ can't be done until Kana transliterations are correctly parsed by [[Module:links]]
["tag"] = "i",
]=]
["classes"] = "mention-tr",
},
["usex"] = {
["tag"] = "i",
["classes"] = "e-transliteration",
},
["head"] = {
["classes"] = "headword-tr",
["dir"] = "ltr",
},
["default"] = {},
}
data.transcription = {
["head"] = {
["tag"] = "span",
["classes"] = "headword-ts",
["dir"] = "ltr",
},
["usex"] = {
tag = "span",
["classes"] = "e-transcription",
},
["default"] = {},
}
for key, value in pairs(data.translit) do
if not value.tag then
value.tag = "span"
end
end
data.faces = {
["term"] = {
tag = "i",
class = "mention",
},
["head"] = {
tag = "strong",
class = "headword",
},
["hypothetical"] = {
prefix = '<span class="hypothetical-star">*</span>',
tag = "i",
class = "hypothetical",
},
["bold"] = {
tag = "b",
},
["translation"] = {
tag = "span",
},
["nil"] = {
tag = "span",
},
}
return data
fm6qqnko32z2ecx0x8dstbowpirn5sa
Template:bor
10
2948
8260
2022-07-21T18:01:00Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{#invoke:etymology/templates/borrowed|borrowed}}<noinclude>{{documentation}}</noinclude>
ck2uicyt84ro88jfftayvgmjj8u9dbl
Module:etymology/templates/borrowed
828
2949
8261
2022-07-21T18:02:43Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
function export.borrowed(frame)
local args, lang, term, sources = require("Module:etymology/templates/internal").parse_2_lang_args(frame)
if sources then
return require("Module:etymology/multi").format_multi_borrowed(lang, sources, term, args.sort, args.nocat, args.conj)
else
return require("Module:etymology").format_borrowed(lang, term, args.sort, args.nocat)
end
end
return export
2wenvc67iugvzhxiwy5qv5hywo2wzz9
Module:etymology/templates/internal
828
2950
8262
2022-07-21T18:04:14Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
-- For internal use only with [[Module:etymology/templates]] and its submodules.
local export = {}
function export.fetch_lang(lang, param)
return require("Module:languages").getByCode(lang, param)
end
function export.fetch_source(code, param, disallow_family)
return require("Module:languages").getByCode(code, param, true, not disallow_family)
end
local function fetch_sources(codes, param, disallow_family)
local m_languages = require("Module:languages")
codes = mw.text.split(codes, "%s*,%s*")
for i, code in ipairs(codes) do
codes[i] = m_languages.getByCode(code, param, true, not disallow_family)
end
return codes
end
function export.fetch_source_or_sources(source, param, disallow_family)
local sources
if source:find(",") then
sources = fetch_sources(source, param, no_family)
source = sources[#sources]
else
source = export.fetch_source(source, param, no_family)
end
return source, sources
end
function export.fetch_script(sc, param)
return require("Module:scripts").getByCode(sc, param)
end
function export.parse_2_lang_args(frame, has_text, no_family)
local params = {
[1] = {required = true, default = "und"},
[2] = {required = true, default = "und"},
[3] = {},
[4] = {alias_of = "alt"},
[5] = {alias_of = "t"},
["alt"] = {},
["cat"] = {},
["g"] = {list = true},
["gloss"] = {alias_of = "t"},
["id"] = {},
["lit"] = {},
["pos"] = {},
["t"] = {},
["tr"] = {},
["ts"] = {},
["sc"] = {},
["nocat"] = {type = "boolean"},
["sort"] = {},
["conj"] = {},
}
if has_text then
params["notext"] = {type = "boolean"}
params["nocap"] = {type = "boolean"}
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = export.fetch_lang(args[1], 1)
local source, sources = export.fetch_source_or_sources(args[2], 2, no_family)
local sc = export.fetch_script(args["sc"], "sc")
return args, lang, {
lang = source,
sc = sc,
term = args[3],
alt = args["alt"],
id = args["id"],
genders = args["g"],
tr = args["tr"],
ts = args["ts"],
gloss = args["t"],
pos = args["pos"],
lit = args["lit"]
}, sources
end
return export
9duq6puisyqx6d59rmi3rsi7e0116q0
Module:languages/data3/u
828
2951
8263
2022-07-21T18:07:17Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local u = mw.ustring.char
-- UTF-8 encoded strings for some commonly used diacritics
local GRAVE = u(0x0300)
local ACUTE = u(0x0301)
local CIRC = u(0x0302)
local TILDE = u(0x0303)
local MACRON = u(0x0304)
local BREVE = u(0x0306)
local DOTABOVE = u(0x0307)
local DIAER = u(0x0308)
local CARON = u(0x030C)
local DGRAVE = u(0x030F)
local INVBREVE = u(0x0311)
local DOTBELOW = u(0x0323)
local RINGBELOW = u(0x0325)
local CEDILLA = u(0x0327)
local Latn = {"Latn"}
local m = {}
m["uam"] = {
"Uamué",
3441418,
}
m["uan"] = {
"Kuan",
6441085,
}
m["uar"] = {
"Tairuma",
7676386,
"ngf",
}
m["uba"] = {
"Ubang",
3914467,
"nic-ben",
Latn,
}
m["ubi"] = {
"Ubi",
56264,
}
m["ubl"] = {
"Buhi'non Bikol",
18664494,
"phi",
}
m["ubr"] = {
"Ubir",
3547642,
"poz-ocw",
Latn,
}
m["ubu"] = {
"Umbu-Ungu",
12953245,
"ngf",
}
m["uby"] = {
"Ubykh",
36931,
"cau-nwc",
{"Latn", "Cyrl"},
}
m["uda"] = {
"Uda",
11011951,
"nic-lcr",
}
m["ude"] = {
"Udihe",
13235,
"tuw",
{"Cyrl"},
}
m["udg"] = {
"Muduga",
16886762,
"dra",
}
m["udi"] = {
"Udi",
36867,
"cau-nec",
{"Cyrl", "Latn", "Armn", "Geor"},
ancestors = {"xag"},
translit_module = "translit-redirect",
override_translit = true,
}
m["udj"] = {
"Ujir",
14916906,
"poz-cet",
}
m["udl"] = {
"Uldeme",
3515078,
"cdc-cbm",
}
m["udm"] = {
"Udmurt",
13238,
"urj-prm",
{"Cyrl"},
translit_module = "udm-translit",
override_translit = true,
}
m["udu"] = {
"Uduk",
3182573,
"ssa-kom",
}
m["ues"] = {
"Kioko",
18343036,
}
m["ufi"] = {
"Ufim",
7877531,
"ngf-fin",
Latn,
}
m["uga"] = {
"Ugaritic",
36928,
"sem-nwe",
{"Ugar"},
translit_module = "uga-translit",
}
m["ugb"] = {
"Kuku-Ugbanh",
10549854,
}
m["uge"] = {
"Ughele",
966303,
"poz-ocw",
}
m["ugn"] = {
"Ugandan Sign Language",
7877677,
"sgn",
}
m["ugo"] = {
"Gong",
3448919,
"tbq-lob",
{"Thai"},
sort_key = {
from = {"[%pๆ]", "[็-๎]", "([เแโใไ])([ก-ฮ])"},
to = {"", "", "%2%1"}},
}
m["ugy"] = {
"Uruguayan Sign Language",
7901470,
"sgn",
}
m["uha"] = {
"Uhami",
3913328,
"alv-nwd",
Latn,
}
m["uhn"] = {
"Damal",
4748974,
}
m["uis"] = {
"Uisai",
7878123,
"paa-sbo",
}
m["uiv"] = {
"Iyive",
11128658,
"nic-tvc",
Latn,
}
m["uji"] = {
"Tanjijili",
3914939,
"nic-pls",
}
m["uka"] = {
"Kaburi",
6344482,
}
m["ukg"] = {
"Ukuriguma",
7878623,
"ngf-mad",
}
m["ukh"] = {
"Ukhwejo",
36623,
"bnt-bek",
}
m["ukk"] = {
"Muak Sa-aak",
nil,
"mkh-pal",
}
m["ukl"] = {
"Ukrainian Sign Language",
10322106,
"sgn",
}
m["ukp"] = {
"Ukpe-Bayobiri",
3914470,
"nic-ben",
Latn,
}
m["ukq"] = {
"Ukwa",
7878635,
"nic-ief",
}
m["uks"] = {
"Kaapor Sign Language",
3322101,
"sgn",
}
m["uku"] = {
"Ukue",
3913387,
"alv-nwd",
Latn,
}
m["ukw"] = {
"Ukwuani-Aboh-Ndoni",
36636,
"alv",
Latn,
}
m["uky"] = {
"Kuuk Yak",
6448719,
"aus-psw",
Latn,
}
m["ula"] = {
"Fungwa",
5509187,
"nic-shi",
}
m["ulb"] = {
"Ulukwumi",
36722,
"alv-yor",
}
m["ulc"] = {
"Ulch",
13239,
"tuw",
{"Cyrl", "Latn"},
}
m["ule"] = {
"Lule",
12635889,
nil,
Latn,
}
m["ulf"] = {
"Afra",
4477735,
"paa-pau",
}
m["uli"] = {
"Ulithian",
36842,
"poz-mic",
}
m["ulk"] = {
"Meriam",
788174,
"ngf",
Latn,
}
m["ull"] = {
"Ullatan",
8761579,
"dra",
}
m["ulm"] = {
"Ulumanda'",
3501892,
}
m["uln"] = {
"Unserdeutsch",
13244,
"crp",
Latn,
ancestors = {"de"},
}
m["ulu"] = {
"Uma' Lung",
3548186,
"poz-swa",
}
m["ulw"] = {
"Ulwa",
2405552,
}
m["uma"] = {
"Umatilla",
12953952,
"nai-shp",
Latn,
ancestors = {"nai-spt"},
}
m["umb"] = {
"Umbundu",
36983,
"bnt",
Latn,
}
m["umc"] = {
"Marrucinian",
36110,
"itc",
{"Latn", "Ital"},
}
m["umd"] = {
"Umbindhamu",
7881346,
"aus-pmn",
}
m["umg"] = {
"Umbuygamu",
3915677,
"aus-pmn",
}
m["umi"] = {
"Ukit",
7878321,
}
m["umm"] = {
"Umon",
3915448,
"nic-ucn",
Latn,
}
m["umn"] = {
"Makyan Naga",
6740516,
"sit-kch",
}
m["umo"] = {
"Umotína",
7881740,
"sai-mje",
}
m["ump"] = {
"Umpila",
12953954,
"aus-pmn",
Latn,
}
m["umr"] = {
"Umbugarla",
2980392,
}
m["ums"] = {
"Pendau",
7162371,
"poz-tot",
}
m["umu"] = {
"Munsee",
56547,
"del",
Latn,
entry_name = {
from = {"Á", "Ă", "É", "Í", "Ó", "Ú", "Ŭ", "á", "á", "ă", "é", "í", "ó", "ú", "ŭ"},
to = {"A", "A", "E", "I", "O", "U", "U", "a", "á", "a", "e", "i", "o", "u", "u"}} ,
}
m["una"] = {
"North Watut",
15887898,
"poz-ocw",
Latn,
}
m["und"] = {
"Undetermined",
nil,
"qfa-not",
{"Zyyy"},
}
m["une"] = {
"Uneme",
3913357,
"alv-yek",
Latn,
}
m["ung"] = {
"Ngarinyin",
1284885,
"aus-wor",
Latn,
}
m["unk"] = {
"Enawené-Nawé",
3307184,
"awd",
Latn,
}
m["unm"] = {
"Unami",
3549180,
"del",
Latn,
--Don't strip diacritics from entry names, per [[WT:Grease pit/2020/May]].
--entry_name = {
-- from = {"À", "Ä", "È", "Ë", "Ì", "Ò", "Ù", "à", "ä", "è", "ë", "ì", "ò", "ù"},
-- to = {"A", "A", "E", "E", "I", "O", "U", "a", "a", "e", "e", "i", "o", "u"}} ,
}
m["unn"] = {
"Kurnai",
nil,
"aus-pam",
Latn,
}
m["unr"] = {
"Mundari",
3327828,
"mun",
{"Deva"},
translit_module = "hi-translit", -- for now
}
m["unu"] = {
"Unubahe",
7897776,
}
m["unx"] = {
"Munda",
36264959,
"mun",
Latn,
}
m["unz"] = {
"Unde Kaili",
12953596,
"poz-kal",
Latn,
}
m["uok"] = {
"Uokha",
3441216,
"alv-edo",
Latn,
}
m["uon"] = {
"Kulon",
Q11182000,
"map",
Latn,
}
m["upi"] = {
"Umeda",
7881465,
"paa-brd",
}
m["upv"] = {
"Uripiv-Wala-Rano-Atchin",
13249,
"poz-vnc",
Latn,
}
m["ura"] = {
"Urarina",
1579560,
}
m["urb"] = {
"Urubú-Kaapor",
13893353,
"tup-gua",
Latn,
}
m["urc"] = {
"Urningangg",
10710522,
}
m["ure"] = {
"Uru",
2992892,
}
m["urf"] = {
"Uradhi",
3915680,
"aus-pam",
Latn,
}
m["urg"] = {
"Urigina",
7900603,
"ngf",
Latn,
}
m["urh"] = {
"Urhobo",
36663,
"alv-swd",
Latn,
}
m["uri"] = {
"Urim",
7900609,
"qfa-tor",
Latn,
}
m["urk"] = {
"Urak Lawoi'",
7899573,
"poz-mly",
{"Thai"},
sort_key = {
from = {"[%pๆ]", "[็-๎]", "([เแโใไ])([ก-ฮ])"},
to = {"", "", "%2%1"}},
}
m["url"] = {
"Urali",
7899602,
"dra",
{"Knda"},
}
m["urm"] = {
"Urapmin",
7899769,
"ngf-okk",
}
m["urn"] = {
"Uruangnirin",
7901389,
"poz-cet",
Latn,
}
m["uro"] = {
"Ura (New Guinea)",
3121049,
"paa-bng",
Latn,
}
m["urp"] = {
"Uru-Pa-In",
7901376,
"tup-gua",
Latn,
}
m["urr"] = {
"Lehalurup",
3272124,
}
m["urt"] = {
"Urat",
3502084,
"qfa-tor",
Latn,
}
m["uru"] = {
"Urumi",
7901530,
"tup",
Latn,
}
m["urv"] = {
"Uruava",
36875,
"poz-ocw",
Latn,
}
m["urw"] = {
"Sop",
7562808,
"ngf-mad",
Latn,
}
m["urx"] = {
"Urimo",
7900611,
"qfa-tor",
Latn,
}
m["ury"] = {
"Orya",
7105295,
"paa-tkw",
Latn,
}
m["urz"] = {
"Uru-Eu-Wau-Wau",
10266012,
"tup-gua",
Latn,
}
m["usa"] = {
"Usarufa",
7901714,
"paa-kag",
Latn,
}
m["ush"] = {
"Ushojo",
3540446,
"inc-dar",
}
m["usi"] = {
"Usui",
12644231,
}
m["usk"] = {
"Usaghade",
3914048,
"nic-lcr",
Latn,
}
m["usp"] = {
"Uspanteco",
36728,
"myn",
Latn,
}
m["uss"] = {
"Saare",
nil,
"nic-knn",
Latn,
}
m["usu"] = {
"Uya",
7904082,
}
m["uta"] = {
"Otank",
3913990,
"nic-tvc",
Latn,
}
m["ute"] = {
"Ute",
13260,
"azc-num",
Latn,
}
m["uth"] = {
"Hun",
nil,
"nic-knn",
Latn,
}
m["utp"] = {
"Aba",
2841465,
"poz-oce",
Latn,
}
m["utr"] = {
"Etulo",
35262,
"alv-ido",
Latn,
}
m["utu"] = {
"Utu",
7903469,
"ngf-mad",
}
m["uum"] = {
"Urum",
13257,
"trk-kcu",
{"Cyrl"},
}
m["uun"] = {
"Kulon-Pazeh",
36435,
"map",
Latn,
}
m["uur"] = {
"Ura (Vanuatu)",
7899531,
"poz-oce",
Latn,
}
m["uuu"] = {
"U",
953082,
"mkh-pal",
}
m["uve"] = {
"West Uvean",
36837,
"poz-pnp",
Latn,
}
m["uvh"] = {
"Uri",
7900540,
"ngf-fin",
Latn,
}
m["uvl"] = {
"Lote",
3259972,
"poz-ocw",
Latn,
}
m["uwa"] = {
"Kuku-Uwanh",
3915687,
"aus-pmn",
}
m["uya"] = {
"Doko-Uyanga",
7904095,
"nic-ucr",
Latn,
}
return m
1n8pmgbzhtsl63yklmxrfc7pm2y2y8f
Module:etymology
828
2952
8264
2022-07-21T18:08:53Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
-- For testing
local force_cat = false
--[[ If language is an etymology language, iterates through parent languages
until it finds a non-etymology language. ]]
--FIXME: Callers of this should use [[Module:languages]] directly.
function export.getNonEtymological(lang)
if lang:getType() == "etymology language" then
return require("Module:languages").getNonEtymological(lang)
end
return lang
end
local function term_error(terminfo)
if terminfo.lang:getType() == "family" then
if terminfo.term and terminfo.term ~= "-" then
require("Module:debug/track")("etymology/family/has-term")
end
terminfo.term = "-"
end
return terminfo
end
local function create_link(terminfo, template_name)
local link = ""
if terminfo.term == "-" then
--[=[
[[Special:WhatLinksHere/Template:tracking/cognate/no-term]]
[[Special:WhatLinksHere/Template:tracking/derived/no-term]]
[[Special:WhatLinksHere/Template:tracking/borrowed/no-term]]
[[Special:WhatLinksHere/Template:tracking/calque/no-term]]
]=]
require("Module:debug/track")(template_name .. "/no-term")
else
-- mw.log(terminfo.term)
link = " " .. require("Module:links").full_link(terminfo, "term", true)
end
return link
end
function export.process_and_create_link(terminfo, template_name)
terminfo.lang = export.getNonEtymological(terminfo.lang)
terminfo = term_error(terminfo)
return create_link(terminfo, template_name or "derived")
end
function export.get_display_and_cat_name(source, raw)
local display, cat_name
if source:getCode() == "und" then
display = "undetermined"
cat_name = "other languages"
elseif source:getCode() == "mul" then
display = "[[w:Translingualism|translingual]]"
cat_name = "Translingual"
elseif source:getCode() == "mul-tax" then
display = "[[w:taxonomic name|taxonomic name]]"
cat_name = "taxonomic names"
else
display = raw and source:getCanonicalName() or source:makeWikipediaLink()
cat_name = source:getDisplayForm()
end
return display, cat_name
end
function export.insert_source_cat_get_display(categories, lang, source, raw, nocat)
local display, cat_name = export.get_display_and_cat_name(source, raw)
if lang and not nocat then
-- Add the category, but only if there is a current language
if not categories then
categories = {}
end
if lang:getCode() == source:getCode() then
table.insert(categories, lang:getCanonicalName() .. " twice-borrowed terms")
else
table.insert(categories, lang:getCanonicalName() .. " terms derived from " .. cat_name)
end
end
return display, categories
end
-- FIXME: rename to format_source()
function export.format_etyl(lang, source, sort_key, categories, nocat)
-- [[Special:WhatLinksHere/Template:tracking/etymology/sortkey]]
if sort_key then
require("Module:debug/track")("etymology/sortkey")
end
local display
display, categories = export.insert_source_cat_get_display(categories, lang, source, false, nocat)
if lang and not nocat then
-- Format categories, but only if there is a current language; {{cog}} currently gets no categories
categories = require("Module:utilities").format_categories(categories, lang, sort_key, nil, force_cat)
else
categories = ""
end
return "<span class=\"etyl\">" .. display .. categories .. "</span>"
end
-- Internal implementation of {{cognate|...}} template
function export.format_cognate(terminfo, sort_key)
return export.format_derived(nil, terminfo, sort_key, nil, "cognate")
end
-- Internal implementation of {{derived|...}} template
function export.format_derived(lang, terminfo, sort_key, nocat, template_name)
local source = terminfo.lang
return export.format_etyl(lang, source, sort_key, nil, nocat) .. export.process_and_create_link(terminfo, template_name)
end
-- Return true if `lang` has `otherlang` (which may be an etymology-only language) as an ancestor. This includes
-- cases such as Italian -> Old Italian, which is an etymology-only language whose "parent" is Italian but which is
-- marked as "ancestral to parent". `non_etym_otherlang` is the non-etymology-language equivalent of `otherlang`.
-- If `otherlang` is not an etymology-only language, the two will be the same.
local function has_ancestor(lang, otherlang, non_etym_otherlang)
-- First check if `lang` has (the non-etymology-language parent of) `otherlang` as its ancestor. If `lang` is e.g.
-- Italian and `otherlang` is Latin, this will be caught here. If `lang` is Italian and `otherlang` is Vulgar Latin
-- (an etymology-only language whose parent is Latin), this will also be caught here, as we use the
-- non-etymology-language parent, in this case Latin, when checking the ancestor hierarchy.
if lang:hasAncestor(non_etym_otherlang) then
return true
end
-- Second check for the Italian -> Old Italian case. This happens when (a) `otherlang` is etymology-only,
-- (b) `otherlang` is marked as "ancestral to parent", (c) `otherlang`'s parent is the same as `lang`. This is not
-- caught above because Italian is not ancestral to Italian.
if otherlang:getType() == "etymology language" and otherlang:isAncestralToParent() then
local otherlang_parent = export.getNonEtymological(otherlang)
if otherlang_parent and otherlang_parent:getCode() == lang:getCode() then
return true
end
end
return false
end
-- Check that `lang` has `otherlang` (which may be an etymology-only language) as an ancestor. Throw an error if not.
local function check_ancestor(lang, otherlang, non_etym_otherlang)
if not has_ancestor(lang, otherlang, non_etym_otherlang) and mw.title.getCurrentTitle().nsText ~= "Template" then
-- Generate the non-ancestor error message.
local function showLanguage(lang)
local retval = ("%s (%s)"):format(lang:makeCategoryLink(), lang:getCode())
if lang:getType() == "etymology language" then
retval = retval .. (" (an etymology-only language whose regular parent is %s)"):format(
showLanguage(export.getNonEtymological(lang)))
end
return retval
end
local postscript
local ancestors = lang:getAncestors()
local moduleLink = "[[Module:"
.. require("Module:languages").getDataModuleName(lang:getCode())
.. "]]"
if not ancestors[1] then
postscript = showLanguage(lang) .. " has no ancestors."
else
local ancestorList = table.concat(
require("Module:fun").map(
showLanguage,
ancestors),
" and ")
postscript = ("The ancestor%s of %s %s %s."):format(
ancestors[2] and "s" or "", lang:getCanonicalName(),
ancestors[2] and "are" or "is", ancestorList)
end
error(("%s is not set as an ancestor of %s in %s. %s")
:format(showLanguage(otherlang), showLanguage(lang), moduleLink, postscript))
end
end
-- Internal implementation of {{inherited|...}} template
function export.format_inherited(lang, terminfo, sort_key, nocat)
local source = terminfo.lang
local categories = {}
if not nocat then
table.insert(categories, lang:getCanonicalName() .. " terms inherited from " .. source:getCanonicalName())
end
local link = export.process_and_create_link(terminfo, "inherited")
check_ancestor(lang, source, terminfo.lang)
return export.format_etyl(lang, source, sort_key, categories, nocat) .. link
end
function export.insert_borrowed_cat(categories, lang, source)
local category
if lang:getCode() == source:getCode() then
category = " twice-borrowed terms"
else
category = " terms borrowed from " .. source:getDisplayForm()
end
table.insert(categories, lang:getCanonicalName() .. category)
end
-- Internal implementation of {{borrowed|...}} template.
function export.format_borrowed(lang, terminfo, sort_key, nocat)
local source = terminfo.lang
local categories = {}
if not nocat then
export.insert_borrowed_cat(categories, lang, source)
end
return export.format_etyl(lang, source, sort_key, categories, nocat) ..
export.process_and_create_link(terminfo, "borrowed")
end
return export
itco1l2s6lw2a800rf0grfrj9it14yt
Template:a
10
2953
8265
2022-07-21T18:28:47Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{#invoke:accent qualifier|show}}<noinclude>{{documentation}}</noinclude>
rkp8073yt7s9fcxmgfve8gzuy1sj8us
Module:accent qualifier
828
2954
8266
2022-07-21T18:34:42Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local m_qualifier = require("Module:qualifier")
function export.format_qualifiers(qualifiers)
local m_data = mw.loadData("Module:accent qualifier/data")
if type(qualifiers) ~= "table" then
qualifiers = { qualifiers }
end
local accents = {}
local categories = {}
for _, accent in ipairs(qualifiers) do
local data
-- Replace an alias with the label that has a data table.
if m_data.aliases[accent] then
accent = m_data.aliases[accent]
end
-- Retrieve the label's data table.
if m_data.labels[accent] then
data = m_data.labels[accent]
end
-- Use the link and displayed text in the data table, if they exist.
if data then
if data.link then
table.insert(accents, "[[w:" .. data.link .. "|" ..
(data.display or data.link) .. "]]")
elseif data.display then
table.insert(accents, data.display)
end
--[[
if data[accent] then
if data[accent].type == "sound change" then
table.insert(categories, lang:getCanonicalName() .. " terms with pronunciations exhibiting " .. accent)
end
end
]]
else
table.insert(accents, accent)
end
end
return m_qualifier.format_qualifier(accents)
end
-- Called by {{accent}} or {{a}}.
function export.show(frame)
local args = frame.getParent and frame:getParent().args or frame
if (not args[1] or args[1] == "") and mw.title.getCurrentTitle().nsText == "Template" then
return m_qualifier.format_qualifier{ '{{{1}}}' }
end
local params = {
[1] = {required = true, list = true}
}
args = require("Module:parameters").process(args, params)
return export.format_qualifiers(args[1])
end
return export
lz0w34ceclze1jy7yv9znoh9d75vz1c
Module:qualifier
828
2955
8267
2022-07-21T18:36:10Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
function export.format_qualifier(list) -- keep in sync with [[Template:qualifier]]
if type(list) ~= "table" then
list = { list }
end
if #list == 0 then
return ''
end
return '<span class="ib-brac qualifier-brac">(</span>' ..
'<span class="ib-content qualifier-content">' ..
table.concat(list, '<span class="ib-comma qualifier-comma">,</span> ') ..
'</span><span class="ib-brac qualifier-brac">)</span>'
end
function export.sense(list) -- keep in sync with [[Template:sense]]
return export.format_qualifier(list)
.. '<span class="ib-colon sense-qualifier-colon">:</span>'
end
return export
c9hl0r9z9t1dp3atblkfi1gopwa55p1
Template:IPA
10
2956
8268
2022-07-21T18:38:42Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{check deprecated lang param usage|lang={{{lang|}}}|<!--
-->{{#invoke:IPA/templates|IPA}}<!--
-->}}<!--
--><noinclude>{{documentation}}</noinclude>
k9mhfq9a7nf5suoyiwknfuk0p4ozvdo
Module:IPA/templates
828
2957
8269
2022-07-21T18:40:14Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local m_IPA = require("Module:IPA")
local U = mw.ustring.char
local syllabic = U(0x0329)
-- Used for [[Template:IPA]].
function export.IPA(frame)
local parent_args = frame.getParent and frame:getParent().args or frame
local compat = parent_args["lang"]
local offset = compat and 0 or 1
local params = {
[compat and "lang" or 1] = {required = true, default = "en"},
[1 + offset] = {list = true, allow_holes = true},
["ref"] = {list = true, allow_holes = true},
-- Came before 'ref' but too obscure
["n"] = {list = true, allow_holes = true, alias_of = "ref"},
["qual"] = {list = true, allow_holes = true},
["nocount"] = {type = "boolean"},
["sort"] = {},
}
local args = require("Module:parameters").process(parent_args, params)
local lang = args[compat and "lang" or 1]
lang = require("Module:languages").getByCode(lang)
or require("Module:languages").err(lang, compat and "lang" or 1)
-- [[Special:WhatLinksHere/Template:tracking/IPA/grc]]
if lang and lang:getCode() == "grc" then
require("Module:debug").track("IPA/grc")
end
local items = {}
for i = 1, math.max(args[1 + offset].maxindex, args["ref"].maxindex, args["qual"].maxindex) do
local pron = args[1 + offset][i]
local refs = args["ref"][i]
if refs then
refs = require("Module:references").parse_references(refs)
end
local qual = args["qual"][i]
if not pron then
if refs or qual then
local param = i == 1 and "" or "" .. i
error("Specified qual" .. param .. "= or ref" .. param .. "= without corresponding pronunciation")
end
else
if lang then
require("Module:IPA/tracking").run_tracking(pron, lang)
end
if pron or refs or qual then
table.insert(items, {pron = pron, refs = refs, qualifiers = {qual}})
end
end
end
return m_IPA.format_IPA_full(lang, items, nil, nil, args.sort, args.nocount)
end
-- Used for [[Template:IPAchar]].
function export.IPAchar(frame)
local params = {
[1] = {list = true, allow_holes = true},
["ref"] = {list = true, allow_holes = true},
-- Came before 'ref' but too obscure
["n"] = {list = true, allow_holes = true, alias_of = "ref"},
["qual"] = {list = true, allow_holes = true},
-- FIXME, remove this.
["lang"] = {}, -- This parameter is not used and does nothing, but is allowed for futureproofing.
}
local args = require("Module:parameters").process(frame.getParent and frame:getParent().args or frame, params)
-- [[Special:WhatLinksHere/Template:tracking/IPAchar/lang]]
if args.lang then
require("Module:debug").track("IPAchar/lang")
end
local items = {}
for i = 1, math.max(args[1].maxindex, args["ref"].maxindex, args["qual"].maxindex) do
local pron = args[1][i]
local refs = args["ref"][i]
if refs then
refs = require("Module:references").parse_references(refs)
end
local qual = args["qual"][i]
if pron or refs or qual then
table.insert(items, {pron = pron, refs = refs, qualifiers = {qual}})
end
end
-- Format
return m_IPA.format_IPA_multiple(nil, items)
end
function export.XSAMPA(frame)
local params = {
[1] = { required = true },
}
local args = require("Module:parameters").process(frame:getParent().args, params)
return m_IPA.XSAMPA_to_IPA(args[1] or "[Eg'zA:mp5=]")
end
-- Used by [[Template:X2IPA]]
function export.X2IPAtemplate(frame)
local parent_args = frame.getParent and frame:getParent().args or frame
local compat = parent_args["lang"]
local offset = compat and 0 or 1
local params = {
[compat and "lang" or 1] = {required = true, default = "und"},
[1 + offset] = {list = true, allow_holes = true},
["ref"] = {list = true, allow_holes = true},
-- Came before 'ref' but too obscure
["n"] = {list = true, allow_holes = true, alias_of = "ref"},
["qual"] = { list = true, allow_holes = true },
}
local args = require("Module:parameters").process(parent_args, params)
local m_XSAMPA = require("Module:IPA/X-SAMPA")
local pronunciations, refs, qualifiers, lang = args[1 + offset], args["ref"], args["qual"], args[compat and "lang" or 1]
local output = {}
table.insert(output, "{{IPA")
table.insert(output, "|" .. lang)
for i = 1, math.max(pronunciations.maxindex, refs.maxindex, qualifiers.maxindex) do
if pronunciations[i] then
table.insert(output, "|" .. m_XSAMPA.XSAMPA_to_IPA(pronunciations[i]))
end
if refs[i] then
table.insert(output, "|ref" .. i .. "=" .. refs[i])
end
if qualifiers[i] then
table.insert(output, "|qual" .. i .. "=" .. qualifiers[i])
end
end
table.insert(output, "}}")
return table.concat(output)
end
-- Used by [[Template:X2IPAchar]]
function export.X2IPAchar(frame)
local params = {
[1] = { list = true, allow_holes = true },
["ref"] = {list = true, allow_holes = true},
-- Came before 'ref' but too obscure
["n"] = {list = true, allow_holes = true, alias_of = "ref"},
["qual"] = { list = true, allow_holes = true },
-- FIXME, remove this.
["lang"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
-- [[Special:WhatLinksHere/Template:tracking/X2IPAchar/lang]]
if args.lang then
require("Module:debug").track("X2IPAchar/lang")
end
local m_XSAMPA = require("Module:IPA/X-SAMPA")
local pronunciations, refs, qualifiers, lang = args[1], args["ref"], args["qual"], args["lang"]
local output = {}
table.insert(output, "{{IPAchar")
for i = 1, math.max(pronunciations.maxindex, refs.maxindex, qualifiers.maxindex) do
if pronunciations[i] then
table.insert(output, "|" .. m_XSAMPA.XSAMPA_to_IPA(pronunciations[i]))
end
if refs[i] then
table.insert(output, "|ref" .. i .. "=" .. refs[i])
end
if qualifiers[i] then
table.insert(output, "|qual" .. i .. "=" .. qualifiers[i])
end
end
if lang then
table.insert(output, "|lang=" .. lang)
end
table.insert(output, "}}")
return table.concat(output)
end
-- Used by [[Template:x2rhymes]]
function export.X2rhymes(frame)
local parent_args = frame.getParent and frame:getParent().args or frame
local compat = parent_args["lang"]
local offset = compat and 0 or 1
local params = {
[compat and "lang" or 1] = {required = true, default = "und"},
[1 + offset] = {required = true, list = true, allow_holes = true},
}
local args = require("Module:parameters").process(parent_args, params)
local m_XSAMPA = require("Module:IPA/X-SAMPA")
pronunciations, lang = args[1 + offset], args[compat and "lang" or 1]
local output = {}
table.insert(output, "{{rhymes")
table.insert(output, "|" .. lang)
for i = 1, pronunciations.maxindex do
if pronunciations[i] then
table.insert(output, "|" .. m_XSAMPA.XSAMPA_to_IPA(pronunciations[i]))
end
end
table.insert(output, "}}")
return table.concat(output)
end
return export
fertbyhcrc4gw6c99oyklgsx627amxy
Module:IPA
828
2958
8270
2022-07-21T18:41:38Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
-- [[Module:IPA/data]]
local m_data = mw.loadData('Module:IPA/data') -- [[Module:IPA/data]]
local m_symbols = mw.loadData('Module:IPA/data/symbols') -- [[Module:IPA/data/symbols]]
local m_syllables -- [[Module:syllables]]; loaded below if needed
local sub = mw.ustring.sub
local find = mw.ustring.find
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local gmatch = mw.ustring.gmatch
local U = mw.ustring.char
function export.format_IPA_full(lang, items, err, separator, sortKey, no_count)
local IPA_key, key_link, err_text, prefix, IPAs, category
local hasKey = m_data.langs_with_infopages
local namespace = mw.title.getCurrentTitle().nsText
if err then
err_text = '<span class="error">' .. err .. '</span>'
else
if hasKey[lang:getCode()] then
IPA_key = "Appendix:" .. lang:getCanonicalName() .. " pronunciation"
else
IPA_key = "wikipedia:" .. lang:getCanonicalName() .. " phonology"
end
key_link = "[[" .. IPA_key .. "|key]]"
end
local prefix = "[[Wiktionary:International Phonetic Alphabet|IPA]]<sup>(" .. ( key_link or err_text ) .. ")</sup>: "
IPAs = export.format_IPA_multiple(lang, items, separator, no_count)
if lang and (namespace == "" or namespace == "Reconstruction") then
sortKey = sortKey or lang:makeSortKey(mw.title.getCurrentTitle().text)
sortKey = sortKey and ("|" .. sortKey) or ""
category = "[[Category:" .. lang:getCanonicalName() .. " terms with IPA pronunciation" .. sortKey .. "]]"
else
category = ""
end
return prefix .. IPAs .. category
end
local function determine_repr(pron)
local repr_mark = {}
local repr, reconstructed
-- remove initial asterisk before representation marks, used on some Reconstruction pages
if find(pron, "^%*") then
reconstructed = true
pron = sub(pron, 2)
end
local representation_types = {
['/'] = { right = '/', type = 'phonemic', },
['['] = { right = ']', type = 'phonetic', },
['⟨'] = { right = '⟩', type = 'orthographic', },
['-'] = { type = 'rhyme' },
}
repr_mark.i, repr_mark.f, repr_mark.left, repr_mark.right = find(pron, '^(.).-(.)$')
local representation_type = representation_types[repr_mark.left]
if representation_type then
if representation_type.right then
if repr_mark.right == representation_type.right then
repr = representation_type.type
end
else
repr = representation_type.type
end
else
repr = nil
end
return repr, reconstructed
end
local function hasInvalidSeparators(transcription)
if find(transcription, "%.[ˈˌ]") then
return true
else
return false
end
end
function export.format_IPA_multiple(lang, items, separator, no_count)
local categories = {}
separator = separator or ', '
-- Format
if not items[1] then
if mw.title.getCurrentTitle().nsText == "Template" then
table.insert(items, {pron = "/aɪ piː ˈeɪ/"})
else
table.insert(categories, "[[Category:Pronunciation templates without a pronunciation]]")
end
end
local bits = {}
for _, item in ipairs(items) do
local bit = export.format_IPA(lang, item.pron)
if item.pretext then
bit = item.pretext .. bit
end
if item.posttext then
bit = bit .. item.posttext
end
if item.qualifiers and item.qualifiers[1] then
bit = require("Module:qualifier").format_qualifier(item.qualifiers) .. " " .. bit
end
if item.refs or item.note then
local refspecs
if item.note then
-- FIXME: eliminate item.note in favor of item.refs. Use tracking to find places
-- that use item.note.
refspecs = {item.note}
require("Module:debug").track("IPA/note")
else
refspecs = item.refs
end
local refs = {}
if #refspecs > 0 then
for _, refspec in ipairs(refspecs) do
if type(refspec) ~= "table" then
refspec = {text = refspec}
end
local refargs
if refspec.name or refspec.group then
refargs = {name = refspec.name, group = refspec.group}
end
table.insert(refs, mw.getCurrentFrame():extensionTag("ref", refspec.text, refargs))
end
bit = bit .. table.concat(refs)
end
end
table.insert(bits, bit)
--[=[ [[Special:WhatLinksHere/Template:tracking/IPA/syntax-error]]
The length or gemination symbol should not appear after a syllable break or stress symbol. ]=]
if find(item.pron, "[ˈˌ%.][ːˑ]") then
require("Module:debug").track("IPA/syntax-error")
end
if lang then
-- Add syllable count if the language's diphthongs are listed in [[Module:syllables]].
-- Don't do this if the term has spaces or a liaison mark (‿).
if not no_count and mw.title.getCurrentTitle().namespace == 0 then
m_syllables = m_syllables or require('Module:syllables')
local langcode = lang:getCode()
if m_data.langs_to_generate_syllable_count_categories[langcode] then
local repr = determine_repr(item.pron)
local use_it
if m_data.langs_to_use_phonetic_notation[langcode] then
use_it = repr == "phonetic"
else
use_it = repr == "phonemic"
end
if use_it and not find(item.pron, "[ ‿]") then
local syllable_count = m_syllables.getVowels(item.pron, lang)
if syllable_count then
table.insert(categories, "[[Category:" .. lang:getCanonicalName() .. " " .. syllable_count .. "-syllable words]]")
end
end
end
end
if lang:getCode() == "en" and hasInvalidSeparators(item.pron) then
table.insert(categories, "[[Category:IPA for English using .ˈ or .ˌ]]")
end
end
end
return table.concat(bits, separator) .. table.concat(categories)
end
-- Takes an IPA pronunciation and formats it and adds cleanup categories.
function export.format_IPA(lang, pron, split_output)
local err = {}
local categories = {}
-- Remove wikilinks, so that wikilink brackets are not misinterpreted as
-- indicating phonemic transcription
local str_gsub = string.gsub
local without_links = str_gsub(pron, '%[%[[^|%]]+|([^%]]+)%]%]', '%1')
without_links = str_gsub(without_links, '%[%[[^%]]+%]%]', '%1')
-- Detect whether this is a phonemic or phonetic transcription
local repr, reconstructed = determine_repr(without_links)
if reconstructed then
pron = sub(pron, 2)
end
-- If valid, strip the representation marks
if repr == "phonemic" then
pron = sub(pron, 2, -2)
without_links = sub(without_links, 2, -2)
elseif repr == "phonetic" then
pron = sub(pron, 2, -2)
without_links = sub(without_links, 2, -2)
elseif repr == "orthographic" then
pron = sub(pron, 2, -2)
without_links = sub(without_links, 2, -2)
elseif repr == "rhyme" then
pron = sub(pron, 2)
without_links = sub(without_links, 2)
else
table.insert(categories, "[[Category:IPA pronunciations with invalid representation marks]]")
-- table.insert(err, "invalid representation marks")
-- Removed because it's annoying when previewing pronunciation pages.
end
if pron == "" then
table.insert(categories, "[[Category:IPA pronunciations with no pronunciation present]]")
end
-- Check for obsolete and nonstandard symbols
for i, symbol in ipairs(m_data.nonstandard) do
local result
for nonstandard in gmatch(pron, symbol) do
if not result then
result = {}
end
table.insert(result, nonstandard)
table.insert(categories, "[[Category:IPA pronunciations with obsolete or nonstandard characters|" .. nonstandard .. "]]")
end
if result then
table.insert(err, "obsolete or nonstandard characters (" .. table.concat(result) .. ")")
break
end
end
--[[ Check for invalid symbols after removing the following:
1. wikilinks (handled above)
2. paired HTML tags
3. bolding
4. italics
5. HTML entity for space
6. asterisk at beginning of transcription
7. comma followed by spacing characters
8. superscripts enclosed in superscript parentheses ]]
local found_HTML
local result = str_gsub(without_links, "<(%a+)[^>]*>([^<]+)</%1>",
function(tagName, content)
found_HTML = true
return content
end)
result = str_gsub(result, "'''([^']*)'''", "%1")
result = str_gsub(result, "''([^']*)''", "%1")
result = str_gsub(result, "&[^;]+;", "") -- This may catch things that are not valid character entities.
result = str_gsub(result, "^%*", "")
result = gsub(result, ",%s+", "")
result = gsub(result, "⁽[".. m_symbols.superscripts .. "]+⁾", "")
result = gsub(result, '[' .. m_symbols.valid .. ']', '')
-- VS15
local vs15_class = "[" .. m_symbols.add_vs15 .. "]"
if mw.ustring.find(pron, vs15_class) then
local vs15 = U(0xFE0E)
if mw.ustring.find(result, vs15) then
result = gsub(result, vs15, "")
pron = mw.ustring.gsub(pron, vs15, "")
end
pron = mw.ustring.gsub(pron, "(" .. vs15_class .. ")", "%1" .. vs15)
end
if result ~= '' then
local suggestions = {}
mw.log(pron, result)
local namespace = mw.title.getCurrentTitle().namespace
local category
if namespace == 0 then
-- main namespace
category = "IPA pronunciations with invalid IPA characters"
elseif namespace == 118 then
-- reconstruction namespace
category = "IPA pronunciations with invalid IPA characters/reconstruction"
else
category = "IPA pronunciations with invalid IPA characters/non_mainspace"
end
for character in gmatch(result, ".") do
local suggestion = m_symbols.suggestions[character]
if suggestion then
table.insert(suggestions, character .. " with " .. suggestion)
end
table.insert(categories, "[[Category:" .. category .. "|" .. character .. "]]")
end
table.insert(err, "invalid IPA characters (" .. result .. ")")
if suggestions[1] then
table.insert(err, "replace " .. table.concat(suggestions, ", "))
end
end
if found_HTML then
table.insert(categories, "[[Category:IPA pronunciations with paired HTML tags]]")
end
-- Reference inside IPA template usage
-- FIXME: Doesn't work; you can't put HTML in module output.
--if mw.ustring.find(pron, '</ref>') then
-- table.insert(categories, "[[Category:IPA pronunciations with reference]]")
--end
if repr == "phonemic" or repr == "rhyme" then
if lang and m_data.phonemes[lang:getCode()] then
local valid_phonemes = m_data.phonemes[lang:getCode()]
local rest = pron
local phonemes = {}
while mw.ustring.len(rest) > 0 do
local longestmatch = ""
if sub(rest, 1, 1) == "(" or sub(rest, 1, 1) == ")" then
longestmatch = sub(rest, 1, 1)
else
for _, phoneme in ipairs(valid_phonemes) do
if mw.ustring.len(phoneme) > mw.ustring.len(longestmatch) and sub(rest, 1, mw.ustring.len(phoneme)) == phoneme then
longestmatch = phoneme
end
end
end
if mw.ustring.len(longestmatch) > 0 then
table.insert(phonemes, longestmatch)
rest = sub(rest, mw.ustring.len(longestmatch) + 1)
else
local phoneme = sub(rest, 1, 1)
table.insert(phonemes, "<span style=\"color: red\">" .. phoneme .. "</span>")
rest = sub(rest, 2)
table.insert(categories, "[[Category:IPA pronunciations with invalid phonemes/" .. lang:getCode() .. "]]")
require("Module:debug").track("IPA/invalid phonemes/" .. phoneme)
end
end
pron = table.concat(phonemes)
end
if repr == "phonemic" then
pron = "/" .. pron .. "/"
else
pron = "-" .. pron
end
elseif repr == "phonetic" then
pron = "[" .. pron .. "]"
elseif repr == "orthographic" then
pron = "⟨" .. pron .. "⟩"
end
if reconstructed then
pron = "*" .. pron
end
if err[1] then
err = '<span class="previewonly error" style="font-size: small;> ' .. table.concat(err, ', ') .. '</span>'
else
err = ""
end
if split_output then -- for use of IPA in links
return '<span class="IPA">' .. pron .. '</span>', table.concat(categories), err
else
return '<span class="IPA">' .. pron .. '</span>' .. err .. table.concat(categories)
end
end
function export.example(frame)
local output = {}
local m_links = require('Module:links')
local m_languages = require('Module:languages')
table.insert(
output,
[[
{| class="wikitable"
! Term !! IPA !! Generated X-SAMPA !! Regenerated IPA !! Matched?
]]
)
local row =
[[
|-
| link || IPA || XSAMPA || regenerated_IPA || matched
]]
local examples = mw.text.split(frame.args[1], ",%s*")
local m_XSAMPA = require("Module:IPA/X-SAMPA")
for _, example in pairs(examples) do
local lang, word = match(example, "(%l%l%l?):(.+) [/%[]")
if lang then
lang = m_languages.getByCode(lang) or error('"' .. lang .. '" is not a valid language code.')
end
local IPA = match(example, "/[^/]+/")
or match(example, "%[[^%]]+%]")
or error('No IPA transcription found in "' .. example .. '".')
local XSAMPA = m_XSAMPA.IPA_to_XSAMPA(IPA)
local regenerated_IPA = m_XSAMPA.XSAMPA_to_IPA(XSAMPA)
content = {
link = lang and word and m_links.full_link{ term = word, lang = lang },
matched = IPA == regenerated_IPA
and '<span style="color: green;">yes</span>'
or '<span style="color: red;">no</span>',
IPA = '<span class="IPA">' .. IPA .. '</span>',
XSAMPA = '<code>' .. XSAMPA .. '</code>',
regenerated_IPA = '<span class="IPA">' .. regenerated_IPA .. '</span>'
}
local function add_content(item)
return content[item] or ""
end
local row = gsub(row, "[%a_]+", add_content)
table.insert(output, row)
end
table.insert(output, "|}")
return table.concat(output)
end
return export
f9zzr4y7bt605p4pj2dovcyvlp77hw4
Module:IPA/data
828
2959
8271
2022-07-21T18:43:06Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local data = {}
--[=[
This should list the language codes of all languages that have a pronunciation
page in the appendix of the form ''Appendix:LANG pronunciation'', e.g.
[[Appendix:Russian pronunciation]]. For these languages, the text "key" next to
the generated pronunciation links to such pages; for other languages, it links
to the "LANG phonology" page in Wikipedia (which may or may not exist).
[[Module:IPA]] is responsible for this linking; see format_IPA_full().
]=]
local langs_with_infopages = {
"acw",
"ady",
"ang",
"arc",
"ba",
"bg",
"bo",
"ca",
"cho",
"cmn",
"cs",
"cv",
"cy",
"da",
"de",
"dsb",
"dz",
"egl",
"egy",
"el",
"en",
"enm",
"eo",
"es",
"fa",
"fi",
"fo",
"fr",
"fy",
"ga",
"gd",
"gem-pro",
"got",
"he",
"hi",
"hu",
"hy",
"ii",
"is",
"it",
"iu",
"ja",
"jbo",
"ka",
"kls",
"ko",
"kw",
"la",
"lb",
"liv",
"lt",
"lv",
"mdf",
"mfe",
"mic",
"mk",
"ms",
"mt",
"mul",
"my",
"nan",
"nci",
"nl",
"nn",
"no",
"nov",
"nv",
"pjt",
"pl",
"ps",
"pt",
"ro",
"ru",
"scn",
"sco",
"sga",
"sh",
"sl",
"sq",
"sv",
"sw",
"syc",
"th",
"tl",
"tr",
"tyv",
"ug",
"uk",
"vi",
"vo",
"wlm",
"yi",
"yue",
}
data.langs_with_infopages = {}
-- Convert the list in `langs_with_infopages` to a set.
for _, langcode in ipairs(langs_with_infopages) do
data.langs_with_infopages[langcode] = true
end
--[=[
This should list the diphthongs of a language (in the form of Lua patterns),
provided they do *NOT* contain semivowel symbols such as /j w ɰ ɥ/ or vowels
with nonsyllabic diacritics such as /i̯ u̯/. For example, list /au/ or /aʊ/,
but do not list /aw/ or /au̯/. The data in this table is used to count the
number of syllables in a word. [[Module:syllables]] automatically knows how
to correctly handle semivowel symbols and nonsyllabic diacritics.
Any language listed here will automatically have categories of the form
"LANG #-syllable words" generated. In addition, any language listed below under
`langs_to_generate_syllable_count_categories` will also have such categories
generated.
NOTE: There are some additional languages that have these categories.
For example:
* Thai words have these categories added by [[Module:th-pron]].
]=]
data.diphthongs = {
["cs"] = { -- [[w:Czech phonology#Diphthongs]]
"[aeo]u",
},
["de"] = {
"a[ɪʊ]",
"ɔ[ʏɪ]",
},
["en"] = { -- from [[Appendix:English pronunciation]] mostly, but /ʌɪ/ is from the OED
"[aɑeɛoɔʌ][ɪi]",
"[ɑɒæo]e",
"[əɐ]ʉ",
"[aɒəoɔʌ]ʊ",
"æo",
"[ɛeɪiɔʊʉ]ə", -- /iə/ is a diphthong in NZE, but a disyllabic sequence in GA.
-- /ɪə/ is both a disyllabic sequence and a diphthong in old-fashioned RP.
"[aʌ][ʊɪ]ə", -- May be a disyllabic sequence in some or all dialects?
},
["grc"] = {
"[aeyo]i",
"[ae]u",
"[ɛɔa]ː[iu]",
},
["is"] = { -- [[w:Icelandic phonology#Vowels]]
"[aeø][iɪy]", -- Wikipedia is oddly specific about the second element: ei and ai, but øɪ.
"[ao]u",
},
["it"] = {
"[aeɛoɔu]i",
"[aeɛioɔ]u",
},
["la"] = {
"[eaou]i",
"[eao]u",
"[ao]e",
},
["lb"] = {
"[iu]ə",
"[ɜoæɑ]ɪ",
"[əæɑ]ʊ",
},
}
--[=[
This should list any languages for which categories of the form
"LANG #-syllable words", e.g. [[:Category:Russian 3-syllable words]], should be
generated. Do not list languages here if they have an entry above under
`data.diphthongs`; such languages are automatically added to this list.
]=]
local langs_to_generate_syllable_count_categories = {
"ar", -- Arabic has diphthongs, but they are transcribed
-- with semivowel symbols.
"ary", -- Moroccan Arabic has diphthongs, but they are transcribed
-- with semivowel symbols.
"ca", -- Catalan has diphthongs, but they are generally transcribed using
-- /w/ and /j/, so do not need to be listed (see [[w:Catalan language#Diphthongs and triphthongs]].
"es", -- Spanish has diphthongs, but they are transcribed with i̯ etc.
"fi", -- Finnish has diphthongs, but they are now automatically transcribed with
-- the nonsyllabic diacritic
"fr", -- French has diphthongs, but they are transcribed
-- with semivowel symbols: [[w:French phonology#Glides and diphthongs]].
"ka",
"kmr",
"ku",
"mk",
"mt", -- Maltese has diphthongs, but they are transcribed
-- with semivowel symbols.
"pl", -- No diphthongs, properly speaking; sequences of a vowel and /w/ or /j/ though.
"ru", -- No diphthongs, properly speaking; sequences of a vowel and /j/ though.
"sk", -- Slovak has rising diphthongs, /i̯e, i̯a, i̯u, u̯o/, which are probably always spelled with the nonsyllabic diacritic, so do not need to be listed.
"sl", -- No diphthongs, properly speaking; sequences of a vowel, /j/ and /w/ though
"sq", -- [[w:Albanian language#Vowels]] doesn't mention anything about diphthongs.
"ug", -- No diphthongs.
}
data.langs_to_generate_syllable_count_categories = {}
-- Convert the list in `langs_to_generate_syllable_count_categories` to a set.
for _, langcode in ipairs(langs_to_generate_syllable_count_categories) do
data.langs_to_generate_syllable_count_categories[langcode] = true
end
-- Also add languages listed under `data.diphthongs`.
for langcode, _ in pairs(data.diphthongs) do
data.langs_to_generate_syllable_count_categories[langcode] = true
end
-- Languages to use the phonetic not phonemic notation to compute syllables counts.
local langs_to_use_phonetic_notation = {
"es",
"mk",
"ru",
}
data.langs_to_use_phonetic_notation = {}
-- Convert the list in `langs_to_use_phonetic_notation` to a set.
for _, langcode in ipairs(langs_to_use_phonetic_notation) do
data.langs_to_use_phonetic_notation[langcode] = true
end
-- Non-standard or obsolete IPA symbols.
data.nonstandard = {
--[[ The following symbols consist of more than one character,
so we can't put them in the line below. ]]
"ɑ̢", "d̂", "t̂", "n̂", "l̂", "k̫", "ɔ̗", "ɔ̖",
"[ʦʣʧʤʨʥ?ƍσƺƪƻƾƞᶀᶁᶂᶃᶄᶅᶆᶈᶇᶉᶊᶋƫᶌᶍᶎʓʆλƛłščžǰǧǯẋᵻᵿⱻʚ"
.. "ɷωıȹȸ∅ØƥƭƈƙʠʇʗʖʞɩɼȣяɿʅʮʯᴀᴀᴇGRŒQȡȶȵȴKPT]"
}
-- See valid IPA characters at [[Module:IPA/data/symbols]].
data.phonemes = {}
data.phonemes["dz"] = {
"m", "n", "ŋ",
"p", "t", "ʈ", "k",
"pʰ", "tʰ", "ʈʰ", "kʰ",
"t͡s", "t͡ɕ",
"t͡sʰ", "t͡ɕʰ",
"w", "s", "z", "ɬ", "l", "r", "ɕ", "ʑ", "j", "h",
"ɑ", "e", "i", "o", "u",
"ɑː", "eː", "ɛː", "iː", "oː", "øː", "uː", "yː",
"ɑ˥", "e˥", "i˥", "o˥", "u˥",
"ɑː˥", "eː˥", "ɛː˥", "iː˥", "oː˥", "øː˥", "uː˥", "yː˥",
"m˥", "n˥", "ŋ˥", "p˥", "k˥", "k̚˥", "w˥", "l˥", "r˥", "ɕ˥", "j˥", ")˥",
"ɑ˩", "e˩", "i˩", "o˩", "u˩",
"ɑː˩", "eː˩", "ɛː˩", "iː˩", "oː˩", "øː˩", "uː˩", "yː˩",
"m˩", "n˩", "ŋ˩", "p˩", "k˩", "k̚˩", "w˩", "l˩", "r˩", "ɕ˩", "j˩", ")˩",
".", ",", "-",
}
data.phonemes["eo"] = {
"a", "b", "d", "d͡ʒ", "e", "f", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "r", "s", "t", "t͡s", "t͡ʃ",
"u", "v", "w", "x", "z", "ɡ", "ʃ", "ʒ",
"ˈ", ".", " ", "-",
}
data.phonemes["hy"] = {
"ɑ", "b", "ɡ", "d", "ɛ", "z", "ɛ", "ə", "tʰ", "ʒ", "i", "l", "χ", "t͡s",
"k", "h", "d͡z", "ʁ", "t͡ʃ", "m", "j", "n", "ʃ", "ɔ", "t͡ʃʰ", "p", "d͡ʒ",
"r", "s", "v", "t", "ɾ", "t͡sʰ", "v", "pʰ", "kʰ", "ɔ", "f", "ŋɡ", "ŋk",
"ŋχ", "u", "ˈ", "ˌ", ".", " ", "ː",
}
data.phonemes["nl"] = {
"m", "n", "ŋ",
"p", "b", "t", "d", "k", "ɡ",
"f", "v", "s", "z", "ʃ", "ʒ", "x", "ɣ", "ɦ",
"ʋ", "l", "j", "r",
"ɪ", "ʏ", "ɛ", "ə", "ɔ", "ɑ",
"i", "iː", "y", "yː", "u", "uː", "eː", "øː", "oː", "ɛː", "œː", "ɔː", "aː",
"ɛi̯", "œy̯", "ɔi̯", "ɑu̯", "ɑi̯",
"iu̯", "yu̯", "ui̯", "eːu̯", "oːi̯", "aːi̯",
"ˈ", "ˌ", ".", " ",
}
return data
84jgjvqkd6f56yaicj1wroxsm0makkb
Module:IPA/data/symbols
828
2960
8272
2022-07-21T18:45:11Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local data = {}
--[=[ Valid IPA symbols.
Currently almost all values of "title" and "link" keys
are just the comments that were used in [[Module:IPA]].
The "link" fields should be checked (those that start with an uppercase letter are checked). ]=]
local U = mw.ustring.char
data[1] = {
-- PULMONIC CONSONANTS
-- nasal
["m"] = {
title = "bilabial nasal",
link = "w:Bilabial nasal",
},
["ɱ"] = {
title = "labiodental nasal",
link = "w:Labiodental nasal",
},
["n"] = {
title = "alveolar nasal",
link = "w:Alveolar nasal",
},
["ɳ"] = {
title = "retroflex nasal",
link = "w:Retroflex nasal",
},
["ɲ"] = {
title = "palatal nasal",
link = "w:Palatal nasal",
},
["ŋ"] = {
title = "velar nasal",
link = "w:Velar nasal",
},
["ɴ"] = {
title = "uvular nasal",
link = "w:Uvular nasal",
},
-- plosive
["p"] = {
title = "voiceless bilabial plosive",
link = "w:Voiceless bilabial stop",
},
["b"] = {
title = "voiced bilabial plosive",
link = "w:Voiced bilabial stop",
},
["t"] = {
title = "voiceless alveolar plosive",
link = "w:Voiceless alveolar stop",
},
["d"] = {
title = "voiced alveolar plosive",
link = "w:Voiced alveolar stop",
},
["ʈ"] = {
title = "voiceless retroflex plosive",
link = "w:Voiceless retroflex stop",
},
["ɖ"] = {
title = "voiced retroflex plosive",
link = "w:Voiced retroflex stop",
},
["c"] = {
title = "voiceless palatal plosive",
link = "w:Voiceless palatal stop",
},
["ɟ"] = {
title = "voiced palatal plosive",
link = "w:Voiced palatal stop",
},
["k"] = {
title = "voiceless velar plosive",
link = "w:Voiceless velar stop",
},
["ɡ"] = {
title = "voiced velar plosive",
link = "w:Voiced velar stop",
},
["q"] = {
title = "voiceless uvular plosive",
link = "w:Voiceless uvular stop",
},
["ɢ"] = {
title = "voiced uvular plosive",
link = "w:Voiced uvular stop",
},
["ʡ"] = {
title = "epiglottal plosive",
link = "w:Epiglottal stop",
},
["ʔ"] = {
title = "glottal stop",
link = "w:Glottal stop",
},
-- fricative
["ɸ"] = {
title = "voiceless bilabial fricative",
link = "w:Voiceless bilabial fricative",
},
["β"] = {
title = "voiced bilabial fricative",
link = "w:Voiced bilabial fricative",
},
["f"] = {
title = "voiceless labiodental fricative",
link = "w:Voiceless labiodental fricative",
},
["v"] = {
title = "voiced labiodental fricative",
link = "w:Voiced labiodental fricative",
},
["θ"] = {
title = "voiceless dental fricative",
link = "w:Voiceless dental fricative",
},
["ð"] = {
title = "voiced dental fricative",
link = "w:Voiced dental fricative",
},
["s"] = {
title = "voiceless alveolar fricative",
link = "w:Voiceless alveolar fricative",
},
["z"] = {
title = "voiced alveolar fricative",
link = "w:Voiced alveolar fricative",
},
["ʃ"] = {
title = "voiceless postalveolar fricative",
link = "w:Voiceless palato-alveolar sibilant",
},
["ʒ"] = {
title = "voiced postalveolar fricative",
link = "w:Voiced palato-alveolar sibilant",
},
["ʂ"] = {
title = "voiceless retroflex fricative",
link = "w:Voiceless retroflex sibilant",
},
["ʐ"] = {
title = "voiced retroflex fricative",
link = "w:Voiced retroflex sibilant",
},
["ɕ"] = {
title = "voiceless alveolo-palatal fricative",
link = "w:Voiceless alveolo-palatal sibilant",
},
["ʑ"] = {
title = "voiced alveolo-palatal fricative",
link = "w:Voiced alveolo-palatal sibilant",
},
["ç"] = {
title = "voiceless palatal fricative",
link = "w:Voiceless palatal fricative",
},
["ʝ"] = {
title = "voiced palatal fricative",
link = "w:Voiced palatal fricative",
},
["x"] = {
title = "voiceless velar fricative",
link = "w:Voiceless velar fricative",
},
["ɣ"] = {
title = "voiced velar fricative",
link = "w:Voiced velar fricative",
},
["χ"] = {
title = "voiceless uvular fricative",
link = "w:Voiceless uvular fricative",
},
["ʁ"] = {
title = "voiced uvular fricative",
link = "w:Voiced uvular fricative",
},
["ħ"] = {
title = "voiceless pharyngeal fricative",
link = "w:Voiceless pharyngeal fricative",
},
["ʕ"] = {
title = "voiced pharyngeal fricative",
link = "w:Voiced pharyngeal fricative",
},
["ʜ"] = {
title = "voiceless epiglottal fricative",
link = "w:Voiceless epiglottal fricative",
},
["ʢ"] = {
title = "voiced epiglottal fricative",
link = "w:Voiced epiglottal fricative",
},
["h"] = {
title = "voiceless glottal fricative",
link = "w:Voiceless glottal fricative",
},
["ɦ"] = {
title = "voiced glottal fricative",
link = "w:Voiced glottal fricative",
},
-- approximant
["ʋ"] = {
title = "labiodental approximant",
link = "w:Labiodental approximant",
},
["ɹ"] = {
title = "alveolar approximant",
link = "w:Alveolar approximant",
},
["ɻ"] = {
title = "retroflex approximant",
link = "w:Retroflex approximant",
},
["j"] = {
title = "palatal approximant",
link = "w:Palatal approximant",
},
["ɰ"] = {
title = "velar approximant",
link = "w:Velar approximant",
},
-- tap, flap
["ⱱ"] = {
title = "labiodental tap",
link = "w:Labiodental flap",
},
["ɾ"] = {
title = "alveolar flap",
link = "w:Alveolar flap",
},
["ɽ"] = {
title = "retroflex flap",
link = "w:Retroflex flap",
},
-- trill
["ʙ"] = {
title = "bilabial trill",
link = "w:Bilabial trill",
},
["r"] = {
title = "alveolar trill",
link = "w:Alveolar trill",
},
["ʀ"] = {
title = "uvular trill",
link = "w:Uvular trill",
},
["ᴙ"] = {
title = "epiglottal trill",
link = "w:Epiglottal trill",
},
-- lateral fricative
["ɬ"] = {
title = "voiceless alveolar lateral fricative",
link = "w:Voiceless alveolar lateral fricative",
},
["ɮ"] = {
title = "voiced alveolar lateral fricative",
link = "w:Voiced alveolar lateral fricative",
},
-- no precomposed Unicode character --TOMOVE
--["ɬ̢"] = {title = "voiceless retroflex lateral fricative", link = "w:voiceless retroflex lateral fricative"},
-- no precomposed Unicode character --TOMOVE:3
--["ʎ̝̊"] = {title = "voiceless palatal lateral fricative", link = "w:voiceless palatal lateral fricative"},
-- no precomposed Unicode character --TOMOVE:3
--["ʟ̝̊"] = {title = "voiceless velar lateral fricative", link = "w:voiceless velar lateral fricative"},
-- no precomposed Unicode character --TOMOVE
--["ʟ̝"] = {title = "voiced velar lateral fricative", link = "w:voiced velar lateral fricative"},
-- lateral approximant
["l"] = {
title = "alveolar lateral approximant",
link = "w:Alveolar lateral approximant",
},
["ɭ"] = {
title = "retroflex lateral approximant",
link = "w:Retroflex lateral approximant",
},
["ʎ"] = {
title = "palatal lateral approximant",
link = "w:Palatal lateral approximant",
},
["ʟ"] = {
title = "velar lateral approximant",
link = "w:Velar lateral approximant",
},
-- lateral flap
["ɺ"] = {
title = "alveolar lateral flap",
link = "w:Alveolar lateral flap",
},
--["ɭ̆"] = {title = "retroflex lateral flap", link = "w:retroflex lateral flap"}, -- no precomposed Unicode character --TOMOVE
--["ɺ˞"] = {title = "retroflex lateral flap", link = "w:retroflex lateral flap"}, -- no precomposed Unicode character --TOMOVE
-- NON-PULMONIC CONSONANTS
-- clicks
["ʘ"] = {
title = "bilabial click",
link = "w:Bilabial clicks",
},
["ǀ"] = {
title = "dental click",
link = "w:Dental clicks",
},
["ǃ"] = {
title = "postalveolar click",
link = "w:Alveolar clicks",
},
["‼"] = {
title = "subapical retroflex",
link = "w:Retroflex clicks",
}, -- NOT IN X-SAMPA
["ǂ"] = {
title = "palatal click",
link = "w:Palatal clicks",
},
["ǁ"] = {
title = "alveolar lateral click",
link = "w:Lateral clicks",
},
-- implosives
["ɓ"] = {
title = "voiced bilabial implosive",
link = "w:Voiced bilabial implosive",
},
["ɗ"] = {
title = "voiced alveolar implosive",
link = "w:Voiced alveolar implosive",
},
-- NOT IN X-SAMPA
["ᶑ"] = {
title = "retroflex implosive",
link = "w:Voiced retroflex implosive",
},
["ʄ"] = {
title = "voiced palatal implosive",
link = "w:Voiced palatal implosive",
},
["ɠ"] = {
title = "voiced velar implosive",
link = "w:Voiced velar implosive",
},
["ʛ"] = {
title = "voiced uvular implosive",
link = "w:Voiced uvular implosive",
},
-- ejectives
["ʼ"] = {
title = "ejective",
link = "w:Ejective consonant",
},
-- CO-ARTICULATED CONSONANTS
["ʍ"] = {
title = "voiceless labial-velar fricative",
link = "w:Voiceless labio-velar approximant",
},
["w"] = {
title = "labial-velar approximant",
link = "w:Labio-velar approximant",
},
["ɥ"] = {
title = "labial-palatal approximant",
link = "w:Labialized palatal approximant",
},
["ɧ"] = {
title = "voiceless palatal-velar fricative",
link = "w:Sj-sound",
},
-- should be handled in [[Module:IPA]] and not through this table
-- BRACKETS
--[[
-- ["//"] = {
title = "morphophonemic",
link = "w:morphophonemic",
},
["/"] = {
title = "phonemic",
link = "w:phonemic",
},
["["] = {
title = "phonetic",
link = "w:phonetic",
},
["["] = {
title = "phonetic",
link = "w:phonetic",
},
["〈"] = {
title = "orthographic",
link = "w:orthographic",
},
["〉"] = {
title = "orthographic",
link = "w:orthographic",
},
["⟨"] = {
title = "orthographic",
link = "w:orthographic",
},
["⟩"] = {
title = "orthographic",
link = "w:orthographic",
},
]]
-- VOWELS
-- close
["i"] = {
title = "close front unrounded vowel",
link = "w:Close front unrounded vowel",
},
["y"] = {
title = "close front rounded vowel",
link = "w:Close front rounded vowel",
},
["ɨ"] = {
title = "close central unrounded vowel",
link = "w:Close central unrounded vowel",
},
["ʉ"] = {
title = "close central rounded vowel",
link = "w:Close central rounded vowel",
},
["ɯ"] = {
title = "close back unrounded vowel",
link = "w:Close back unrounded vowel",
},
["u"] = {
title = "close back rounded vowel",
link = "w:Close back rounded vowel",
},
-- near close
["ɪ"] = {
title = "near-close near-front unrounded vowel",
link = "w:Near-close near-front unrounded vowel",
},
["ʏ"] = {
title = "near-close near-front rounded vowel",
link = "w:Near-close near-front rounded vowel",
},
["ᵻ"] = {
title = "near-close central unrounded vowel",
link = "w:Near-close central unrounded vowel",
},
-- (alternative) --TOMOVE
--[[
["ɪ̈"] = {
title = "near-close central unrounded vowel",
link = "w:near-close central unrounded vowel",
}, ]]
["ᵿ"] = {
title = "near-close central rounded vowel",
link = "w:Near-close central rounded vowel",
},
--[[
(alternative) TOMOVE
["ʊ̈"] = {
title = "near-close central rounded vowel",
link = "w:near-close central rounded vowel",
},
]]
["ʊ"] = {
title = "near-close near-back rounded vowel",
link = "w:Near-close near-back rounded vowel",
},
--close mid
["e"] = {
title = "close-mid front unrounded vowel",
link = "w:Close-mid front unrounded vowel",
},
["ø"] = {
title = "close-mid front rounded vowel",
link = "w:Close-mid front rounded vowel",
},
["ɘ"] = {
title = "close-mid central unrounded vowel",
link = "w:Close-mid central unrounded vowel",
},
["ɵ"] = {
title = "close-mid central rounded vowel",
link = "w:Close-mid central rounded vowel",
},
["ɤ"] = {
title = "close-mid back unrounded vowel",
link = "w:Close-mid back unrounded vowel",
},
["o"] = {
title = "close-mid back rounded vowel",
link = "w:Close-mid back rounded vowel",
},
-- mid
["ə"] = {
title = "schwa",
link = "w:Schwa",
},
["ɚ"] = {
title = "schwa+r",
link = "w:R-colored vowel",
},
-- open mid
["ɛ"] = {
title = "open-mid front unrounded vowel",
link = "w:Open-mid front unrounded vowel",
},
["œ"] = {
title = "open-mid front rounded vowel",
link = "w:Open-mid front rounded vowel",
},
["ɜ"] = {
title = "open-mid central unrounded vowel",
link = "w:Open-mid central unrounded vowel",
},
["ɝ"] = {
title = "open-mid central unrounded vowel+r",
link = "w:R-colored vowel",
},
["ɞ"] = {
title = "open-mid central rounded vowel",
link = "w:Open-mid central rounded vowel",
},
["ʌ"] = {
title = "open-mid back unrounded vowel",
link = "w:Open-mid back unrounded vowel",
},
["ɔ"] = {
title = "open-mid back rounded vowel",
link = "w:Open-mid back rounded vowel",
},
-- near open
["æ"] = {
title = "near-open front unrounded vowel",
link = "w:Near-open front unrounded vowel",
},
["ɐ"] = {
title = "near-open central vowel",
link = "w:Near-open central vowel",
},
-- open
["a"] = {
title = "open front unrounded vowel",
link = "w:Open front unrounded vowel",
},
["ɶ"] = {
title = "open front rounded vowel",
link = "w:Open front rounded vowel",
},
["ɑ"] = {
title = "open back unrounded vowel",
link = "w:Open back unrounded vowel",
},
["ɒ"] = {
title = "open back rounded vowel",
link = "w:Open back rounded vowel",
},
-- SUPRASEGMENTALS
["ˈ"] = {title = "primary stress", link = "w:Stress (linguistics)", XSAMPA = "\""},
--[[
["???"] = {
title = "extra stress: no Unicode char; double primary stress instead",
link = "w:extra stress: no Unicode char; double primary stress instead",
XSAMPA = ""
}, --TOMOVE:3 ]]
["ˌ"] = {
title = "secondary stress",
link = "w:Secondary stress",
},
["ː"] = {
title = "long",
link = "w:Length (phonetics)",
},
["ˑ"] = {
title = "half long",
link = "w:Length (phonetics)",
},
["̆"] = {
title = "extra-short",
link = "w:Length (phonetics)",
},
--[[
["%."] = {
title = "syllable break",
link = "w:syllable break",
},
]]
--TOMOVE
["‿"] = {
title = "linking mark (absence of a break)",
link = "w:Tie (typography)#International_Phonetic_Alphabet",
},
[" "] = {
title = "separator",
link = "w:separator",
},
-- TONE
-- level tones
["˥"] = {
title = "top",
link = "w:Tone letter",
},
["˦"] = {
title = "high",
link = "w:Tone letter",
},
["˧"] = {
title = "mid",
link = "w:Tone letter",
},
["˨"] = {
title = "low",
link = "w:Tone letter",
},
["˩"] = {
title = "bottom",
link = "w:Tone letter",
},
["̋"] = {
title = "extra high tone",
link = "w:Tone letter",
},
["́"] = {
title = "high tone",
link = "w:Tone letter",
},
["̄"] = {
title = "mid tone",
link = "w:Tone letter",
},
["̀"] = {
title = "low tone",
link = "w:Tone letter",
},
["̏"] = {
title = "extra low tone",
link = "w:Tone letter",
},
-- tone terracing
["ꜛ"] = {
title = "upstep",
link = "w:Upstep",
},
["ꜜ"] = {
title = "downstep",
link = "w:Downstep",
},
-- contour tones
["̌"] = {
title = "rising tone",
link = "w:Tone (linguistics)",
},
["̂"] = {
title = "falling tone",
link = "w:Tone (linguistics)",
},
["᷄"] = {
title = "high rising tone",
link = "w:Tone (linguistics)",
},
["᷅"] = {
title = "low rising tone",
link = "w:Tone (linguistics)",
},
["᷇"] = {
title = "high falling tone",
link = "w:Tone (linguistics)",
},
["᷆"] = {
title = "low falling tone",
link = "w:Tone (linguistics)",
},
["᷈"] = {
title = "rising falling tone (peaking)",
link = "w:Tone (linguistics)",
},
["᷉"] = {
title = "dipping",
link = "w:Tone (linguistics)",
}, -- [extrapolated from the chart -- please confirm]
-- intonation
["|"] = {
title = "minor (foot) group",
link = "w:Prosodic unit",
},
["‖"] = {
title = "major (intonation) group",
link = "w:Prosodic unit",
},
["↗"] = {
title = "global rise",
link = "w:Intonation (linguistics)",
},
["↘"] = {
title = "global fall",
link = "w:Intonation (linguistics)",
},
-- DIACRITICS
-- syllabicity & releases
["̩"] = {
title = "syllabi ",
link = "w:Syllabic consonant",
withdescender = "̍"
}, -- (or "_="
["̯"] = {
title = "non-syllabic",
link = "w:Semivowel",
withdescender = "̑"
},
["ʰ"] = {
title = "aspirated",
link = "w:Aspirated consonant",
},
["ⁿ"] = {
title = "nasal release",
link = "w:Nasal release",
},
["ˡ"] = {
title = "lateral release",
link = "w:Lateral release (phonetics)",
},
["̚"] = {
title = "no audible release",
link = "w:No audible release",
},
-- phonation
["̥"] = {
title = "voiceless",
link = "w:Voicelessness",
withdescender = "̊"
},
["̬"] = {
title = "voiced",
link = "w:Voice (phonetics)",
},
["̤"] = {
title = "breathy voice",
link = "w:Breathy voice",
},
["̰"] = {
title = "creaky voice",
link = "w:Creaky voice",
},
["᷽"] = {
title = "strident",
link = "w:Strident vowel",
},
-- primary articulation
["̪"] = {
title = "dental",
link = "w:Dental consonant",
},
["̺"] = {
title = "apical",
link = "w:Apical consonant",
},
["̻"] = {
title = "laminal",
link = "w:Laminal consonant",
},
["̟"] = {
title = "advanced",
link = "w:Relative articulation#Advanced_and_retracted",
withdescender = "˖"
},
["̠"] = {
title = "retracted",
link = "w:Relative articulation#Retracted",
withdescender = "˗"
},
["̼"] = {
title = "linguolabial",
link = "w:Linguolabial consonant",
},
["̈"] = {
title = "centralized",
link = "w:Relative articulation#Centralized_vowels",
XSAMPA = "_\""
},
["̽"] = {
title = "mid-centralized",
link = "Relative articulation#Mid-centralized_vowel",
},
["̞"] = {
title = "lowered",
link = "w:Relative articulation#Raised_and_lowered",
withdescender = "˕"
},
["̝"] = {
title = "raised",
link = "w:Relative articulation#Raised_and_lowered",
withdescender = "˔"
},
["͡"] = {
title = "coarticulated",
link = "w:Co-articulated consonant",
},
["͈"] = {
title = "strong articulation",
link = "w:Fortis and lenis",
},
-- secondary articulation
["ʷ"] = {
title = "labialized",
link = "w:Labialization",
},
["ʲ"] = {
title = "palatalized",
link = "w:Palatalization (phonetics)",
},
["ˠ"] = {
title = "velarized",
link = "w:Velarization",
},
["ˤ"] = {
title = "pharyngealized",
link = "w:Pharyngealization",
},
-- also see _e
["ɫ"] = {
title = "velarized alveolar lateral approximant",
link = "w:Alveolar lateral approximant",
},
["̴"] = {
title = "velarized or pharyngealized; also see 5",
link = "w:Velarization",
},
["̹"] = {
title = "more rounded",
link = "w:Roundedness",
},
["̜"] = {
title = "less rounded",
link = "w:Roundedness",
},
["̃"] = {
title = "nasalization",
link = "w:Nasalization",
},
["˞"] = {
title = "rhotacization in vowels, retroflexion in consonants",
link = "w:R-colored vowel",
},
["̘"] = {
title = "advanced tongue root",
link = "w:Advanced and retracted tongue root",
},
["̙"] = {
title = "retracted tongue root",
link = "w:Advanced and retracted tongue root",
},
}
data[2] = {
-- TODO
--["%("] = {},
--["%)"] = {},
["ːː"] = {
title = "extra long",
link = "w:Length (phonetics)",
},
["r̥"] = {title = "voiceless alveolar trill", link = "w:Voiceless alveolar trill"},
["ɬ’"] = {title = "alveolar lateral ejective fricative", link = "w:Alveolar lateral ejective fricative"},
}
data[3] = {
["t͡s"] = {title = "voiceless alveolar sibilant affricate", link = "w:Voiceless alveolar affricate"},
["d͡z"] = {title = "voiced alveolar sibilant affricate", link = "w:Voiced alveolar affricate"},
["t͡ʃ"] = {title = "voiceless palato-alveolar affricate", link = "w:Voiceless palato-alveolar affricate", descender = true},
["d͡ʒ"] = {title = "voiced palato-alveolar affricate", link = "w:Voiced palato-alveolar affricate"},
["ʈ͡ʂ"] = {title = "voiceless retroflex affricate", link = "w:Voiceless retroflex affricate", descender = true},
["ɖ͡ʐ"] = {title = "voiced retroflex affricate", link = "w:Voiced retroflex affricate, descender = true"},
["t͡ɕ"] = {title = "voiceless alveolo-palatal affricate", link = "w:Voiceless alveolo-palatal affricate"},
["d͡ʑ"] = {title = "voiced alveolo-palatal affricate", link = "w:Voiced alveolo-palatal affricate"},
["c͡ç"] = {title = "voiceless palatal affricate", link = "w:Voiceless palatal affricate, descender = true"},
["ɟ͡ʝ"] = {title = "voiced palatal affricate", link = "w:Voiced palatal affricate, descender = true"},
["k͡x"] = {title = "voiceless velar affricate", link = "w:Voiceless velar affricate"},
["ɡ͡ɣ"] = {title = "voiced velar affricate", link = "w:Voiced velar affricate, descender = true"},
}
data[4] = {
["ǃ͡qʼ"] = {title = "alveolar linguo-glottalic stop", link = "w:Ejective-contour clicks, descender = true"},
["ǁ͡χʼ"] = {title = "lateral linguo-glottalic affricate (homorganic)", link = "w:Ejective-contour clicks", descender = true},
}
data[5] = {
["k͡ʟ̝̊"] = {title = "voiceless velar lateral affricate", link = "w:Voiceless velar lateral affricate"},
["ᶢǀ͡qʼ"] = {title = "voiced dental linguo-glottalic stop", link = "w:Ejective-contour clicks"},
["ǂ͡kxʼ"] = {title = "palatal linguo-glottalic affricate (heterorganic)", link = "w:Ejective-contour clicks"},
}
data[6] = {
["k͡ʟ̝̊ʼ"] = {title = "velar lateral ejective affricate", link = "w:Velar lateral ejective affricate"},
["ᶢʘ͡kxʼ"] = {title = "voiced labial linguo-glottalic affricate", link = "w:Ejective-contour clicks"},
}
-- acute and grave tone marks
data["diacritics"] =
-- grave, acute, circumflex, tilde, macron, breve
U(0x300) .. U(0x301) .. U(0x302) .. U(0x303) .. U(0x304) .. U(0x306)
-- diaeresis, ring above, double acute, caron, vertical line above, double grave, left tack
.. U(0x308) .. U(0x30A) .. U(0x30B) .. U(0x30C) .. U(0x30D) .. U(0x30F) .. U(0x318)
-- right tack, left angle, left half ring below, up tack below, down tack below, plus sign below
.. U(0x319) .. U(0x31A) .. U(0x31C) .. U(0x31D) .. U(0x31E) .. U(0x31F)
-- minus sign below, rhotic hook below, dot below, diaeresis below, ring below, vertical line below, bridge below
.. U(0x320) .. U(0x322) .. U(0x323) .. U(0x324) .. U(0x325) .. U(0x329) .. U(0x32A)
-- caron below, inverted breve below
.. U(0x32C) .. U(0x32F)
-- tilde below, right half ring below, inverted bridge below, square below, seagull below, x above
.. U(0x330) .. U(0x339) .. U(0x33A) .. U(0x33B) .. U(0x33C) .. U(0x33D)
-- grave tone mark, acute tone mark, bridge above, equals sign below, double vertical line below
.. U(0x340) .. U(0x341) .. U(0x346) .. U(0x347) .. U(0x348)
-- left angle below, not tilde above, homothetic above, almost equal above, left right arrow below
.. U(0x349) .. U(0x34A) .. U(0x34B) .. U(0x34C) .. U(0x34D)
-- upwards arrow below, left arrowhead below, right arrowhead below
.. U(0x34E) .. U(0x354) .. U(0x355)
-- double rightwards arrow below, combining Latin small letter a
.. U(0x362) .. U(0x361)
-- macron–acute, grave–macron, macron–grave, acute–macron, grave–acute–grave, acute–grave–acute
.. U(0x1DC4) .. U(0x1DC5) .. U(0x1DC6) .. U(0x1DC7) .. U(0x1DC8) .. U(0x1DC9)
data["tones"] = '˥˦˧˨˩꜒꜓꜔꜕꜖꜈꜉꜊꜋꜌꜍꜎꜏꜐꜑¹²³⁴⁵⁶⁷⁸⁹⁰'
data["vowels"] = 'iyɨʉɯuɪʏʊeøɘɵɤoəɚɛœɜɝɞʌɔæɐaɶɑɒäëïöüÿ'
data["superscripts"] = '¹²³⁴⁵⁶⁷⁸⁹⁰ᵝʰʱʲʳʴʵʶʷʸ˞ˠˡˢꟹᶣᶬᶮᶯᶰᶹˀˤⁿᵇᵈᶢ'
data["valid"] =
U(0xA0) .. ' %(%)%%{%|%}%-~⁓.◌abcdefhijklmnopqrstuvwxyz¡àáâãāăēäæçèéêëĕěħìíîïĩīĭĺḿǹńňðòóôõöōŏőœøŕùúûüũūŭűýÿŷŋ'
.. 'ǀǁǂǃǎǐǒǔřǖǘǚǜǟǣǽǿȁȅȉȍȕȫȭȳɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɪɫɬɭɮɯɰɱɲɳɴɵɶɸɹɺɻɽɾʀʁʂʃʄʈʉʊʋṽʌʍʎʏʐʑʒʔʕʘʙʛʜʝʟʡʢʬʭ⁻'
.. 'ʼˈˌːˑˣ˔˕ˬ͗˭ˇ˖β͜θχᴙᵄᵊᵏᵐᵑᶑ᷽ḁḛḭḯṍṏṳṵṹṻạẹẽịọụỳỵỹ‖․‥…‼‿↑↓↗↘ⱱꜛꜜꟸ𝆏𝆑˗'
.. data.diacritics .. data.tones .. data.superscripts
-- Characters to add VARIATION SELECTOR-15 (U+FE0E) after.
-- These are characters with emoji variants that are used by default by some clients.
-- Adding VS15 after them instructs them to draw the characters as text instead.
data["add_vs15"] = "‼↗↘"
data["suggestions"] = {
["g"] = "ɡ",
["'"] = "ˈ",
[""] = "",
[":"] = "ː",
["ˁ"] = "ˤ",
["ǝ"] = "ə",
["ә"] = "ə",
-- Syllabic fricatives
["ɿ"] = "z̩",
["ʅ"] = "ʐ̩",
["ʮ"] = "z̩ʷ",
["ʯ"] = "ʐ̩ʷ",
["Ɂ"] = "ʔ",
-- Deprecated symbols
["ɩ"] = "ɪ",
["ɷ"] = "ʊ",
["ᴜ"] = "ʊ",
["ʣ"] = "d͡z",
["ʤ"] = "d͡ʒ",
["ʥ"] = "d͡ʑ",
["ʦ"] = "t͡s",
["ʧ"] = "t͡ʃ",
["ʨ"] = "t͡ɕ",
["ʪ"] = "ɬ͡s",
["ʫ"] = "ɮ͡z",
-- Greek letters
["α"] = "ɑ",
["γ"] = "ɣ",
["δ"] = "ð",
["ε"] = "ɛ",
["η"] = "ŋ",
["ι"] = "ɪ",
["λ"] = "ʎ",
["υ"] = "ʋ",
["ϕ"] = "ɸ",
}
return data
l6c8uo6m5gekbgfrnfm2rgm0oimzcpv
Template:anagrams
10
2961
8273
2022-07-21T18:47:47Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{#invoke:anagrams|show}}<noinclude>{{documentation}}</noinclude>
kg1a16fgo89h5sdb2yvhvikoic4a4nt
Module:anagrams
828
2962
8274
2022-07-21T18:50:10Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local m_languages = require("Module:languages")
local m_links = require("Module:links")
local export = {}
function export.show(frame)
local params = {
[1] = {required = true, default = "und"},
[2] = {required = true, default = "anagram", list = true},
["a"] = {required = false},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = m_languages.getByCode(args[1], 1)
for i, val in ipairs(args[2]) do
args[2][i] = m_links.full_link({lang = lang, term = val})
end
local result = table.concat(args[2], ", ")
return result
end
return export
4pvv0g03a2puivhmifj4zefgo5v2cny
Template:en-proper noun
10
2963
8275
2022-07-21T18:53:23Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{#invoke:en-headword|show|proper nouns}}<!--
-->{{#ifeq:{{{given}}}|yes<!--
-->|<!--
-->{{catlangname|en|given names}}<!--
-->|<!--
-->{{#ifeq:{{{surname}}}|yes<!--
-->|<!--
-->{{catlangname|en|surnames}}<!--
-->}}<!--
-->}}<!--
--><noinclude>{{documentation}}</noinclude>
nz68p4h0poh457bydz0cteiv3orvkgd
Module:en-headword
828
2964
8276
2022-07-21T18:57:05Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("en")
local PAGENAME = mw.title.getCurrentTitle().text
local function glossary_link(entry, text)
text = text or entry
return "[[Appendix:Glossary#" .. entry .. "|" .. text .. "]]"
end
local function track(page)
require("Module:debug").track("en-headword/" .. page)
return true
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local params = {
["head"] = {list = true},
["suff"] = {type = "boolean"},
["sort"] = {},
}
local pos_data = pos_functions[poscat]
if pos_data then
for key, val in pairs(pos_data.params) do
params[key] = val
end
end
local args, unknown_args = require("Module:parameters").process(frame:getParent().args, params, pos_data.return_unknown)
if unknown_args and next(unknown_args) then
track("unknown args")
track("unknown args/POS/" .. tostring(poscat))
for parameter, value in pairs(unknown_args) do
track("unknown args/param/" .. tostring(parameter))
mw.log("unknown parameter in [[Module:headword]]: |" .. tostring(parameter) .. "=" .. tostring(value))
end
end
local data = {lang = lang, pos_category = poscat, categories = {}, heads = args["head"], inflections = {}}
if #data.heads == 0 and args.pagename then
table.insert(data.heads, args.pagename)
end
if args["suff"] then
data.pos_category = "suffixes"
if poscat == "adjectives" or poscat == "adverbs" or poscat == "nouns" or poscat == "verbs" then
table.insert(data.categories, ("%s %s-forming suffixes")
:format(lang:getCanonicalName(), poscat:gsub("s$", "")))
else
error("No category exists for suffixes forming " .. poscat .. ".")
end
end
if pos_data then
pos_data.func(args, data)
end
local extra_categories = {}
if PAGENAME:find("[Qq][^Uu]") or PAGENAME:find("[Qq]$") then
table.insert(data.categories, lang:getCanonicalName() .. " words containing Q not followed by U")
end
if PAGENAME:find("([A-Za-z])%1%1") then
table.insert(data.categories, lang:getCanonicalName() .. " words containing three consecutive instances of the same letter")
end
if PAGENAME:find("([A-Za-z])%1%1%1") then
table.insert(data.categories, lang:getCanonicalName() .. " words containing four consecutive instances of the same letter")
end
-- mw.ustring.toNFD performs decomposition, so letters that decompose
-- to an ASCII vowel and a diacritic, such as é, are counted as vowels and
-- do not need to be included in the pattern.
if not mw.ustring.find(mw.ustring.lower(mw.ustring.toNFD(PAGENAME)), "[aeiouyæœø]") then
table.insert(data.categories, lang:getCanonicalName() .. " words without vowels")
end
if PAGENAME:find("yre$") then
table.insert(data.categories, lang:getCanonicalName() .. ' words ending in "-yre"')
end
if not PAGENAME:find(" ") and mw.ustring.len(PAGENAME) >= 25 then
table.insert(extra_categories, "Long " .. lang:getCanonicalName() .. ' words')
end
if PAGENAME:find("^[^aeiou ]*a[^aeiou ]*e[^aeiou ]*i[^aeiou ]*o[^aeiou ]*u[^aeiou ]*$") then
table.insert(data.categories, lang:getCanonicalName() .. ' words that use all vowels in alphabetical order')
end
data.sort_key = args.sort
return require("Module:headword").full_headword(data)
.. (#extra_categories > 0
and require("Module:utilities").format_categories(extra_categories, lang, args.sort)
or "")
end
-- This function does the common work between adjectives and adverbs
function make_comparatives(params, data)
local comp_parts = {label = glossary_link("comparative"), accel = {form = "comparative"}}
local sup_parts = {label = glossary_link("superlative"), accel = {form = "superlative"}}
if #params == 0 then
table.insert(params, {"more"})
end
-- To form the stem, replace -(e)y with -i and remove a final -e.
local stem = PAGENAME:gsub("([^aeiou])e?y$", "%1i"):gsub("e$", "")
-- Go over each parameter given and create a comparative and superlative form
for i, val in ipairs(params) do
local comp = val[1]
local comp_qual = val[2]
local sup = val[3]
local sup_qual = val[4]
local comp_part, sup_part
if comp == "more" and PAGENAME ~= "many" and PAGENAME ~= "much" then
comp_part = "[[more]] " .. PAGENAME
sup_part = "[[most]] " .. PAGENAME
elseif comp == "further" and PAGENAME ~= "far" then
comp_part = "[[further]] " .. PAGENAME
sup_part = "[[furthest]] " .. PAGENAME
elseif comp == "er" then
comp_part = stem .. "er"
sup_part = stem .. "est"
elseif comp == "-" or sup == "-" then
-- Allowing '-' makes it more flexible to not have some forms
if comp ~= "-" then
comp_part = comp
end
if sup ~= "-" then
sup_part = sup
end
else
-- If the full comparative was given, but no superlative, then
-- create it by replacing the ending -er with -est.
if not sup then
if comp:find("er$") then
sup = comp:gsub("er$", "est")
else
error("The superlative of \"" .. comp .. "\" cannot be generated automatically. Please provide it with the \"sup" .. (i == 1 and "" or i) .. "=\" parameter.")
end
end
comp_part = comp
sup_part = sup
end
if comp_part then
table.insert(comp_parts, {term = comp_part, qualifiers = {comp_qual}})
end
if sup_part then
table.insert(sup_parts, {term = sup_part, qualifiers = {sup_qual}})
end
end
table.insert(data.inflections, comp_parts)
table.insert(data.inflections, sup_parts)
end
pos_functions["adjectives"] = {
params = {
[1] = {list = true, allow_holes = true},
["comp_qual"] = {list = "comp=_qual", allow_holes = true},
["sup"] = {list = true, allow_holes = true},
["sup_qual"] = {list = "sup=_qual", allow_holes = true},
},
func = function(args, data)
local shift = 0
local is_not_comparable = false
local is_comparative_only = false
-- If the first parameter is ?, then don't show anything, just return.
if args[1][1] == "?" then
return
-- If the first parameter is -, then move all parameters up one position.
elseif args[1][1] == "-" then
shift = 1
is_not_comparable = true
-- If the only argument is +, then remember this and clear parameters
elseif args[1][1] == "+" and args[1].maxindex == 1 then
shift = 1
is_comparative_only = true
end
-- Gather all the comparative and superlative parameters.
local params = {}
for i = 1, args[1].maxindex - shift do
local comp = args[1][i + shift]
local comp_qual = args["comp_qual"][i + shift]
local sup = args["sup"][i]
local sup_qual = args["sup_qual"][i + shift]
if comp or sup then
table.insert(params, {comp, comp_qual, sup, sup_qual})
end
end
if shift == 1 then
-- If the first parameter is "-" but there are no parameters,
-- then show "not comparable" only and return.
-- If there are parameters, then show "not generally comparable"
-- before the forms.
if #params == 0 then
if is_not_comparable then
table.insert(data.inflections, {label = "not " .. glossary_link("comparable")})
table.insert(data.categories, lang:getCanonicalName() .. " uncomparable adjectives")
return
end
if is_comparative_only then
table.insert(data.inflections, {label = glossary_link("comparative") .. " form only"})
table.insert(data.categories, lang:getCanonicalName() .. " comparative-only adjectives")
return
end
else
table.insert(data.inflections, {label = "not generally " .. glossary_link("comparable")})
end
end
-- Process the parameters
make_comparatives(params, data)
end
}
pos_functions["adverbs"] = {
params = {
[1] = {list = true, allow_holes = true},
["comp_qual"] = {list = "comp=_qual", allow_holes = true},
["sup"] = {list = true, allow_holes = true},
["sup_qual"] = {list = "sup=_qual", allow_holes = true},
},
func = function(args, data)
local shift = 0
-- If the first parameter is ?, then don't show anything, just return.
if args[1][1] == "?" then
return
-- If the first parameter is -, then move all parameters up one position.
elseif args[1][1] == "-" then
shift = 1
end
-- Gather all the comparative and superlative parameters.
local params = {}
for i = 1, args[1].maxindex - shift do
local comp = args[1][i + shift]
local comp_qual = args["comp_qual"][i + shift]
local sup = args["sup"][i]
local sup_qual = args["sup_qual"][i + shift]
if comp or sup then
table.insert(params, {comp, comp_qual, sup, sup_qual})
end
end
if shift == 1 then
-- If the first parameter is "-" but there are no parameters,
-- then show "not comparable" only and return. If there are parameters,
-- then show "not generally comparable" before the forms.
if #params == 0 then
table.insert(data.inflections, {label = "not " .. glossary_link("comparable")})
table.insert(data.categories, lang:getCanonicalName() .. " uncomparable adverbs")
return
else
table.insert(data.inflections, {label = "not generally " .. glossary_link("comparable")})
end
end
-- Process the parameters
make_comparatives(params, data)
end
}
pos_functions["conjunctions"] = {
params = {
[1] = { alias_of = "head" },
},
return_unknown = true,
func = function (args, data)
end,
}
pos_functions["interjections"] = {
params = {
[1] = { alias_of = "head" },
},
return_unknown = true,
func = function (args, data)
end,
}
local function default_plural(noun)
local new_pl
if noun:find("[sxz]$") or noun:find("[cs]h$") then
new_pl = noun .. "es"
elseif noun:find("[^aeiou]y$") then
new_pl = noun:gsub("y$", "i") .. "es"
else
new_pl = noun .. "s"
end
return new_pl
end
local function canonicalize_plural(pl, stem)
if pl == "s" then
return stem .. "s"
elseif pl == "es" then
return stem .. "es"
elseif pl == "+" then
return default_plural(PAGENAME)
else
return nil
end
end
pos_functions["nouns"] = {
params = {
[1] = {list = true, allow_holes = true},
["pl=qual"] = { list = true, allow_holes = true },
},
func = function(args, data)
-- Gather all the plural parameters from the numbered parameters.
local plurals = {}
for i = 1, args[1].maxindex do
local pl = args[1][i]
if pl then
local qual = args["plqual"][i]
if qual then
table.insert(plurals, {term = pl, qualifiers = {qual}})
else
table.insert(plurals, pl)
end
end
end
-- Decide what to do next...
local mode = nil
if plurals[1] == "?" or plurals[1] == "!" or plurals[1] == "-" or plurals[1] == "~" then
mode = plurals[1]
table.remove(plurals, 1) -- Remove the mode parameter
end
-- Plural is unknown
if mode == "?" then
table.insert(data.categories, lang:getCanonicalName() .. " nouns with unknown or uncertain plurals")
return
-- Plural is not attested
elseif mode == "!" then
table.insert(data.inflections, {label = "plural not attested"})
table.insert(data.categories, lang:getCanonicalName() .. " nouns with unattested plurals")
return
-- Uncountable noun; may occasionally have a plural
elseif mode == "-" then
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
-- If plural forms were given explicitly, then show "usually"
if #plurals > 0 then
table.insert(data.inflections, {label = "usually " .. glossary_link("uncountable")})
table.insert(data.categories, lang:getCanonicalName() .. " countable nouns")
else
table.insert(data.inflections, {label = glossary_link("uncountable")})
end
-- Mixed countable/uncountable noun, always has a plural
elseif mode == "~" then
table.insert(data.inflections, {label = glossary_link("countable") .. " and " .. glossary_link("uncountable")})
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
table.insert(data.categories, lang:getCanonicalName() .. " countable nouns")
-- If no plural was given, add a default one now
if #plurals == 0 then
plurals = {default_plural(PAGENAME)}
end
-- The default, always has a plural
else
table.insert(data.categories, lang:getCanonicalName() .. " countable nouns")
-- If no plural was given, add a default one now
if #plurals == 0 then
plurals = {default_plural(PAGENAME)}
end
end
-- If there are no plurals to show, return now
if #plurals == 0 then
return
end
-- There are plural forms to show, so show them
local pl_parts = {label = "plural", accel = {form = "p"}}
local function check_ies(pl, stem)
local newplural, nummatches = stem:gsub("([^aeiou])y$","%1ies")
return nummatches > 0 and pl == newplural
end
local stem = PAGENAME
local irregular = false
for i, pl in ipairs(plurals) do
local canon_pl = canonicalize_plural(pl, stem)
if canon_pl then
table.insert(pl_parts, canon_pl)
elseif type(pl) == "table" then
canon_pl = canonicalize_plural(pl.term, stem)
if canon_pl then
table.insert(pl_parts, {term=canon_pl, qualifiers=pl.qualifiers})
end
end
if not canon_pl then
table.insert(pl_parts, pl)
if type(pl) == "table" then
pl = pl.term
end
if not stem:find(" ") and not (pl == stem .. "s" or pl == stem .. "es" or check_ies(pl, stem)) then
irregular = true
if pl == stem then
table.insert(data.categories, lang:getCanonicalName() .. " indeclinable nouns")
end
end
end
end
if irregular then
table.insert(data.categories, lang:getCanonicalName() .. " nouns with irregular plurals")
end
table.insert(data.inflections, pl_parts)
end
}
pos_functions["proper nouns"] = {
params = {
[1] = {list = true},
},
func = function(args, data)
local plurals = args[1]
-- Decide what to do next...
local mode = nil
if plurals[1] == "?" or plurals[1] == "!" or plurals[1] == "-" or plurals[1] == "~" then
mode = plurals[1]
table.remove(plurals, 1) -- Remove the mode parameter
end
-- Plural is unknown
if mode == "?" then
table.insert(data.categories, lang:getCanonicalName() .. " proper nouns with unknown or uncertain plurals")
return
-- Plural is not attested
elseif mode == "!" then
table.insert(data.inflections, {label = "plural not attested"})
table.insert(data.categories, lang:getCanonicalName() .. " proper nouns with unattested plurals")
return
-- Uncountable noun; may occasionally have a plural
elseif mode == "-" then
-- If plural forms were given explicitly, then show "usually"
if #plurals > 0 then
table.insert(data.inflections, {label = "usually " .. glossary_link("uncountable")})
table.insert(data.categories, lang:getCanonicalName() .. " countable proper nouns")
else
table.insert(data.inflections, {label = glossary_link("uncountable")})
end
-- Mixed countable/uncountable noun, always has a plural
elseif mode == "~" then
table.insert(data.inflections, {label = glossary_link("countable") .. " and " .. glossary_link("uncountable")})
table.insert(data.categories, lang:getCanonicalName() .. " countable proper nouns")
-- If no plural was given, add a default one now
if #plurals == 0 then
plurals = {"s"}
end
elseif #plurals > 0 then
table.insert(data.categories, lang:getCanonicalName() .. " countable proper nouns")
end
-- If there are no plurals to show, return now
if #plurals == 0 then
return
end
-- There are plural forms to show, so show them
local pl_parts = {label = "plural", accel = {form = "p"}}
local stem = PAGENAME
for i, pl in ipairs(plurals) do
if pl == "s" then
table.insert(pl_parts, stem .. "s")
elseif pl == "es" then
table.insert(pl_parts, stem .. "es")
else
table.insert(pl_parts, pl)
end
end
table.insert(data.inflections, pl_parts)
end
}
local function base_default_verb_forms(verb)
local s_form = default_plural(verb)
local ing_form, ed_form
local vowel = "aeiouáéíóúàèìòùâêîôûäëïöüæœø"
local ulvowel = vowel .. "AEIOUÁÉÍÓÚÀÈÌÒÙÂÊÎÔÛÄËÏÖÜÆŒØ"
-- (1) Check for C*VC verbs.
--
-- flip -> flipping/flipped, strum -> strumming/strummed, nag -> nagging/nagged, etc.
-- Do not include words with final -y, e.g. 'stay' (staying/stayed), 'toy' (toying/toyed),
-- or with final -w, e.g. 'flow' (flowing/flowed), or with final -h, e.g. 'ah' (ahing/ahed),
-- or with final -x, e.g. 'box' (boxing/boxed), or ending in an uppercase consonant,
-- e.g. 'XOR' (XORing/XORed), 'OK' (OKing/OKed). Check specially for initial y- as a consonant,
-- e.g. 'yip' (yipping/yipped), otherwise treat y as a vowel, so we don't trigger on 'hyphen'
-- but do trigger on 'gyp'.
local last_cons = mw.ustring.match(verb, "^[Yy][" .. vowel .. "y]([^A-Z" .. vowel .. "ywxh])$")
if not last_cons then
last_cons = mw.ustring.match(verb, "^[^" .. ulvowel .. "yY]*[" .. ulvowel .. "yY]([^A-Z" .. vowel .. "ywxh])$")
end
if last_cons then
ing_form = verb .. last_cons .. "ing"
ed_form = verb .. last_cons .. "ed"
else
-- (2) Generate -ing form.
-- (2a) lie -> lying, untie -> untying, etc.
local stem = verb:match("^(.*)ie$")
if stem then
ing_form = stem .. "ying"
else
-- (2b) argue -> arguing, sprue -> spruing, dialogue -> dialoguing, etc.
stem = verb:match("^(.*)ue$")
if stem then
ing_form = stem .. "uing"
else
stem = mw.ustring.match(verb, "^(.*[" .. ulvowel .. "yY][^" .. vowel .. "y]+)e$")
if stem then
-- (2c) baptize -> baptizing, rake -> raking, type -> typing, parse -> parsing, etc.
-- (ending in vowel + consonant(s) + -e); but not referee -> refereeing,
-- backhoe -> backhoeing, redye -> redyeing (ending in some other vowel + -e or in -ye);
-- and not be -> being (no vowel before the consonant preceding the -e)
ing_form = stem .. "ing"
else
-- (2d) regular verbs
ing_form = verb .. "ing"
end
end
end
-- (3) Generate -ed form.
if verb:find("e$") then
-- (3a) baptize -> baptized, rake -> raked, parse -> parsed, free -> freed, hoe -> hoed
ed_form = verb .. "d"
else
stem = mw.ustring.match(verb, "^(.*[^" .. ulvowel .. "yY])y$")
if stem then
-- (3b) marry -> married, levy -> levied, try -> tried, etc.; but not toy -> toyed
ed_form = stem .. "ied"
else
-- (3c) regular verbs
ed_form = verb .. "ed"
end
end
end
return s_form, ing_form, ed_form
end
local function default_verb_forms(verb)
local full_s_form, full_ing_form, full_ed_form = base_default_verb_forms(verb)
if verb:find(" ") then
local first, rest = verb:match("^(.-)( .*)$")
local first_s_form, first_ing_form, first_ed_form = base_default_verb_forms(first)
return full_s_form, full_ing_form, full_ed_form, first_s_form .. rest, first_ing_form .. rest, first_ed_form .. rest
else
return full_s_form, full_ing_form, full_ed_form, nil, nil, nil
end
end
pos_functions["verbs"] = {
params = {
[1] = {list = "pres_3sg", allow_holes = true},
["pres_3sg_qual"] = {list = "pres_3sg=_qual", allow_holes = true},
[2] = {list = "pres_ptc", allow_holes = true},
["pres_ptc_qual"] = {list = "pres_ptc=_qual", allow_holes = true},
[3] = {list = "past", allow_holes = true},
["past_qual"] = {list = "past=_qual", allow_holes = true},
[4] = {list = "past_ptc", allow_holes = true},
["past_ptc_qual"] = {list = "past_ptc=_qual", allow_holes = true},
["pagename"] = {}, -- for testing
},
func = function(args, data)
-- Get parameters
local par1 = args[1][1]
local par2 = args[2][1]
local par3 = args[3][1]
local par4 = args[4][1]
local pres_3sgs, pres_ptcs, pasts, past_ptcs
local pagename = args.pagename or PAGENAME
------------------------------------------- UTILITY FUNCTIONS #1 ------------------------------------------
-- These functions are used directly in the <> format as well as in the utility functions #2 below.
local function compute_double_last_cons_stem(verb)
local last_cons = verb:match("([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])$")
if not last_cons then
error("Verb stem '" .. verb .. "' must end in a consonant to use ++")
end
return verb .. last_cons
end
local function compute_plusplus_s_form(verb, default_s_form)
if verb:find("[sz]$") then
-- regas -> regasses, derez -> derezzes
return compute_double_last_cons_stem(verb) .. "es"
else
return default_s_form
end
end
------------------------------------------- UTILITY FUNCTIONS #2 ------------------------------------------
-- These functions are used in both in the separate-parameter format and in the override params such as past_ptc2=.
local new_default_s, new_default_ing, new_default_ed, split_default_s, split_default_ing, split_default_ed =
default_verb_forms(pagename)
local function compute_double_last_cons_stem_of_split_verb(verb, ending)
local first, rest = verb:match("^(.-)( .*)$")
if not first then
error("Verb '" .. verb .. "' must have a space in it to use ++*")
end
local last_cons = first:match("([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])$")
if not last_cons then
error("First word '" .. first .. "' must end in a consonant to use ++*")
end
return first .. last_cons .. ending .. rest
end
local function check_non_nil_star_form(form)
if form == nil then
error("Verb '" .. pagename .. "' must have a space in it to use * or ++*")
end
return form
end
local function sub_tilde(form)
if not form then
return nil
end
local retval = form:gsub("~", pagename) -- discard second return value
return retval
end
local function canonicalize_s_form(form)
if form == "+" then
return new_default_s
elseif form == "*" then
return check_non_nil_star_form(split_default_s)
elseif form == "++" then
return compute_plusplus_s_form(pagename, new_default_s)
elseif form == "++*" then
if pagename:find("^[^ ]*[sz] ") then
return compute_double_last_cons_stem_of_split_verb(pagename, "es")
else
return check_non_nil_star_form(split_default_s)
end
else
return sub_tilde(form)
end
end
local function canonicalize_ing_form(form)
if form == "+" then
return new_default_ing
elseif form == "*" then
return check_non_nil_star_form(split_default_ing)
elseif form == "++" then
return compute_double_last_cons_stem(pagename) .. "ing"
elseif form == "++*" then
return compute_double_last_cons_stem_of_split_verb(pagename, "ing")
else
return sub_tilde(form)
end
end
local function canonicalize_ed_form(form)
if form == "+" then
return new_default_ed
elseif form == "*" then
return check_non_nil_star_form(split_default_ed)
elseif form == "++" then
return compute_double_last_cons_stem(pagename) .. "ed"
elseif form == "++*" then
return compute_double_last_cons_stem_of_split_verb(pagename, "ed")
else
return sub_tilde(form)
end
end
--------------------------------- MAIN PARSING/CONJUGATING CODE --------------------------------
local past_ptcs_given
if par1 and par1:find("<") then
-------------------------- ANGLE-BRACKET FORMAT --------------------------
if par2 or par3 or par4 then
error("Can't specify 2=, 3= or 4= when 1= contains angle brackets: " .. par1)
end
-- In the angle bracket format, we always copy the full past tense specs to the past participle
-- specs if none of the latter are given, so act as if the past participle is always given.
-- There is a separate check to see if the past tense and past participle are identical, in any case.
past_ptcs_given = true
local iut = require("Module:inflection utilities")
-- (1) Parse the indicator specs inside of angle brackets.
local function parse_indicator_spec(angle_bracket_spec)
local inside = angle_bracket_spec:match("^<(.*)>$")
assert(inside)
local segments = iut.parse_balanced_segment_run(inside, "[", "]")
local comma_separated_groups = iut.split_alternating_runs(segments, ",")
if #comma_separated_groups > 4 then
error("Too many comma-separated parts in indicator spec: " .. angle_bracket_spec)
end
local function fetch_qualifiers(separated_group)
local qualifiers
for j = 2, #separated_group - 1, 2 do
if separated_group[j + 1] ~= "" then
error("Extraneous text after bracketed qualifiers: '" .. table.concat(separated_group) .. "'")
end
if not qualifiers then
qualifiers = {}
end
table.insert(qualifiers, separated_group[j])
end
return qualifiers
end
local function fetch_specs(comma_separated_group)
if not comma_separated_group then
return {{}}
end
local specs = {}
local colon_separated_groups = iut.split_alternating_runs(comma_separated_group, ":")
for _, colon_separated_group in ipairs(colon_separated_groups) do
local form = colon_separated_group[1]
if form == "*" or form == "++*" then
error("* and ++* not allowed inside of indicator specs: " .. angle_bracket_spec)
end
if form == "" then
form = nil
end
table.insert(specs, {form = form, qualifiers = fetch_qualifiers(colon_separated_group)})
end
return specs
end
local s_specs = fetch_specs(comma_separated_groups[1])
local ing_specs = fetch_specs(comma_separated_groups[2])
local ed_specs = fetch_specs(comma_separated_groups[3])
local en_specs = fetch_specs(comma_separated_groups[4])
for _, spec in ipairs(s_specs) do
if spec.form == "++" and #ing_specs == 1 and not ing_specs[1].form and not ing_specs[1].qualifiers
and #ed_specs == 1 and not ed_specs[1].form and not ed_specs[1].qualifiers then
ing_specs[1].form = "++"
ed_specs[1].form = "++"
break
end
end
return {
forms = {},
s_specs = s_specs,
ing_specs = ing_specs,
ed_specs = ed_specs,
en_specs = en_specs,
}
end
local parse_props = {
parse_indicator_spec = parse_indicator_spec,
}
local alternant_multiword_spec = iut.parse_inflected_text(par1, parse_props)
-- (2) Remove any links from the lemma, but remember the original form
-- so we can use it below in the 'lemma_linked' form.
iut.map_word_specs(alternant_multiword_spec, function(base)
if base.lemma == "" then
base.lemma = pagename
end
base.orig_lemma = base.lemma
base.lemma = require("Module:links").remove_links(base.lemma)
end)
-- (3) Conjugate the verbs according to the indicator specs parsed above.
local all_verb_slots = {
lemma = "infinitive",
lemma_linked = "infinitive",
s_form = "3|s|pres",
ing_form = "pres|ptcp",
ed_form = "past",
en_form = "past|ptcp",
}
local function conjugate_verb(base)
local def_s_form, def_ing_form, def_ed_form = base_default_verb_forms(base.lemma)
local function process_specs(slot, specs, default_form, canonicalize_plusplus)
for _, spec in ipairs(specs) do
local form = spec.form
if not form or form == "+" then
form = default_form
elseif form == "++" then
form = canonicalize_plusplus()
end
-- If there's a ~ in the form, substitute it with the lemma,
-- but make sure to first replace % in the lemma with %% so that
-- it doesn't get interpreted as a capture replace expression.
if form:find("~") then
-- Assign to a var because gsub returns multiple values.
local subbed_lemma = base.lemma:gsub("%%", "%%%%")
form = form:gsub("~", subbed_lemma)
end
-- If the form is -, don't insert any forms, which will result
-- in there being no overall forms (in fact it will be nil).
-- We check for that down below and substitute a single "-" as
-- the form, which in turn gets turned into special labels like
-- "no present participle".
if form ~= "-" then
iut.insert_form(base.forms, slot, {form = form, footnotes = spec.qualifiers})
end
end
end
process_specs("s_form", base.s_specs, def_s_form,
function() return compute_plusplus_s_form(base.lemma, def_s_form) end)
process_specs("ing_form", base.ing_specs, def_ing_form,
function() return compute_double_last_cons_stem(base.lemma) .. "ing" end)
process_specs("ed_form", base.ed_specs, def_ed_form,
function() return compute_double_last_cons_stem(base.lemma) .. "ed" end)
-- If the -en spec is completely missing, substitute the -ed spec in its entirely.
-- Otherwise, if individual -en forms are missing or use +, we will substitute the
-- default -ed form, as with the -ed spec.
local en_specs = base.en_specs
if #en_specs == 1 and not en_specs[1].form and not en_specs[1].qualifiers then
en_specs = base.ed_specs
end
process_specs("en_form", en_specs, def_ed_form,
function() return compute_double_last_cons_stem(base.lemma) .. "ed" end)
iut.insert_form(base.forms, "lemma", {form = base.lemma})
-- Add linked version of lemma for use in head=. We write this in a general fashion in case
-- there are multiple lemma forms (which isn't possible currently at this level, although it's
-- possible overall using the ((...,...)) notation).
iut.insert_forms(base.forms, "lemma_linked", iut.map_forms(base.forms.lemma, function(form)
if form == base.lemma and base.orig_lemma:find("%[%[") then
return base.orig_lemma
else
return form
end
end))
end
local inflect_props = {
slot_table = all_verb_slots,
inflect_word_spec = conjugate_verb,
}
iut.inflect_multiword_or_alternant_multiword_spec(alternant_multiword_spec, inflect_props)
-- (4) Fetch the forms and put the conjugated lemmas in data.heads if not explicitly given.
local function fetch_forms(slot)
local forms = alternant_multiword_spec.forms[slot]
-- See above. This should only occur if the user explicitly used -
-- for a spec.
if not forms or #forms == 0 then
forms = {{form = "-"}}
end
return forms
end
pres_3sgs = fetch_forms("s_form")
pres_ptcs = fetch_forms("ing_form")
pasts = fetch_forms("ed_form")
past_ptcs = fetch_forms("en_form")
-- Use the "linked" form of the lemma as the head if no head= explicitly given.
-- If no links in this form and it has multiple words, autolink the individual words.
-- The user can override this using head=.
if #data.heads == 0 then
for _, lemma_obj in ipairs(alternant_multiword_spec.forms.lemma_linked) do
local lemma = lemma_obj.form
if not lemma:find("%[%[") then
local m_headword = require("Module:headword")
if m_headword.head_is_multiword(lemma) then
lemma = m_headword.add_multiword_links(lemma)
end
end
table.insert(data.heads, lemma)
end
end
else
-------------------------- SEPARATE-PARAM FORMAT --------------------------
local pres_3sg, pres_ptc, past
if par1 and not par2 and not par3 then
-- Use of a single parameter other than "++", "*" or "++*" is now the "legacy" format,
-- and no longer supported.
if par1 == "es" or par1 == "ies" or par1 == "d" then
error("Legacy parameter 1=es/ies/d no longer supported, just use 'en-verb' without params")
elseif par1 == "++" or par1 == "*" or par1 == "++*" then
pres_3sg = canonicalize_s_form(par1)
pres_ptc = canonicalize_ing_form(par1)
past = canonicalize_ed_form(par1)
else
error("Legacy parameter 1=STEM no longer supported, just use 'en-verb' without params")
end
else
if par3 then
track("xxx3")
elseif par2 then
track("xxx2")
end
end
if not pres_3sg or not pres_ptc or not past then
-- Either all three should be set above, or none of them.
assert(not pres_3sg and not pres_ptc and not past)
if par1 then
pres_3sg = canonicalize_s_form(par1)
else
pres_3sg = new_default_s
end
if par2 then
pres_ptc = canonicalize_ing_form(par2)
else
pres_ptc = new_default_ing
end
if par3 then
past = canonicalize_ed_form(par3)
else
past = new_default_ed
end
end
if par4 then
past_ptcs_given = true
past_ptc = canonicalize_ed_form(par4)
else
past_ptc = past
end
pres_3sgs = {{form = pres_3sg}}
pres_ptcs = {{form = pres_ptc}}
pasts = {{form = past}}
past_ptcs = {{form = past_ptc}}
end
------------------------------------------- HANDLE OVERRIDES ------------------------------------------
local pres_3sg_infls, pres_ptc_infls, past_infls, past_ptc_infls
local function strip_brackets(qualifiers)
if not qualifiers then
return nil
end
local stripped_qualifiers = {}
for _, qualifier in ipairs(qualifiers) do
local stripped_qualifier = qualifier:match("^%[(.*)%]$")
if not stripped_qualifier then
error("Internal error: Qualifier should be surrounded by brackets at this stage: " .. qualifier)
end
table.insert(stripped_qualifiers, stripped_qualifier)
end
return stripped_qualifiers
end
local function collect_forms(label, accel_form, defaults, overrides, override_qualifiers, canonicalize)
if defaults[1].form == "-" then
return {label = "no " .. label}
else
local into_table = {label = label, accel = {form = accel_form}}
local maxindex = math.max(#defaults, overrides.maxindex)
local qualifiers = override_qualifiers[1] and {override_qualifiers[1]} or strip_brackets(defaults[1].footnotes)
table.insert(into_table, {term = defaults[1].form, qualifiers = qualifiers})
-- Present 3rd singular
for i = 2, maxindex do
local override_form = canonicalize(overrides[i])
if override_form then
-- If there is an override such as past_ptc2=..., only use the qualifier specified
-- using an override (past_ptc2_qual=...), if any; it doesn't make sense to combine
-- an override form with a qualifier specified inside of angle brackets.
table.insert(into_table, {term = override_form, qualifiers = {override_qualifiers[i]}})
elseif defaults[i] then
-- If the form comes from inside angle brackets, allow any override qualifier
-- (past_ptc2_qual=...) to override any qualifier specified inside of angle brackets.
-- FIXME: Maybe we should throw an error here if both exist.
local qualifiers = override_qualifiers[i] and {override_qualifiers[i]} or strip_brackets(defaults[i].footnotes)
table.insert(into_table, {term = defaults[i].form, qualifiers = qualifiers})
end
end
return into_table
end
end
local pres_3sg_infls = collect_forms("third-person singular simple present", "3|s|pres",
pres_3sgs, args[1], args.pres_3sg_qual, canonicalize_s_form)
local pres_ptc_infls = collect_forms("present participle", "pres|ptcp",
pres_ptcs, args[2], args.pres_ptc_qual, canonicalize_ing_form)
local past_infls = collect_forms("simple past", "past",
pasts, args[3], args.past_qual, canonicalize_ed_form)
local past_ptc_infls = collect_forms("past participle", "past|ptcp",
past_ptcs, args[4], args.past_ptc_qual, canonicalize_ed_form)
-- Are the past forms identical to the past participle forms? If so, we use a single
-- combined "simple past and past participle" label on the past tense forms.
-- We check for two conditions: Either no past participle forms were given at all, or
-- they were given but are identical in every way (all forms and qualifiers) to the past
-- tense forms. The former "no explicit past participle forms" check is important in the
-- "separate-parameter" format; if past tense overrides are given and no past participle
-- forms given, the past tense overrides should apply to the past participle as well.
-- In the angle-bracket format, it's expected that all forms and qualifiers are specified
-- using that format, and we explicitly copy past tense forms and qualifiers to past
-- participle ones if the latter are omitted, so we disable to "no explicit past participle
-- forms" check.
if args[4].maxindex > 0 or args.past_ptc_qual.maxindex > 0 then
past_ptcs_given = true
end
local identical = true
-- For the past and past participle to be identical, there must be
-- the same number of inflections, and each inflection must match
-- in term and qualifiers.
if #past_infls ~= #past_ptc_infls then
identical = false
else
for key, val in ipairs(past_infls) do
if past_ptc_infls[key].term ~= val.term then
identical = false
break
else
local quals1 = past_ptc_infls[key].qualifiers
local quals2 = val.qualifiers
if (not not quals1) ~= (not not quals2) then
-- one is nil, the other is not
identical = false
elseif quals1 and quals2 then
-- qualifiers present in both; each qualifier must match
if #quals1 ~= #quals2 then
identical = false
else
for k, v in ipairs(quals1) do
if v ~= quals2[k] then
identical = false
break
end
end
end
end
if not identical then
break
end
end
end
end
-- Insert the forms
table.insert(data.inflections, pres_3sg_infls)
table.insert(data.inflections, pres_ptc_infls)
if not past_ptcs_given or identical then
if past_ptcs[1].form == "-" then
past_infls.label = "no simple past or past participle"
else
past_infls.label = "simple past and past participle"
past_infls.accel = {form = "past|and|past|ptcp"}
end
table.insert(data.inflections, past_infls)
else
table.insert(data.inflections, past_infls)
table.insert(data.inflections, past_ptc_infls)
end
end
}
return export
6dsxm87ymuyut1g18bydur83dkkd2ec
Module:headword
828
2965
8277
2022-07-21T19:00:34Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local m_data = mw.loadData("Module:headword/data")
local title = mw.title.getCurrentTitle()
local isLemma = m_data.lemmas
local isNonLemma = m_data.nonlemmas
local notranslit = m_data.notranslit
local toBeTagged = m_data.toBeTagged
-- If set to true, categories always appear, even in non-mainspace pages
local test_force_categories = false
local function test_script(text, script_code)
if type(text) == "string" and type(script_code) == "string" then
local sc = require("Module:scripts").getByCode(script_code)
local characters
if sc then
characters = sc:getCharacters()
end
local out
if characters then
text = mw.ustring.gsub(text, "%W", "")
out = mw.ustring.find(text, "[" .. characters .. "]")
end
if out then
return true
else
return false
end
else
mw.log("Parameters to test_script were incorrect.")
return nil
end
end
local spacingPunctuation = "[%s%p]+"
--[[ List of punctuation or spacing characters that are found inside of words.
Used to exclude characters from the regex above. ]]
local wordPunc = "-־׳״'.·*’་•"
local notWordPunc = "[^" .. wordPunc .. "]+"
-- Return true if the given head is multiword according to the algorithm used
-- in full_headword().
function export.head_is_multiword(head)
for possibleWordBreak in mw.ustring.gmatch(head, spacingPunctuation) do
if mw.ustring.find(possibleWordBreak, notWordPunc) then
return true
end
end
return false
end
-- Add links to a multiword head.
function export.add_multiword_links(head)
local function workaround_to_exclude_chars(s)
return mw.ustring.gsub(s, notWordPunc, "]]%1[[")
end
head = "[["
.. mw.ustring.gsub(
head,
spacingPunctuation,
workaround_to_exclude_chars
)
.. "]]"
--[=[
use this when workaround is no longer needed:
head = "[["
.. mw.ustring.gsub(head, WORDBREAKCHARS, "]]%1[[")
.. "]]"
Remove any empty links, which could have been created above
at the beginning or end of the string.
]=]
head = mw.ustring.gsub(head, "%[%[%]%]", "")
return head
end
local function non_categorizable()
return (title:inNamespace("") and title.text:find("^Unsupported titles/"))
or (title:inNamespace("Appendix") and title.text:find("^Gestures/"))
end
local function preprocess(data, postype)
--[=[
[[Special:WhatLinksHere/Template:tracking/headword/heads-not-table]]
[[Special:WhatLinksHere/Template:tracking/headword/translits-not-table]]
]=]
if type(data.heads) ~= "table" then
if data.heads then
require("Module:debug/track")("headword/heads-not-table")
end
data.heads = { data.heads }
end
if type(data.translits) ~= "table" then
if data.translits then
require("Module:debug/track")("headword/translits-not-table")
end
data.translits = { data.translits }
end
if type(data.transcriptions) ~= "table" then
if data.transcriptions then
require("Module:debug/track")("headword/transcriptions-not-table")
end
data.transcriptions = { data.transcriptions }
end
if not data.heads or #data.heads == 0 then
data.heads = {""}
end
-- Determine if term is reconstructed
local is_reconstructed = data.lang:getType() == "reconstructed"
or title.nsText == "Reconstruction"
-- Create a default headword.
local subpagename = title.subpageText
local pagename = title.text
local default_head
if is_reconstructed then
default_head = require("Module:utilities").plain_gsub(pagename, data.lang:getCanonicalName() .. "/", "")
else
default_head = subpagename
end
local unmodified_default_head = default_head
-- Add links to multi-word page names when appropriate
if data.lang:getCode() ~= "zh" and (not is_reconstructed) and
export.head_is_multiword(default_head) then
default_head = export.add_multiword_links(default_head)
end
if is_reconstructed then
default_head = "*" .. default_head
end
-- If a head is the empty string "", then replace it with the default
for i, head in ipairs(data.heads) do
if head == "" then
head = default_head
else
if head == default_head and data.lang:getCanonicalName() == "English" then
table.insert(data.categories, data.lang:getCanonicalName() .. " terms with redundant head parameter")
end
end
data.heads[i] = head
end
-- If the first head is multiword (after removing links), maybe insert into "LANG multiword terms"
if not data.nomultiwordcat and postype == "lemma" and not m_data.no_multiword_cat[data.lang:getCode()] then
-- Check for spaces or hyphens, but exclude prefixes and suffixes.
-- Use the pagename, not the head= value, because the latter may have extra
-- junk in it, e.g. superscripted text that throws off the algorithm.
local checkpattern = ".[%s%-፡]."
if m_data.hyphen_not_multiword_sep[data.lang:getCode()] then
-- Exclude hyphens if the data module states that they should for this language
checkpattern = ".[%s፡]."
end
if mw.ustring.find(unmodified_default_head, checkpattern) and not non_categorizable() then
table.insert(data.categories, data.lang:getCanonicalName() .. " multiword terms")
end
end
--[[ Try to detect the script if it was not provided
We use the first headword for this, and assume
that all of them have the same script
This *should* always be true, right? ]]
if not data.sc then
data.sc = require("Module:scripts").findBestScript(data.heads[1], data.lang)
end
for i, val in pairs(data.translits) do
data.translits[i] = {display = val, is_manual = true}
end
-- Make transliterations
for i, head in ipairs(data.heads) do
local translit = data.translits[i]
-- Try to generate a transliteration if necessary
-- Generate it if the script is not Latn or similar, and if no transliteration was provided
if translit and translit.display == "-" then
translit = nil
elseif not translit and not (data.sc:getCode():find("Latn", nil, true) or data.sc:getCode() == "Latinx" or data.sc:getCode() == "None") and (not data.sc or data.sc:getCode() ~= "Imag") then
translit = data.lang:transliterate(require("Module:links").remove_links(head), data.sc)
-- There is still no transliteration?
-- Add the entry to a cleanup category.
if not translit and not notranslit[data.lang:getCode()] then
translit = "<small>transliteration needed</small>"
table.insert(data.categories, "Requests for transliteration of " .. data.lang:getCanonicalName() .. " terms")
end
if translit then
translit = {display = translit, is_manual = false}
end
end
-- Link to the transliteration entry for languages that require this
if translit and data.lang:link_tr() then
translit.display = require("Module:links").full_link{
term = translit.display,
lang = data.lang,
sc = require("Module:scripts").getByCode("Latn"),
tr = "-"
}
end
data.translits[i] = translit
end
if data.id and type(data.id) ~= "string" then
error("The id in the data table should be a string.")
end
end
-- Format a headword with transliterations
local function format_headword(data)
local m_scriptutils = require("Module:script utilities")
-- Are there non-empty transliterations?
-- Need to do it this way because translit[1] might be nil while translit[2] is not
local has_translits = false
local has_manual_translits = false
-- Format the headwords
for i, head in ipairs(data.heads) do
if data.translits[i] or data.transcriptions[i] then
has_translits = true
end
if data.translits[i] and data.translits[i].is_manual or data.transcriptions[i] then
has_manual_translits = true
end
-- Apply processing to the headword, for formatting links and such
if head:find("[[", nil, true) and (not data.sc or data.sc:getCode() ~= "Imag") then
head = require("Module:links").language_link({term = head, lang = data.lang}, false)
end
-- Add language and script wrapper
if i == 1 then
head = m_scriptutils.tag_text(head, data.lang, data.sc, "head", nil, data.id)
else
head = m_scriptutils.tag_text(head, data.lang, data.sc, "head", nil)
end
data.heads[i] = head
end
local translits_formatted = ""
if has_manual_translits then
-- [[Special:WhatLinksHere/Template:tracking/headword/has-manual-translit/LANG]]
require("Module:debug/track")("headword/has-manual-translit/" .. data.lang:getCode())
end
if has_translits then
-- Format the transliterations
local translits = data.translits
local transcriptions = data.transcriptions
if translits then
-- using pairs() instead of ipairs() in case there is a gap
for i, _ in pairs(translits) do
if type(i) == "number" then
translits[i] = m_scriptutils.tag_translit(translits[i].display, data.lang:getCode(), "head", nil, translits[i].is_manual)
end
end
end
if transcriptions then
for i, _ in pairs(transcriptions) do
if type(i) == "number" then
transcriptions[i] = m_scriptutils.tag_transcription(transcriptions[i], data.lang:getCode(), "head")
end
end
end
for i = 1, math.max(#translits, #transcriptions) do
local translits_formatted = {}
table.insert(translits_formatted, translits[i] and translits[i] or "")
table.insert(translits_formatted, (translits[i] and transcriptions[i]) and " " or "")
table.insert(translits_formatted, transcriptions[i] and "/" .. transcriptions[i] .. "/" or "")
data.translits[i] = table.concat(translits_formatted)
end
translits_formatted = " (" .. table.concat(data.translits, " <i>or</i> ") .. ")"
local transliteration_page = mw.title.new(data.lang:getCanonicalName() .. " transliteration", "Wiktionary")
if transliteration_page then
local success, exists = pcall(function () return transliteration_page.exists end)
if success and exists then
translits_formatted = " [[Wiktionary:" .. data.lang:getCanonicalName() .. " transliteration|•]]" .. translits_formatted
end
end
end
return table.concat(data.heads, " <i>or</i> ") .. translits_formatted
end
local function format_genders(data)
if data.genders and #data.genders > 0 then
local pos_for_cat
if not data.nogendercat and not m_data.no_gender_cat[data.lang:getCode()] then
local pos_category = data.pos_category:gsub("^reconstructed ", "")
pos_for_cat = m_data.pos_for_gender_number_cat[pos_category]
end
local text, cats = require("Module:gender and number").format_genders(data.genders, data.lang, pos_for_cat)
for _, cat in ipairs(cats) do
table.insert(data.categories, cat)
end
return " " .. text
else
return ""
end
end
local function format_inflection_parts(data, parts)
for key, part in ipairs(parts) do
if type(part) ~= "table" then
part = {term = part}
end
local qualifiers
local reftext
if part.qualifiers and #part.qualifiers > 0 then
qualifiers = require("Module:qualifier").format_qualifier(part.qualifiers) .. " "
-- [[Special:WhatLinksHere/Template:tracking/headword/qualifier]]
require("Module:debug/track")("headword/qualifier")
end
if part.refs and #part.refs > 0 then
local refs = {}
for _, ref in ipairs(part.refs) do
if type(ref) ~= "table" then
ref = {text = ref}
end
local refargs
if ref.name or ref.group then
refargs = {name = ref.name, group = ref.group}
end
table.insert(refs, mw.getCurrentFrame():extensionTag("ref", ref.text, refargs))
end
reftext = table.concat(refs)
end
local partaccel = part.accel
local face = part.hypothetical and "hypothetical" or "bold"
local nolink = part.hypothetical or part.nolink
if part.label then
-- There should be a better way of italicizing a label. As is, this isn't customizable.
part = "<i>" .. part.label .. "</i>"
else
-- Convert the term into a full link
-- Don't show a transliteration here, the consensus seems to be not to
-- show them in headword lines to avoid clutter.
part = require("Module:links").full_link(
{
term = not nolink and part.term or nil,
alt = part.alt or (nolink and part.term or nil),
lang = part.lang or data.lang,
sc = part.sc or parts.sc or (not part.lang and data.sc),
id = part.id,
genders = part.genders,
tr = part.translit or (not (parts.enable_auto_translit or data.inflections.enable_auto_translit) and "-" or nil),
ts = part.transcription,
accel = parts.accel or partaccel,
},
face,
false
)
end
if qualifiers then
part = qualifiers .. part
end
if reftext then
part = part .. reftext
end
parts[key] = part
end
local parts_output = ""
if #parts > 0 then
parts_output = " " .. table.concat(parts, " <i>or</i> ")
elseif parts.request then
parts_output = " <small>[please provide]</small>"
.. require("Module:utilities/format_categories")(
{"Requests for inflections in " .. data.lang:getCanonicalName() .. " entries"},
lang,
nil,
nil,
data.force_cat_output or test_force_categories,
data.sc
)
end
return "<i>" .. parts.label .. "</i>" .. parts_output
end
-- Format the inflections following the headword
local function format_inflections(data)
if data.inflections and #data.inflections > 0 then
-- Format each inflection individually
for key, infl in ipairs(data.inflections) do
data.inflections[key] = format_inflection_parts(data, infl)
end
return " (" .. table.concat(data.inflections, ", ") .. ")"
else
return ""
end
end
-- Return "lemma" if the given POS is a lemma, "non-lemma form" if a non-lemma form, or nil
-- if unknown. The POS passed in must be in its plural form ("nouns", "prefixes", etc.).
-- If you have a POS in its singular form, call pluralize() in [[Module:string utilities]] to
-- pluralize it in a smart fashion that knows when to add '-s' and when to add '-es'.
--
-- If `best_guess` is given and the POS is in neither the lemma nor non-lemma list, guess
-- based on whether it ends in " forms"; otherwise, return nil.
function export.pos_lemma_or_nonlemma(plpos, best_guess)
-- Is it a lemma category?
if isLemma[plpos] or isLemma[plpos:gsub("^reconstructed ", "")] then
return "lemma"
-- Is it a nonlemma category?
elseif isNonLemma[plpos]
or isNonLemma[plpos:gsub("^reconstructed ", "")]
or isLemma[plpos:gsub("^mutated ", "")]
or isNonLemma[plpos:gsub("^mutated ", "")] then
return "non-lemma form"
elseif best_guess then
return plpos:find(" forms$") and "non-lemma form" or "lemma"
else
return nil
end
end
local function show_headword_line(data)
local namespace = title.nsText
-- Check the namespace against the language type
if namespace == "" then
if data.lang:getType() == "reconstructed" then
error("Entries for this language must be placed in the Reconstruction: namespace.")
elseif data.lang:getType() == "appendix-constructed" then
error("Entries for this language must be placed in the Appendix: namespace.")
end
end
local tracking_categories = {}
if not data.noposcat then
local pos_category = data.lang:getCanonicalName() .. " " .. data.pos_category
if pos_category ~= "Translingual Han characters" then
table.insert(data.categories, 1, pos_category)
end
end
if data.sccat and data.sc then
table.insert(data.categories, data.lang:getCanonicalName() .. " " .. data.pos_category
.. " in " .. data.sc:getDisplayForm())
end
-- Is it a lemma category?
local postype = export.pos_lemma_or_nonlemma(data.pos_category)
if not postype then
-- We don't know what this category is, so tag it with a tracking category.
--[=[
[[Special:WhatLinksHere/Template:tracking/headword/unrecognized pos]]
]=]
table.insert(tracking_categories, "head tracking/unrecognized pos")
require("Module:debug/track"){
"headword/unrecognized pos",
"headword/unrecognized pos/lang/" .. data.lang:getCode(),
"headword/unrecognized pos/pos/" .. data.pos_category
}
elseif not data.noposcat then
table.insert(data.categories, 1, data.lang:getCanonicalName() .. " " .. postype .. "s")
end
-- Preprocess
preprocess(data, postype)
if namespace == "" and data.lang:getType() ~= "reconstructed" then
local m_links = require("Module:links")
for _, head in ipairs(data.heads) do
if title.prefixedText ~= m_links.getLinkPage(m_links.remove_links(head), data.lang) then
--[=[
[[Special:WhatLinksHere/Template:tracking/headword/pagename spelling mismatch]]
]=]
require("Module:debug/track"){
"headword/pagename spelling mismatch",
"headword/pagename spelling mismatch/" .. data.lang:getCode()
}
break
end
end
end
-- Format and return all the gathered information
return
format_headword(data) ..
format_genders(data) ..
format_inflections(data) ..
require("Module:utilities/format_categories")(
tracking_categories, data.lang, data.sort_key, nil,
data.force_cat_output or test_force_categories, data.sc
)
end
function export.full_headword(data)
local tracking_categories = {}
-- Script-tags the topmost header.
local pagename = title.text
local fullPagename = title.fullText
local namespace = title.nsText
if not data.lang or type(data.lang) ~= "table" or not data.lang.getCode then
error("In data, the first argument to full_headword, data.lang should be a language object.")
end
if not data.sc then
data.sc = require("Module:scripts").findBestScript(data.heads and data.heads[1] ~= "" and data.heads[1] or pagename, data.lang)
else
-- Track uses of sc parameter
local best = require("Module:scripts").findBestScript(pagename, data.lang)
require("Module:debug/track")("headword/sc")
if data.sc:getCode() == best:getCode() then
require("Module:debug/track")("headword/sc/redundant")
require("Module:debug/track")("headword/sc/redundant/" .. data.sc:getCode())
else
require("Module:debug/track")("headword/sc/needed")
require("Module:debug/track")("headword/sc/needed/" .. data.sc:getCode())
end
end
local displayTitle
-- Assumes that the scripts in "toBeTagged" will never occur in the Reconstruction namespace.
-- Avoid tagging ASCII as Hani even when it is tagged as Hani in the
-- headword, as in [[check]]. The check for ASCII might need to be expanded
-- to a check for any Latin characters and whitespace or punctuation.
if (namespace == "" and data.sc and toBeTagged[data.sc:getCode()]
and not pagename:find "^[%z\1-\127]+$")
or (data.sc:getCode() == "Jpan" and (test_script(pagename, "Hira") or test_script(pagename, "Kana"))) then
displayTitle = '<span class="' .. data.sc:getCode() .. '">' .. pagename .. '</span>'
elseif namespace == "Reconstruction" then
displayTitle, matched = mw.ustring.gsub(
fullPagename,
"^(Reconstruction:[^/]+/)(.+)$",
function(before, term)
return before ..
require("Module:script utilities").tag_text(
term,
data.lang,
data.sc
)
end
)
if matched == 0 then
displayTitle = nil
end
end
if displayTitle then
local frame = mw.getCurrentFrame()
frame:callParserFunction(
"DISPLAYTITLE",
displayTitle
)
end
if data.force_cat_output then
--[=[
[[Special:WhatLinksHere/Template:tracking/headword/force cat output]]
]=]
require("Module:debug/track")("headword/force cat output")
end
if data.getCanonicalName then
error('The "data" variable supplied to "full_headword" should not be a language object.')
end
-- Were any categories specified?
if data.categories and #data.categories > 0 then
local lang_name = require("Module:string/pattern_escape")(data.lang:getCanonicalName())
for _, cat in ipairs(data.categories) do
-- Does the category begin with the language name? If not, tag it with a tracking category.
if not mw.ustring.find(cat, "^" .. lang_name) then
mw.log(cat, data.lang:getCanonicalName())
table.insert(tracking_categories, "head tracking/no lang category")
--[=[
[[Special:WhatLinksHere/Template:tracking/head tracking/no lang category]]
]=]
require("Module:debug/track"){
"headword/no lang category",
"headword/no lang category/lang/" .. data.lang:getCode()
}
end
end
if not data.pos_category
and mw.ustring.find(data.categories[1], "^" .. data.lang:getCanonicalName())
then
data.pos_category = mw.ustring.gsub(data.categories[1], "^" .. data.lang:getCanonicalName() .. " ", "")
table.remove(data.categories, 1)
end
end
if not data.pos_category then
error(
'No valid part-of-speech categories were found in the list '
.. 'of categories passed to the function "full_headword". '
.. 'The part-of-speech category should consist of a language\'s '
.. 'canonical name plus a part of speech.'
)
end
-- Categorise for unusual characters
local standard = data.lang:getStandardCharacters()
if standard then
if mw.ustring.len(title.subpageText) ~= 1 and not non_categorizable() then
for character in mw.ustring.gmatch(title.subpageText, "([^" .. standard .. "])") do
local upper = mw.ustring.upper(character)
if not mw.ustring.find(upper, "[" .. standard .. "]") then
character = upper
end
table.insert(
data.categories,
data.lang:getCanonicalName() .. " terms spelled with " .. character
)
end
end
end
-- Categorise for palindromes
if title.nsText ~= "Reconstruction" and mw.ustring.len(title.subpageText)>2
and require('Module:palindromes').is_palindrome(
title.subpageText, data.lang, data.sc
) then
table.insert(data.categories, data.lang:getCanonicalName() .. " palindromes")
end
-- This may add more categories (e.g. gender categories), so make sure it gets
-- evaluated first.
local text = show_headword_line(data)
return
text ..
require("Module:utilities/format_categories")(
data.categories, data.lang, data.sort_key, nil,
data.force_cat_output or test_force_categories, data.sc
) ..
require("Module:utilities/format_categories")(
tracking_categories, data.lang, data.sort_key, nil,
data.force_cat_output or test_force_categories, data.sc
)
end
return export
8l8q643q8t9ku2yjo8k2eyfr2scxjw0
Module:headword/data
828
2966
8278
2022-07-21T19:03:33Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local data = {}
data.invariable = {
"cmavo",
"cmene",
"fu'ivla",
"gismu",
"Han tu",
"hanzi",
"hanja",
"jyutping",
"kanji",
"lujvo",
"phrasebook",
"pinyin",
"rafsi",
"romaji",
}
data.lemmas = {
"abbreviations",
"acronyms",
"adjectives",
"adnominals",
"adpositions",
"adverbs",
"affixes",
"ambipositions",
"articles",
"circumfixes",
"circumpositions",
"classifiers",
"cmavo",
"cmavo clusters",
"cmene",
"combining forms",
"conjunctions",
"counters",
"determiners",
"diacritical marks",
"equative adjectives",
"fu'ivla",
"gismu",
"Han characters",
"Han tu",
"hanzi",
"hanja",
"ideophones",
"idioms",
"infixes",
"interfixes",
"initialisms",
"interjections",
"kanji",
"letters",
"ligatures",
"lujvo",
"morphemes",
"non-constituents",
"nouns",
"numbers",
"numeral symbols",
"numerals",
"particles",
"phrases",
"postpositions",
"postpositional phrases",
"predicatives",
"prefixes",
"prepositions",
"prepositional phrases",
"preverbs",
"pronominal adverbs",
"pronouns",
"proverbs",
"proper nouns",
"punctuation marks",
"relatives",
"roots",
"stems",
"suffixes",
"syllables",
"symbols",
"verbs",
}
data.nonlemmas = {
"active participles",
"adjectival participles",
"adjective forms",
"adjective feminine forms",
"adjective plural forms",
"adverb forms",
"adverbial participles",
"agent participles",
"article forms",
"circumfix forms",
"combined forms",
"comparative adjective forms",
"comparative adjectives",
"comparative adverb forms",
"comparative adverbs",
"contractions",
"converbs",
"determiner comparative forms",
"determiner forms",
"determiner superlative forms",
"diminutive nouns",
"equative adjective forms",
"equative adjectives",
"future participles",
"gerunds",
"infinitive forms",
"infinitives",
"interjection forms",
"jyutping",
"kanji readings",
"misspellings",
"negative participles",
"nominal participles",
"noun case forms",
"noun dual forms",
"noun forms",
"noun paucal forms",
"noun plural forms",
"noun possessive forms",
"noun singulative forms",
"numeral forms",
"participles",
"participle forms",
"particle forms",
"passive participles",
"past active participles",
"past participles",
"past participle forms",
"past passive participles",
"perfect active participles",
"perfect participles",
"perfect passive participles",
"pinyin",
"plurals",
"postposition forms",
"prefix forms",
"preposition contractions",
"preposition forms",
"prepositional pronouns",
"present active participles",
"present participles",
"present passive participles",
"pronoun forms",
"pronoun possessive forms",
"proper noun forms",
"proper noun plural forms",
"rafsi",
"romanizations",
"root forms",
"singulatives",
"suffix forms",
"superlative adjective forms",
"superlative adjectives",
"superlative adverb forms",
"superlative adverbs",
"verb forms",
"verbal nouns",
}
-- These languages will not have "LANG multiword terms" categories added.
data.no_multiword_cat = {
-------- Languages without spaces between words (sometimes spaces between phrases) --------
"aho", -- Ahom
"blt", -- Tai Dam
"ja", -- Japanese
"khb", -- Lü
"km", -- Khmer
"lo", -- Lao
"mnw", -- Mon
"my", -- Burmese
"nan", -- Min Nan (some words in Latin script; hyphens between syllables)
"nod", -- Northern Thai
"ojp", -- Old Japanese
"tdd", -- Tai Nüa
"th", -- Thai
"tts", -- Isan
"twh", -- Tai Dón
"shn", -- Shan
"sou", -- Southern Thai
"zh", -- Chinese (all varieties with Chinese characters)
-------- Languages with spaces between syllables --------
"ahk", -- Akha
"aou", -- A'ou
"atb", -- Zaiwa
"byk", -- Biao
"cdy", -- Chadong
--"duu", -- Drung; not sure
--"hmx-pro", -- Proto-Hmong-Mien
--"hnj", -- Green Hmong; not sure
"huq", -- Tsat
"ium", -- Iu Mien
--"lis", -- Lisu; not sure
"mtq", -- Muong
--"mww", -- White Hmong; not sure
"onb", -- Lingao
--"sit-gkh", -- Gokhy; not sure
--"swi", -- Sui; not sure
"tbq-lol-pro", -- Proto-Loloish
"tdh", -- Thulung
"ukk", -- Muak Sa-aak
"vi", -- Vietnamese
"yig", -- Wusa Nasu
"zng", -- Mang
-------- Languages with ~ with surrounding spaces used to separate variants --------
"mkh-ban-pro", -- Proto-Bahnaric
"sit-pro", -- Proto-Sino-Tibetan; listed above
-------- Other weirdnesses --------
"mul", -- Translingual; gestures, Morse code, etc.
"aot", -- Atong (India); bullet is a letter
-------- All sign languages --------
"ads",
"aed",
"aen",
"afg",
"ase",
"asf",
"asp",
"asq",
"asw",
"bfi",
"bfk",
"bog",
"bqn",
"bqy",
"bvl",
"bzs",
"cds",
"csc",
"csd",
"cse",
"csf",
"csg",
"csl",
"csn",
"csq",
"csr",
"doq",
"dse",
"dsl",
"ecs",
"esl",
"esn",
"eso",
"eth",
"fcs",
"fse",
"fsl",
"fss",
"gds",
"gse",
"gsg",
"gsm",
"gss",
"gus",
"hab",
"haf",
"hds",
"hks",
"hos",
"hps",
"hsh",
"hsl",
"icl",
"iks",
"ils",
"inl",
"ins",
"ise",
"isg",
"isr",
"jcs",
"jhs",
"jls",
"jos",
"jsl",
"jus",
"kgi",
"kvk",
"lbs",
"lls",
"lsl",
"lso",
"lsp",
"lst",
"lsy",
"lws",
"mdl",
"mfs",
"mre",
"msd",
"msr",
"mzc",
"mzg",
"mzy",
"nbs",
"ncs",
"nsi",
"nsl",
"nsp",
"nsr",
"nzs",
"okl",
"pgz",
"pks",
"prl",
"prz",
"psc",
"psd",
"psg",
"psl",
"pso",
"psp",
"psr",
"pys",
"rms",
"rsl",
"rsm",
"sdl",
"sfb",
"sfs",
"sgg",
"sgx",
"slf",
"sls",
"sqk",
"sqs",
"ssp",
"ssr",
"svk",
"swl",
"syy",
"tse",
"tsm",
"tsq",
"tss",
"tsy",
"tza",
"ugn",
"ugy",
"ukl",
"uks",
"vgt",
"vsi",
"vsl",
"vsv",
"xki",
"xml",
"xms",
"ygs",
"ysl",
"zib",
"zsl",
}
-- In these languages, the hyphen is not considered a word separator for the "multiword terms" category.
data.hyphen_not_multiword_sep = {
"akk", -- Akkadian; hyphens between syllables
"akl", -- Aklanon; hyphens for mid-word glottal stops
"ber-pro", -- Proto-Berber; morphemes separated by hyphens
"ceb", -- Cebuano; hyphens for mid-word glottal stops
"cnk", -- Khumi Chin; hyphens used in single words
"cpi", -- Chinese Pidgin English; Chinese-derived words with hyphens between syllables
"de", -- too many false positives
"esx-esk-pro", -- hyphen used to separate morphemes
"fi", -- Finnish; hyphen used to separate components in compound words if the final and initial vowels match, respectively
"hil", -- Hiligaynon; hyphens for mid-word glottal stops
"ilo", -- Ilocano; hyphens for mid-word glottal stops
"lcp", -- Western Lawa; dash as syllable joiner
"lwl", -- Eastern Lawa; dash as syllable joiner
"mkh-vie-pro", -- Proto-Vietic; morphemes separated by hyphens
"msb", -- Masbatenyo; too many false positives
"tl", -- Tagalog; too many false positives
"war", -- Waray-Waray; too many false positives
"yo", -- Yoruba; hyphens used to show lengthened nasal vowels
}
-- These languages will not have "LANG masculine nouns" and similar categories added.
data.no_gender_cat = {
-- Languages without gender but which use the gender field for other purposes
"ja",
"th",
}
data.notranslit = {
"ams",
"az",
"bbc",
"bug",
"cia",
"cjm",
"cmn",
"hak",
"ja",
"kzg",
"lad",
"lzh",
"ms",
"mul",
"mvi",
"nan",
"oj",
"okn",
"pi",
"ro",
"ryn",
"rys",
"ryu",
"sh",
"tgt",
"th",
"tkn",
"tly",
"txg",
"und",
"vi",
"xug",
"yue",
"yoi",
"yox",
"za",
"zh",
}
-- Script codes for which a script-tagged display title will be added.
data.toBeTagged = {
"Ahom",
"Arab",
"Avst",
"Bali",
"Cham",
"Copt",
"Deva",
"Kali",
"Hani",
"Hebr",
"Lana",
"Linb",
"Mand",
"Mong",
"polytonic",
"Rjng",
"Samr",
"Sund",
"Sylo",
"Syrc",
"Tang",
"Tavt",
"Ugar",
"Xsux",
}
for key, list in pairs(data) do
data[key] = {}
for _, item in ipairs(list) do
data[key][item] = true
end
end
-- Parts of speech for which categories like "German masculine nouns" or "Russian imperfective verbs"
-- will be generated if the headword is of the appropriate gender/number. We put this at the bottom
-- because it's a map, not a list.
data.pos_for_gender_number_cat = {
["nouns"] = "nouns",
["proper nouns"] = "nouns",
["suffixes"] = "suffixes",
-- We include verbs because impf and pf are valid "genders".
["verbs"] = "verbs",
}
return data
6pn90w8n5vs655s5g93y40jsgu2oe3b
Template:enPR
10
2967
8279
2022-07-21T19:07:33Z
Rebel Agent
2678
Ke dile tsebe
wikitext
text/x-wiki
[[Appendix:English pronunciation|enPR]]: {{enPRchar|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
0okn96a7wutprh259r9mis6yqfn86op
Template:enPRchar
10
2968
8280
2022-07-21T19:08:37Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
<!-- --><span class="AHD enPR">{{{1}}}</span><!--
-->{{#if:{{{2|}}}|, <span class="AHD enPR">{{{2}}}</span>}}<!--
-->{{#if:{{{3|}}}|, <span class="AHD enPR">{{{3}}}</span>}}<!--
-->{{#if:{{{4|}}}|, <span class="AHD enPR">{{{4}}}</span>}}<!--
-->{{#if:{{{5|}}}|, <span class="AHD enPR">{{{5}}}</span>}}<!--
-->{{#if:{{{6|}}}|, <span class="AHD enPR">{{{6}}}</span>}}<!--
--><includeonly>{{#if:{{{1|}}}||[[Category:Pronunciation templates without a pronunciation]]}}</includeonly><!--
--><noinclude>{{documentation}}</noinclude>
es26i6n2ayh3jwns222l7799p7yavd5
Template:ethnologue
10
2969
8281
2022-07-21T19:16:19Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
[[ethnologue:{{{code|{{{1}}}}}}|Ethnologue entry for {{{lang|{{{2|{{PAGENAME}}}}}}}}]], '''{{{code|{{{1}}}}}}'''<noinclude>
{{documentation}}
{{rfd}}
</noinclude>
s50qg4rd4fgn2kj8znszszun1u63ve0
Template:rfd
10
2970
8282
2022-07-21T19:18:06Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{check deprecated lang param usage|lang={{{lang|}}}|<!--
-->{{maintenance box|red<!--
-->|image={{#if:{{{fail|}}}|[[File:Icon delete.svg|50px]]|[[Image:Crystal Clear filesystem trashcan full.png|60px]]}}<!--
-->|title=<!--
--><span id="rfd-notice-{{{1|}}}-{{{topic|}}}"></span><!--
-->{{#if:{{{fail|}}}<!--
-->|A user has marked this {{<noinclude>temp|</noinclude>pagetype}} as having failed a<!--
-->|A user has added this {{<noinclude>temp|</noinclude>pagetype}} to<!--
-->}} [[{{#invoke:request-forum|rfd|{{{1|}}}|{{NAMESPACE}}}}#{{{fragment|{{{section|{{#invoke:string|gsub|{{FULLPAGENAME}}|/documentation|}}}}}}}}|{{#if:{{{fail|}}}|request|requests}} for deletion]]<!--
-->{{#if:{{{fail|}}}||<sup class="plainlinks" style="font-weight:normal" title="Start discussion">(<!--
-->[{{fullurl:{{#invoke:request-forum|rfd|{{{1|}}}|{{NAMESPACE}}}}|action=edit§ion=new{{#switch:{{#if:{{{lang|}}}|{{{lang|}}}|{{{1|}}}}}|=|en=|#default=&preload=Template:rfd/preload$1&preloadparams%5B%5D={{urlencode:{{langname|{{{lang|{{{1|<noinclude>und</noinclude>}}}}}}}}}}.%20}}&preloadtitle={{urlencode:[[:{{FULLPAGENAME}}#rfd-notice-{{{1|}}}-{{{topic|}}}|{{FULLPAGENAME}}]]}}}} +]<!--
-->)</sup>}}.<!--
-->|text=<!--
-->Please see that page for discussion and {{#if:{{{fail|}}}|consensus|justifications}}{{#if:{{{2|}}}| beyond the initial comment of: '''“{{{2|}}}”'''}}<!--
-->. <!--
-->{{#if:{{{fail|}}}<!--
-->|The discussion is closed now, and this page is awaiting speedy-deletion by an administrator. If you object, please remove {{p|fail|1}} from the template and reopen the discussion.<!--
-->|You may continue to edit this {{<noinclude>temp|</noinclude>pagetype}} while the discussion proceeds, but please mention significant edits at the RFD discussion and ensure that the intention of votes already cast is not left unclear. Do not remove the {{temp|rfd}} until the debate has finished.<!--
-->}}<!--
-->}}<!--(end of {{maintenance box}})
-->}}<!-- (end of {{check deprecated lang param usage}})
--><includeonly><!--
-->{{#if:{{{nocat|}}}||<!--
-->{{#if:{{{fail|}}}<!--
-->|[[Category:Candidates for speedy deletion]]<!--
-->|{{#switch:{{NAMESPACE}}<!--
-->||Citations|Transwiki|Reconstruction=<!--
-->{{categorize<!--
-->|{{{1|}}}<!--
-->|Requests for deletion in {{langname|{{{1|}}}}} entries<!--
-->|{{#if:{{{topic|}}}|Entries needing topical attention}}<!--
-->|sort={{{sort|}}}<!--
-->}}<!--
-->|#default=[[Category:Requests for deletion/Others]]<!--
-->}}<!--
-->}}<!--
-->{{#if:{{{topic|}}}|[[Category:rfd with topic]]}}<!--
-->}}<!--
--></includeonly><!--
--><noinclude>{{documentation}}</noinclude>
qjbm4pfvb7fkn7ao7nl869ax67zuehg
Template:maintenance box
10
2971
8283
2022-07-21T19:19:30Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
<div class="noprint maintenance-box maintenance-box-{{{1|blue}}}" style="background:#{{#switch:{{{1|blue}}}||blue=EEEEFF|red=FFE7DD|yellow=FFFFDD|grey=F0F0F0|orange=FFDD44}}; width:90%; margin: 0.75em auto; border:1px dashed #{{#switch:{{{1|blue}}}||blue=4444AA|red=884444|yellow=888822|grey=444444|orange=DDAA00}}; padding: 0.25em; ">
{|
| rowspan="2" | {{{image}}}
! style="text-align: left;" | {{{title}}}
|-
| {{{text}}}
|}</div><noinclude>{{documentation}}</noinclude>
n8lldvtjper0ph2s663yda8kyuifv9z
Module:string
828
2972
8284
2022-07-21T19:21:24Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local str = {}
-- Cannot include null byte.
local UTF8_char = "[\1-\127\194-\244][\128-\191]*"
--[[
ulen
Counts UTF-8 characters. Faster than mw.ustring.len.
Assumes that the encoding is correct. Unlike mw.ustring.len, does not return nil
if encoding is invalid.
Does not count the bytes 192, 193, and 245-255. They are not used in UTF-8 and
will not occur if the string is valid. They are replaced with the replacement
character (U+FFFD) on MediaWiki pages.
--]]
function str.ulen(text)
local _, length = string.gsub(text, UTF8_char, "")
return length
end
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:string|len|target_string|}}
OR
{{#invoke:string|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len(frame)
local new_args = str._getParameters(frame.args, { 's' });
local s = new_args['s'] or '';
return mw.ustring.len(s)
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:string|sub|target_string|start_index|end_index}}
OR
{{#invoke:string|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub(frame)
local new_args = str._getParameters(frame.args, { 's', 'i', 'j' });
local s = new_args['s'] or '';
local i = tonumber(new_args['i']) or 1;
local j = tonumber(new_args['j']) or -1;
local len = mw.ustring.len(s);
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1;
end
if j < 0 then
j = len + j + 1;
end
if i > len or j > len or i < 1 or j < 1 then
return str._error('String subset index out of range');
end
if j < i then
return str._error('String subset indices out of order');
end
return mw.ustring.sub(s, i, j)
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength(frame)
local i = tonumber(frame.args.i) or 0
local len = tonumber(frame.args.len)
return mw.ustring.sub(frame.args.s, i + 1, len and (i + len))
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:string|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:string|pos|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
function str.match(frame)
local new_args = str._getParameters(frame.args, { 's', 'pattern', 'start', 'match', 'plain', 'nomatch' });
local s = new_args['s'] or '';
local start = tonumber(new_args['start']) or 1;
local plain_flag = str._getBoolean(new_args['plain'] or false);
local pattern = new_args['pattern'] or '';
local match_index = math.floor(tonumber(new_args['match']) or 1);
local nomatch = new_args['nomatch'];
if s == '' then
return str._error('Target string is empty');
end
if pattern == '' then
return str._error('Pattern string is empty');
end
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len(s) then
return str._error('Requested start is out of range');
end
if match_index == 0 then
return str._error('Match index is out of range');
end
if plain_flag then
pattern = str.pattern_escape(pattern);
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match(s, pattern, start)
else
if start > 1 then
s = mw.ustring.sub(s, start);
end
local iterator = mw.ustring.gmatch(s, pattern);
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1;
if match_index == 0 then
result = w;
break;
end
end
else
-- Reverse search
local result_table = {};
local count = 1;
for w in iterator do
result_table[count] = w;
count = count + 1;
end
result = result_table[count + match_index];
end
end
if result == nil then
if nomatch == nil then
return str._error('Match not found');
else
return nomatch;
end
else
return result;
end
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:string|pos|target_string|index_value}}
OR
{{#invoke:string|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos(frame)
local new_args = str._getParameters(frame.args, { 'target', 'pos' });
local target_str = new_args['target'] or '';
local pos = tonumber(new_args['pos']) or 0;
if pos == 0 or math.abs(pos) > mw.ustring.len(target_str) then
return str._error('String index out of range');
end
return mw.ustring.sub(target_str, pos, pos);
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find(frame)
local new_args = str._getParameters(frame.args, { 'source', 'target' });
local source_str = new_args['source'] or '';
local target_str = new_args['target'] or '';
if target_str == '' then
return 1;
end
local start = mw.ustring.find(source_str, target_str, 1, true)
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:string|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:string|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns an empty string. If either "source" or "target" are missing / empty, this
function also returns an empty string.
This function should be safe for UTF-8 strings.
]]
function str.find(frame)
local params = {
[1] = { required = true, allow_empty = true },
[2] = { required = true, allow_empty = true },
[3] = { type = "number" },
[4] = { type = "boolean" },
}
local args = require("Module:parameters").process(frame.args, params)
return mw.ustring.find(args[1], args[2], args[3], args[4])
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:string|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:string|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace(frame)
local new_args = str._getParameters(frame.args, { 'source', 'pattern', 'replace', 'count', 'plain' });
local source_str = new_args['source'] or '';
local pattern = new_args['pattern'] or '';
local replace = new_args['replace'] or '';
local count = tonumber(new_args['count']);
local plain = new_args['plain'] or true;
if source_str == '' or pattern == '' then
return source_str;
end
plain = str._getBoolean(plain);
if plain then
pattern = str.pattern_escape(pattern);
replace = mw.ustring.gsub(replace, "%%", "%%%%"); --Only need to escape replacement sequences.
end
local result;
result = mw.ustring.gsub(source_str, pattern, replace, count);
return result;
end
function str.gsub(frame)
local params = {
[1] = { required = true, allow_empty = true, allow_whitespace = true},
[2] = { required = true, allow_empty = true, allow_whitespace = true},
[3] = { required = true, allow_empty = true, allow_whitespace = true},
[4] = { type = "number" },
}
local args = require("Module:parameters").process(frame.args, params)
return (mw.ustring.gsub(args[1], args[2], args[3], args[4]))
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep(frame)
local repetitions = tonumber(frame.args[2])
if not repetitions then
return str._error('function rep expects a number as second parameter, received "' .. (frame.args[2] or '') .. '"')
end
return string.rep(frame.args[1] or '', repetitions)
end
function str.lower(frame)
local text = frame.args[1] or ''
return mw.ustring.lower(text)
end
str.lc = str.lower
--[[
format
This function allows one to format strings according to a template. This is a direct interface onto
str.format() in Lua, and works like the C printf() function.
For example:
{{#invoke:string|format|page_%04d.html|65}}
will produce the result
page_0065.html
Parameters
1: The format template. See https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#string.format
2, 3, ...: Arguments to be inserted into the template.
Note that leading and trailing whitespace is not removed from the arguments.
]]
function str.format(frame)
local fmt = frame.args[1]
-- You can't call unpack() directly on frame.args because it isn't really a
-- table, and doesn't support the # operator.
local args = {}
local i = 2
while true do
local val = frame.args[i]
if not val then
break
end
table.insert(args, val)
i = i + 1
end
return fmt:format(unpack(args))
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters(frame_args, arg_list)
local new_args = {};
local index = 1;
local value;
for _, arg in ipairs(arg_list) do
value = frame_args[arg]
if value == nil then
value = frame_args[index];
index = index + 1;
end
new_args[arg] = value;
end
return new_args;
end
--[[
Helper function to handle error messages.
]]
function str._error(error_str)
local frame = mw.getCurrentFrame();
local error_category = frame.args.error_category or 'Errors reported by Module String';
local ignore_errors = frame.args.ignore_errors or false;
local no_category = frame.args.no_category or false;
if str._getBoolean(ignore_errors) then
return '';
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
if error_category ~= '' and not str._getBoolean(no_category) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str;
end
return error_str;
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean(boolean_str)
local boolean_value;
if type(boolean_str) == 'string' then
boolean_str = boolean_str:lower();
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false;
else
boolean_value = true;
end
elseif type(boolean_str) == 'boolean' then
boolean_value = boolean_str;
else
error('No boolean value found');
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters – ().%+-*?[^$] – so that they will be treated
as plain text.
]]
function str.pattern_escape(pattern_str)
local invoked = false
local escape = require("Module:string/pattern_escape")
if type(pattern_str) == "table" then
if pattern_str.args then
local frame = pattern_str
invoked = true
if frame.args[1] then
pattern_str = frame.args[1]
else
pattern_str = frame:getParent().args[1]
end
else
error("First argument to pattern_escape should be a string, a number, or a frame object.")
end
elseif not (type(pattern_str) == "string" or type(pattern_str) == "number") then
error("First argument to pattern_escape should be a string or a number.")
end
if invoked then
return (escape(pattern_str)) -- only the first value
else
return escape(pattern_str)
end
end
function str.count(text, pattern, plain)
if not (type(text) == "string" or type(text) == "number") then
error('The first argument to the function "count" must be a string or a number, not a ' .. type(text) .. '.')
end
if not (type(pattern) == "string" or type(pattern) == "number") then
error('The first argument to the function "count" must be a string or a number, not a ' .. type(text) .. '.')
end
if plain then
pattern = str.pattern_escape(pattern)
end
local _, count = mw.ustring.gsub(text, pattern, "")
return count
end
function str.plain_gsub(text, pattern, replacement)
local invoked = false
if type(text) == "table" then
invoked = true
if text.args then
local frame = text
local params = {
[1] = {},
[2] = {},
[3] = { allow_empty = true },
}
local args = require("Module:parameters").process(frame.args, params)
text = args[1]
pattern = args[2]
replacement = args[3]
else
error("If the first argument to plain_gsub is a table, it should be a frame object.")
end
else
if not (type(pattern) == "string" or type(pattern) == "number") then
error("The second argument to plain_gsub should be a string or a number.")
end
if not (type(replacement) == "string" or type(replacement) == "number") then
error("The third argument to plain_gsub should be a string or a number.")
end
end
pattern = str.pattern_escape(pattern)
if invoked then
text = mw.ustring.gsub(text, pattern, replacement)
return text
else
return mw.ustring.gsub(text, pattern, replacement)
end
end
function str.matchToArray(text, pattern)
local invoked = false
if type(text) == "table" then
invoked = true
if text.args then
local frame = text
local params = {
[1] = { required = true },
[2] = { required = true },
}
local args = require("Module:parameters").process(frame.args, params)
text = args[1]
pattern = args[2]
else
error("If the first argument to matchToArray is a table, it should be a frame object.")
end
else
if not (type(pattern) == "string" or type(pattern) == "number") then
error("The second argument to matchToArray should be a string or a number.")
end
end
local matches = {}
local i = 0
for match in mw.ustring.gmatch(text, pattern) do
i = i + 1
matches[i] = match
end
if i > 0 then
if invoked then
return table.concat(matches, ", ")
else
return matches
end
else
if invoked then
return ""
else
return nil
end
end
end
--[=[
Similar to gmatch, but it returns the count of the match in addition to the
list of captures, something like ipairs().
If the pattern doesn't contain any captures, the whole match is returned.
Invoke thus:
for i, whole_match in require("Module:string").imatch(text, pattern) do
[ do something with i and whole_match ]
end
or
for i, capture1[, capture2[, capture3[, ...]]] in require("Module:string").imatch(text, pattern) do
[ do something with i and capture1 ]
end
For example, this code
for i, whole_match in require("Module:string").imatch("a b c", "[a-z]") do
mw.log(i, whole_match)
end
will log
1 a
2 b
3 c
]=]
function str.imatch(text, pattern, pos, plain, use_basic_Lua_function)
local i = 0
pos = pos or 0
if not string.find(pattern, "%b()") then
pattern = "(" .. pattern .. ")"
end
local find = use_basic_Lua_function and string.find or mw.ustring.find
return function()
i = i + 1
local return_values = { find(text, pattern, pos, plain) }
local j = return_values[2]
if return_values[3] then
pos = j + 1
-- Skip the first two returned values, which are the indices of the
-- whole match.
return i, unpack(return_values, 3)
end
end
end
function str.escapebytes(s)
return (string.gsub(s,
'.',
function(char)
return ('\\%03d'):format(string.byte(char))
end))
end
function str.URIdecode(frame)
return mw.uri.decode(frame.args[1], frame.args[2] or "PATH")
end
return str
oeq6i4dx2v1wn2dviuppuuuutmkonbn
Template:documentation
10
2973
8285
2022-07-21T19:22:54Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{#invoke:documentation|show|hr={{{hr|above}}}}}
3mqq1e6fru8l8n97ptwphb1qc1b72m7
Module:documentation
828
2974
8286
2022-07-21T19:24:52Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
-- it is either here, or in [[Module:ugly hacks]], and it is not in ugly hacks.
function export.CONTENTMODEL()
return mw.title.getCurrentTitle().contentModel
end
local skins = {
["common" ] = "";
["vector" ] = "Vector";
["monobook" ] = "Monobook";
["cologneblue"] = "Cologne Blue";
["modern" ] = "Modern";
}
local Array = require "Module:array"
local function compare_pages(page1, page2, text)
return "[" .. tostring(
mw.uri.fullUrl("Special:ComparePages", { page1 = page1, page2 = page2 }))
.. " " .. text .. "]"
end
local function page_exists(title)
local success, title_obj = pcall(mw.title.new, title)
return success and title_obj.exists
end
-- Avoid transcluding [[Module:languages/cache]] everywhere.
local lang_cache = setmetatable({}, { __index = function (self, k)
return require "Module:languages/cache"[k]
end })
local function zh_link(word)
return require("Module:links").full_link{
lang = lang_cache.zh,
term = word
}
end
local function make_Unicode_data_documentation(title, cats)
local subpage, first_three_of_code_point
= title.fullText:match("^Module:Unicode data/([^/]+)/(%x%x%x)$")
if subpage == "names" or subpage == "images" then
local low, high =
tonumber(first_three_of_code_point .. "000", 16),
tonumber(first_three_of_code_point .. "FFF", 16)
return string.format(
"This data module contains the %s of " ..
"[[Appendix:Unicode|Unicode]] code points within the range U+%04X to U+%04X.",
subpage == "images" and "titles of images" or "names",
low, high)
end
end
-- This provides categories and documentation for various data modules, so that
-- [[Category:Uncategorized modules]] isn’t unnecessarily cluttered.
-- It is a list of tables, each of which have the following possible fields:
-- `regex` (required): A Lua pattern to match the module's title. If it matches, the data in this entry will be used.
-- Any captures in the pattern can by referenced in the `cat` field using %1 for the first capture, %2 for the
-- second, etc. (often used for creating the sortkey for the category). In addition, the captures are passed to the
-- `process` function as the third and subsequent parameters.
-- `process` (optional): This may be a function or a string. If it is a function, it is called as follows:
-- process(TITLE, CATS, CAPTURE1, CAPTURE2, ...)
-- where:
-- * TITLE is a title object describing the module's title; see [https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Title_objects].
-- * CATS is an array object (see [[Module:array]]) of categories that the module will be added to.
-- * CAPTURE1, CAPTURE2, ... contain any captures in the `regex` field.
-- The return value of `process` should be a string and will be used as the module's documentation.
-- If `process` is a string, it is the name of a submodule under 'Module:documentation/functions/' which returns a
-- function, of the same type as described above. If `process` is omitted entirely, the module will have no
-- documentation.
-- `cat` (optional): A string naming the category into which the module should be placed. Captures specified in `regex`
-- may be referenced in this string using %1 for the first capture, %2 for the second, etc. Currently, in order to put
-- the module into multiple categories, you need to write a `process` function that adds categories to the CATS
-- parameter passed in.
local module_regex = {
{
regex = "^Module:languages/.+$",
cat = "Language and script modules",
},
{
regex = "^Module:scripts/.+$",
cat = "Language and script modules",
},
{
regex = "^Module:data tables/data..?.?.?$",
cat = "Reference module sharded data tables",
},
{
regex = "^Module:Quotations/...?.?.?.?.?.?$",
cat = "Quotation data modules",
},
{
regex = "^Module:zh/data/dial%-pron/.+$",
cat = "Chinese dialectal pronunciation data modules",
process = "zh dial or syn",
},
{
regex = "^Module:zh/data/dial%-syn/.+$",
cat = "Chinese dialectal synonyms data modules",
process = "zh dial or syn",
},
{
regex = "^Module:zh/data/glyph%-data/.+$",
cat = "Chinese historical character forms data modules",
process = function(title, cats)
local character = title.fullText:match("^Module:zh/data/glyph%-data/(.+)")
if character then
return ("This module contains data on historical forms of the Chinese character %s.")
:format(zh_link(character))
end
end,
},
{
regex = "^Module:zh/data/ltc%-pron/(.+)$",
cat = "Middle Chinese pronunciation data modules|%1",
process = "zh data",
},
{
regex = "^Module:zh/data/och%-pron%-BS/(.+)$",
cat = "Old Chinese (Baxter-Sagart) pronunciation data modules|%1",
process = "zh data",
},
{
regex = "^Module:zh/data/och%-pron%-ZS/(.+)$",
cat = "Old Chinese (Zhengzhang) pronunciation data modules|%1",
process = "zh data",
},
{
-- capture rest of zh/data submodules
regex = "^Module:zh/data/(.+)$",
cat = "Chinese data modules|%1",
},
{
regex = "^Module:mul/guoxue%-data/cjk%-?(.*)$",
process = "guoxue-data",
},
{
regex = "^Module:Unicode data/(.+)$",
cat = "Unicode data modules|%1",
process = make_Unicode_data_documentation,
},
{
regex = "^Module:number list/data/(.+)$",
process = "number list",
},
{
regex = "^Module:accel/(.+)$",
process = function(title, cats)
local lang_code = title.subpageText
local lang = lang_cache[lang_code]
if lang then
cats:insert(lang:getCanonicalName() .. " modules|accel")
cats:insert(("Accel submodules|%s"):format(lang:getCanonicalName()))
return ("This module contains new entry creation rules for %s; see [[WT:ACCEL]] for an overview, and [[Module:accel]] for information on creating new rules.")
:format(lang:makeCategoryLink())
end
end,
},
{
regex = "^Module:inc%-ash/dial/data/(.+)$",
cat = "Ashokan Prakrit modules|%1",
process = function(title, cats)
local word = title.fullText:match("^Module:inc%-ash/dial/data/(.+)$")
if word then
local lang = lang_cache["inc-ash"]
return ("This module contains data on the pronunciation of %s in dialects of %s.")
:format(require("Module:links").full_link({ term = word, lang = lang }, "term"),
lang:makeCategoryLink())
end
end,
},
{
regex = "^Module:[%l-]+:Dialects$",
process = function(title, cats)
local content = title:getContent()
local has_aliases = content:find("aliases") ~= nil
return mw.getCurrentFrame():expandTemplate {
title = "dialectal data module",
args = { ["labels-aliases"] = has_aliases },
}
end,
},
{
regex = "^.+%-translit$",
process = "translit",
},
{
regex = "^Module:category tree/poscatboiler/data/lang%-specific/(.+)$",
process = function(title, cats, lang_code)
local lang = lang_cache[lang_code]
if lang then
local langname = lang:getCanonicalName()
cats:insert("Category tree data modules/poscatboiler|" .. langname)
cats:insert(langname .. " modules")
cats:insert(langname .. " data modules")
return "This module handles generating the descriptions and categorization for " .. langname .. " category pages "
.. "of the format \"" .. langname .. " LABEL\" where LABEL can be any text. Examples are "
.. "[[:Category:Bulgarian conjugation 2.1 verbs]] and [[:Category:Russian velar-stem neuter-form nouns]]. "
.. "This module is part of the poscatboiler system, which is a general framework for generating the "
.. "descriptions and categorization of category pages.\n\n"
.. "For more information, see [[Module:category tree/poscatboiler/data/lang-specific/documentation]]."
end
end
},
{
regex = "^Module:category tree/poscatboiler/data/(.+)$",
cat = "Category tree data modules/poscatboiler|%1",
},
{
regex = "^Module:ja/data/(.+)$",
cat = "Japanese data modules|%1",
},
{
regex = "^Module:Swadesh/data/(.+)$",
cat = "Swadesh modules|%1",
},
{
regex = "^Module:typing%-aids",
process = function(title, cats)
local data_suffix = title.fullText:match("^Module:typing%-aids/data/(.+)$")
if data_suffix then
cats:insert("Data modules")
if data_suffix:find "^[%l-]+$" then
local lang = require "Module:languages".getByCode(data_suffix)
if lang then
cats:insert(lang:getCanonicalName() .. " modules")
end
elseif data_suffix:find "^%u%l%l%l$" then
local script = require "Module:scripts".getByCode(data_suffix)
if script then
cats:insert(script:getCategoryName())
end
end
end
end,
},
{
regex = "^Module:R:([a-z%-]+):(.+)$",
process = function(title, cats, lang_code, refname)
local lang = lang_cache[lang_code]
if lang then
cats:insert(lang:getCanonicalName() .. " modules|" .. refname)
cats:insert(("Reference modules|%s"):format(lang:getCanonicalName()))
return mw.getCurrentFrame():preprocess("This module implements the reference template {{temp|R:" ..
lang_code .. ":" .. refname .. "}}.")
end
end,
},
}
function export.show(frame)
local params = {
["hr"] = {},
["for"] = {},
["from"] = {},
["notsubpage"] = { type = "boolean", default = false },
["nodoc"] = { type = "boolean", default = false },
}
local args = require("Module:parameters").process(frame.args, params)
local output = Array('\n<div class="documentation" style="display:block; clear:both">\n')
local cats = Array()
local nodoc = args.nodoc
if (not args.hr) or (args.hr == "above") then
output:insert("----\n")
end
local title = ((args['for'] ~= "") and args['for']) and mw.title.new(args['for'])
or mw.title.getCurrentTitle()
local doc_title = mw.title.new((args['from'] ~= "") and args['from']
or (title.fullText .. '/documentation'))
local contentModel = title.contentModel
local pagetype = mw.getContentLanguage():lcfirst(title.nsText) .. " page"
local preload, fallback_docs, doc_content, doc_content_module,
old_doc_title, user_name, skin_name, needs_doc
if contentModel == "javascript" then
pagetype = "script"
if title.nsText == 'MediaWiki' then
if title.text:find('Gadget-') then
preload = 'Template:documentation/preloadGadget'
else
preload = 'Template:documentation/preloadMediaWikiJavaScript'
end
else
preload = 'Template:documentation/preloadTemplate' -- XXX
end
if title.nsText == 'User' then
user_name = title.rootText
end
elseif contentModel == "css" then
pagetype = "style sheet"
preload = 'Template:documentation/preloadTemplate' -- XXX
if title.nsText == 'User' then
user_name = title.rootText
end
elseif contentModel == "Scribunto" then
pagetype = "module"
user_name = title.rootText:match("^[Uu]ser:(.+)")
if user_name then
preload = 'Template:documentation/preloadModuleSandbox'
else
preload = 'Template:documentation/preloadModule'
end
elseif title.nsText == "Template" then
pagetype = "template"
preload = 'Template:documentation/preloadTemplate'
elseif title.nsText == "Wiktionary" then
pagetype = "project page"
preload = 'Template:documentation/preloadTemplate' -- XXX
end
if doc_title.isRedirect then
old_doc_title = doc_title
doc_title = mw.title.new(string.match(doc_title:getContent(),
"^#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]]-)%]%]"))
end
output:insert("<dl class=\"plainlinks\" style=\"font-size: smaller;\">")
if doc_title.exists then
output:insert(
"<dd><i style=\"font-size: larger;\">The following " ..
"[[Help:Documenting templates and modules|documentation]] is located at [[" ..
doc_title.fullText .. "]]. " ..
"<sup>[[" .. doc_title:fullUrl { action = 'edit' } .. " edit]]</sup> </i></dd>")
else
if contentModel == "Scribunto" then
local automatic_cats = nil
if user_name then
fallback_docs = "documentation/fallback/user module"
automatic_cats = {"User sandbox modules"}
else
for _, data in ipairs(module_regex) do
local captures = {mw.ustring.match(title.fullText, data.regex)}
if #captures > 0 then
local cat
local process_function
if type(data.process) == "function" then
process_function = data.process
elseif type(data.process) == "string" then
doc_content_module = "Module:documentation/functions/" .. data.process
process_function = require(doc_content_module)
end
if process_function then
doc_content = process_function(title, cats, unpack(captures))
end
cat = data.cat
if cat then
if type(cat) == "string" then
cat = {cat}
end
for _, c in ipairs(cat) do
-- gsub() and Lua :gsub() return two arguments, which causes all sorts of problems.
-- Terrible design, there should have been a separate two-argument function.
local gsub_sucks = mw.ustring.gsub(title.fullText, data.regex, c)
table.insert(cats, gsub_sucks)
end
end
break
end
end
end
if not automatic_cats then
local success, auto_cats =
pcall(require("Module:module categorization").categorize, frame, true)
if success then
for _, category in ipairs(auto_cats) do
cats:insert(category)
end
end
end
if title.subpageText == "templates" then
cats:insert("Template interface modules")
end
if automatic_cats then
for _, c in ipairs(automatic_cats) do
cats:insert(c)
end
end
-- meaning module is not in user’s sandbox or one of many datamodule boring series
needs_doc = not (automatic_cats or doc_content or fallback_docs)
elseif title.nsText == "Template" then
--cats:insert("Uncategorized templates")
needs_doc = not (fallback_docs or nodoc)
elseif (contentModel == "css") or (contentModel == "javascript") then
if user_name then
skin_name = skins[title.text:sub(#title.rootText + 1):match("^/([a-z]+)%.[jc]ss?$")]
if skin_name then
fallback_docs = 'documentation/fallback/user ' .. contentModel
end
end
end
if doc_content then
output:insert(
"<dd><i style=\"font-size: larger;\">The following " ..
"[[Help:Documenting templates and modules|documentation]] is " ..
"generated by [[" .. (doc_content_module or "Module:documentation") .. "]]. <sup>[[" ..
mw.title.new("Module:documentation"):fullUrl { action = 'edit' } ..
" edit]]</sup> </i></dd>")
elseif not nodoc then
output:insert(
"<dd><i style=\"font-size: larger;\">This " .. pagetype ..
" lacks a [[Help:Documenting templates and modules|documentation subpage]]. " ..
(fallback_docs and "You may " or "Please ") ..
"[" .. doc_title:fullUrl { action = 'edit', preload = preload }
.. " create it].</i></dd>\n")
end
end
if title.fullText:match("^MediaWiki:Gadget%-") then
local is_gadget = false
local gadget_list = mw.title.new("MediaWiki:Gadgets-definition"):getContent()
for line in mw.text.gsplit(gadget_list, "\n") do
local gadget, opts, items = line:match("^%*%s*([A-Za-z][A-Za-z0-9_%-]*)%[(.-)%]|(.+)$") -- opts is unused
if not gadget then
gadget, items = line:match("^%*%s*([A-Za-z][A-Za-z0-9_%-]*)|(.+)$")
end
if gadget then
items = Array(mw.text.split(items, "|"))
for i, item in ipairs(items) do
if title.fullText == ("MediaWiki:Gadget-" .. item) then
is_gadget = true
output:insert("<dd> ''This script is a part of the <code>")
output:insert(gadget)
output:insert("</code> gadget ([")
output:insert(tostring(mw.uri.fullUrl('MediaWiki:Gadgets-definition', 'action=edit')))
output:insert(" edit definitions])'' <dl>")
output:insert("<dd> ''Description ([")
output:insert(tostring(mw.uri.fullUrl('MediaWiki:Gadget-' .. gadget, 'action=edit')))
output:insert(" edit])'': ")
local gadget_description = mw.message.new('Gadget-' .. gadget):plain()
gadget_description = frame:preprocess(gadget_description)
output:insert(gadget_description)
output:insert(" </dd>")
items:remove(i)
if #items > 0 then
for j, item in ipairs(items) do
items[j] = '[[MediaWiki:Gadget-' .. item .. '|' .. item .. ']]'
end
output:insert("<dd> ''Other parts'': ")
output:insert(mw.text.listToText(items))
output:insert("</dd>")
end
output:insert("</dl></dd>")
break
end
end
end
end
if not is_gadget then
output:insert("<dd> ''This script is not a part of any [")
output:insert(tostring(mw.uri.fullUrl('Special:Gadgets', 'uselang=en')))
output:insert(' gadget] ([')
output:insert(tostring(mw.uri.fullUrl('MediaWiki:Gadgets-definition', 'action=edit')))
output:insert(' edit definitions]).</dd>')
-- else
-- cats:insert("Wiktionary gadgets")
end
end
if old_doc_title then
output:insert("<dd> ''Redirected from'' [")
output:insert(old_doc_title:fullUrl { redirect = 'no' })
output:insert(" ")
output:insert(old_doc_title.fullText)
output:insert("] ([")
output:insert(old_doc_title:fullUrl { action = 'edit' })
output:insert(" edit]).</dd>\n")
end
local links = Array()
if title.isSubpage and not args.notsubpage then
links:insert("[[:" .. title.nsText .. ":" .. title.rootText .. "|root page]]")
links:insert("[[Special:PrefixIndex/" .. title.nsText .. ":" .. title.rootText .. "/|root page’s subpages]]")
else
links:insert("[[Special:PrefixIndex/" .. title.fullText .. "/|subpage list]]")
end
links:insert(
'[' .. tostring(mw.uri.fullUrl('Special:WhatLinksHere/' .. title.fullText,
'hidetrans=1&hideredirs=1')) .. ' links]')
if contentModel ~= "Scribunto" then
links:insert(
'[' .. tostring(mw.uri.fullUrl('Special:WhatLinksHere/' .. title.fullText,
'hidelinks=1&hidetrans=1')) .. ' redirects]')
end
if (contentModel == "javascript") or (contentModel == "css") then
if user_name then
links:insert("[[Special:MyPage" .. title.text:sub(#title.rootText + 1) .. "|your own]]")
end
else
links:insert(
'[' .. tostring(mw.uri.fullUrl('Special:WhatLinksHere/' .. title.fullText,
'hidelinks=1&hideredirs=1')) .. ' transclusions]')
end
if contentModel == "Scribunto" then
local is_testcases = title.isSubpage and title.subpageText == "testcases"
local without_subpage = title.nsText .. ":" .. title.baseText
if is_testcases then
links:insert("[[:" .. without_subpage .. "|tested module]]")
else
links:insert("[[" .. title.fullText .. "/testcases|testcases]]")
end
if user_name then
links:insert("[[User:" .. user_name .. "|user page]]")
links:insert("[[User talk:" .. user_name .. "|user talk page]]")
links:insert("[[Special:PrefixIndex/User:" .. user_name .. "/|userspace]]")
else
-- If sandbox module, add a link to the module that this is a sandbox of.
-- Exclude user sandbox modules like [[User:Dine2016/sandbox]].
if title.text:find("/sandbox%d*%f[/%z]") then
cats:insert("Sandbox modules")
-- Sandbox modules don’t really need documentation.
needs_doc = false
-- Will behave badly if “/sandbox” occurs twice in title!
local sandbox_of = title.fullText:gsub("/sandbox%d*%f[/%z]", "")
local diff
if page_exists(sandbox_of) then
diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")"
else
require("Module:debug").track("documentation/no sandbox of")
end
links:insert("[[:" .. sandbox_of .. "|sandbox of]]" .. (diff or ""))
-- If not a sandbox module, add link to sandbox module.
-- Sometimes there are multiple sandboxes for a single module:
-- [[Module:sa-pronunc/sandbox]], [[Module:sa-pronunc/sandbox2]].
-- Occasionally sandbox modules have their own subpages that are also
-- sandboxes: [[Module:grc-decl/sandbox/decl]].
else
local sandbox_title
if title.fullText:find("^Module:grc%-decl/") then
sandbox_title = title.fullText:gsub("^Module:grc%-decl/", "Module:grc-decl/sandbox/")
elseif is_testcases then
sandbox_title = title.fullText:gsub("/testcases", "/sandbox/testcases")
else
sandbox_title = title.fullText .. "/sandbox"
end
local sandbox_link = "[[:" .. sandbox_title .. "|sandbox]]"
local diff
if page_exists(sandbox_title) then
diff = " (" .. compare_pages(title.fullText, sandbox_title, "diff") .. ")"
end
links:insert(sandbox_link .. (diff or ""))
end
end
end
if title.nsText == "Template" then
-- Error search: all(any namespace), hastemplate (show pages using the template), insource (show source code), incategory (any/specific error) -- [[mw:Help:CirrusSearch]], [[w:Help:Searching/Regex]]
-- apparently same with/without: &profile=advanced&fulltext=1
local errorq = 'searchengineselect=mediawiki&search=all: hastemplate:\"'..title.rootText..'\" insource:\"'..title.rootText..'\" incategory:'
local eincategory = "Pages_with_module_errors|ParserFunction_errors|DisplayTitle_errors|Pages_with_ISBN_errors|Pages_with_ISSN_errors|Pages_with_reference_errors|Pages_with_syntax_highlighting_errors|Pages_with_TemplateStyles_errors"
links:insert(
'[' .. tostring(mw.uri.fullUrl('Special:Search', errorq..eincategory )) .. ' errors]'
.. ' (' ..
'[' .. tostring(mw.uri.fullUrl('Special:Search', errorq..'ParserFunction_errors' )) .. ' parser]'
.. '/' ..
'[' .. tostring(mw.uri.fullUrl('Special:Search', errorq..'Pages_with_module_errors' )) .. ' module]'
.. ')'
)
if title.isSubpage and title.text:find("/sandbox%d*%f[/%z]") then -- This is a sandbox template.
-- At the moment there are no user sandbox templates with subpage
-- “/sandbox”.
cats:insert("Sandbox templates")
-- Sandbox templates don’t really need documentation.
needs_doc = false
-- Will behave badly if “/sandbox” occurs twice in title!
local sandbox_of = title.fullText:gsub("/sandbox%d*%f[/%z]", "")
local diff
if page_exists(sandbox_of) then
diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")"
else
require("Module:debug").track("documentation/no sandbox of")
end
links:insert("[[:" .. sandbox_of .. "|sandbox of]]" .. (diff or ""))
else -- This is a template that can have a sandbox.
local sandbox_title = title.fullText .. "/sandbox"
local diff
if page_exists(sandbox_title) then
diff = " (" .. compare_pages(title.fullText, sandbox_title, "diff") .. ")"
end
links:insert("[[:" .. sandbox_title .. "|sandbox]]" .. (diff or ""))
end
end
if #links > 0 then
output:insert("<dd> ''Useful links'': " .. links:concat(" • ") .. "</dd>")
end
output:insert("</dl>\n")
-- Show error from [[Module:category tree/topic cat/data]] on its submodules'
-- documentation to, for instance, warn about duplicate labels.
if title.fullText:find("Module:category tree/topic cat/data", 1, true) == 1 then
local ok, err = pcall(require, "Module:category tree/topic cat/data")
if not ok then
output:insert('<span class="error">' .. err .. '</span>\n\n')
end
end
if doc_title.exists then
-- Override automatic documentation, if present.
doc_content = frame:expandTemplate { title = doc_title.fullText }
elseif not doc_content and fallback_docs then
doc_content = frame:expandTemplate {
title = fallback_docs;
args = {
['user'] = user_name;
['page'] = title.fullText;
['skin name'] = skin_name;
}
}
end
if doc_content then
output:insert(doc_content)
end
output:insert(('\n<%s style="clear: both;" />'):format(args.hr == "below" and "hr" or "br"))
if not cats[1] and not doc_content then
if contentModel == "Scribunto" then
cats:insert("Uncategorized modules")
-- elseif title.nsText == "Template" then
-- cats:insert("Uncategorized templates")
end
end
if needs_doc then
cats:insert("Templates and modules needing documentation")
end
for _, cat in ipairs(cats) do
output:insert("[[Category:" .. cat .. "]]")
end
output:insert("</div>\n")
return output:concat()
end
-- Used by {{translit module documentation}}.
function export.translitModuleLangList(frame)
local pagename, subpage
if frame.args[1] then
pagename = frame.args[1]
else
local title = mw.title.getCurrentTitle()
subpage = title.subpageText
pagename = title.text
if subpage ~= pagename then
pagename = title.rootText
end
end
local translitModule = pagename
local languageObjects = require("Module:languages/byTranslitModule")(translitModule)
local codeInPagename = pagename:match("^([%l-]+)%-.*translit$")
local categories = Array()
local codeInPagenameInList = false
if codeInPagename then
if languageObjects[1] and subpage ~= "documentation" then
local agreement = languageObjects[2] and "s" or ""
categories:insert("[[Category:Transliteration modules used by " ..
#languageObjects .. " language" .. agreement .. "]]")
end
languageObjects = Array(languageObjects)
:filter(
function (lang)
local result = lang:getCode() ~= codeInPagename
codeInPagenameInList = codeInPagenameInList or result
return result
end)
end
if subpage ~= "documentation" then
for script_code in pagename:gmatch("%f[^-%z]%u%l%l%l%f[-]") do
local script = require "Module:scripts".getByCode(script_code)
if script then
categories:insert("[[Category:" .. script:getCategoryName() .. "]]")
end
end
end
if subpage ~= "documentation" and not page_exists("Module:" .. pagename .. "/testcases") then
categories:insert("[[Category:Transliteration modules without a testcases subpage]]")
end
if not languageObjects[1] then
return categories:concat()
end
local langs = Array(languageObjects)
:sort(
function(lang1, lang2)
return lang1:getCode() < lang2:getCode()
end)
-- This will not error because languageObjects is not empty.
:map(languageObjects[1].makeCategoryLink)
:serial_comma_join()
return "It is " .. ( codeInPagenameInList and "also" or "" ) ..
" used to transliterate " .. langs .. "." .. categories:concat()
end
return export
336j4iird08ev5f8xj0ywmbvtt1ssdt
Module:array
828
2975
8287
2022-07-21T19:26:28Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local Array = {}
local array_constructor
-- Copy table library so as not to unexpectedly change the behavior of code that
-- uses it.
local array_methods = mw.clone(table)
-- Create version of table.sort that returns the table.
array_methods.sort = function (t, comp)
table.sort(t, comp)
return t
end
-- ipairs and unpack operate on arrays.
array_methods.ipairs = ipairs
array_methods.unpack = unpack
function array_methods:type()
local mt = getmetatable(self)
return type(mt) == "table" and mt.__type or nil
end
function array_methods:adjustIndex(index)
index = math.floor(index)
if index < 0 then
index = #self + index + 1
end
return index
end
-- string.sub-style slicing.
function array_methods:slice(i, j)
if i == nil then
i = 1
elseif type(i) == "number" then
i = self:adjust_index(i)
else
error("Expected number, got " .. type(i))
end
if j == nil or type(j) == "number" then
j = self:adjust_index(j or -1)
else
error("Expected number, got " .. type(j))
end
local new_arr = array_constructor()
local k = 0
for index = i, j do
k = k + 1
new_arr[k] = self[index]
end
return new_arr
end
-- A function to convert string key-table modules such
-- as [[Module:languages/data2]] into arrays.
-- "from" is a bad name.
-- field_for_key supplies the field name in which the
-- key will be stored.
local function to_array(map, field_for_key)
m_table = m_table or require "Module:table"
local arr = {}
local i = 0
for key, val in pairs(map) do
i = i + 1
local new_val = m_table.shallowcopy(val)
if field_for_key then
new_val[field_for_key] = key
end
arr[i] = new_val
end
return array_constructor(arr)
end
-- Functions from [[Module:table]] that operate on arrays or sparse arrays.
-- List copied from [[Module:table/documentation]].
local operate_on_array = {
-- non-sparse
"removeDuplicates", "length", "contains", "serialCommaJoin",
"reverseIpairs", "reverse", "invert", "listToSet", "isArray",
-- sparse
"numKeys", "maxIndex", "compressSparseArray", "sparseIpairs",
-- tables in general
"shallowcopy", "deepcopy",
}
-- Not all of these operate on arrays.
local create_new_array = {
-- Functions from [[Module:table]] that create an array.
-- List copied from [[Module:table/documentation]].
"removeDuplicates", "numKeys", "affixNums", "compressSparseArray",
"keysToList", "reverse",
-- Functions from [[Module:table]] that create an table.
"shallowcopy", "deepcopy",
-- Functions from [[Module:fun]] that create an array.
"map", "filter",
}
-- Functions from [[Module:fun]] that take an array in the second argument.
-- They just have to have the argument order reversed to work as methods of the
-- array object.
local second_argument_is_array = { "map", "some", "all", "filter" }
-- Add aliases for the functions from [[Module:table]] whose names
-- contain "array" or "list", which is redundant, and whose names don't conform
-- to the usual camel case.
-- The key redirects to the value.
local alias_of = {
compress = "compressSparseArray", keys = "keysToList", toSet = "listToSet",
deepCopy = "deepcopy", shallowCopy = "shallowcopy",
}
local function get_module_function(key, module, module_name)
return module[key]
or error("No function named " .. tostring(key) .. " in Module:" .. module_name)
end
local function wrap_in_array_constructor(func)
return function (...)
return array_constructor(func(...))
end
end
local function create_array_generating_func(key, module, module_name)
return wrap_in_array_constructor(get_module_function(key, module, module_name))
end
local function reverse_arguments(func)
return function (a, b)
return func(b, a, true)
end
end
local function underscore_to_camel_case(str)
if type(str) ~= "string" then return str end
str = str:gsub("_(.)", string.upper)
return str
end
local m_table, m_fun
local Array = {}
Array.__type = "array"
function Array:__index(key)
if type(key) ~= "string" then
return nil
end
-- Convert underscores to camel case: num_keys -> numKeys.
key = underscore_to_camel_case(key)
local val = array_methods[key]
if val then
return val
end
key = alias_of[key] or key
local func
m_table = m_table or require "Module:table"
if m_table.contains(operate_on_array, key) then
if m_table.contains(create_new_array, key) then
func = create_array_generating_func(key, m_table, "table")
else
func = m_table[key]
end
elseif m_table.contains(second_argument_is_array, key) then
m_fun = m_fun or require "Module:fun"
local raw_func = reverse_arguments(get_module_function(key, m_fun, "fun"))
if m_table.contains(create_new_array, key) then
func = wrap_in_array_constructor(raw_func)
else
func = raw_func
end
elseif key == "fold" then
m_fun = m_fun or require "Module:fun"
local raw_func = get_module_function(key, m_fun, "fun")
func = function(t, func, accum)
return raw_func(func, t, accum)
end
end
if func then
array_methods[key] = func
return func
end
end
function Array.__add(a, b)
if type(a) == 'table' and type(b) == 'table' then
m_table = m_table or require "Module:table"
local new_arr = array_constructor(m_table.shallowcopy(a))
for _, val in ipairs(b) do
new_arr:insert(val)
end
return new_arr
end
end
function Array:new(...)
local arr
if select("#", ...) == 1 and type((...)) == "table" then
arr = ...
local mt = getmetatable(arr)
-- If table has been loaded with mw.loadData, copy it to avoid the
-- limitations of it being a virtual table.
if mt and mt.mw_loadData then
m_table = m_table or require "Module:table"
arr = m_table.shallowcopy(arr)
end
else
arr = { ... }
end
return setmetatable(arr, self)
end
-- Declared as local above.
function array_constructor(...)
return Array:new(...)
end
local array_generating_funcs = { from = to_array }
local Array_library_mt = {
__call = Array.new, __index = array_generating_funcs
}
setmetatable(Array, Array_library_mt)
function Array_library_mt:__index(key)
key = underscore_to_camel_case(key)
key = alias_of[key] or key
if array_generating_funcs[key] then
return array_generating_funcs[key]
end
m_table = m_table or require "Module:table"
if m_table.contains(create_new_array, key) then
local func = create_array_generating_func(key, m_table, "table")
array_generating_funcs[key] = func
return func
end
end
return Array
0xqegsnmoi0ytt538j00om4leq9onzn
Template:temp
10
2976
8288
2022-07-22T03:00:08Z
Rebel Agent
2678
Ke dirile tempolete
wikitext
text/x-wiki
{{safesubst:<noinclude></noinclude>#invoke:template link|format_link}}<noinclude>{{documentation}}</noinclude>
hxjpg9dwvwj7zi4ktw8vqtcsxfwdnh0
Module:template link
828
2977
8289
2022-07-22T03:03:10Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local date_and_time = "mw:Help:Magic words#Date and time"
local technical_metadata = "mw:Help:Magic words#Technical metadata"
local tech_meta_another_page = "mw:Help:Magic words#Technical metadata of another page"
local page_names = "mw:Help:Magic words#Page names"
local namespaces = "mw:Help:Magic words#Namespaces"
local formatting = "mw:Help:Magic words#Formatting"
local URL_data = "mw:Help:Magic words#URL data"
local localization = "mw:Help:Magic words#Localization"
local miscellaneous = "mw:Help:Magic words#Miscellaneous"
local parser_functions_link = "mw:Help:Extension:ParserFunctions"
local LST = "mw:Extension:Labeled Section Transclusion"
local variables_nullary = {
["CURRENTYEAR" ] = date_and_time;
["CURRENTMONTH" ] = date_and_time;
["CURRENTMONTH1" ] = date_and_time; -- undocumented
["CURRENTMONTH2" ] = date_and_time; -- undocumented
["CURRENTMONTHNAME" ] = date_and_time;
["CURRENTMONTHNAMEGEN"] = date_and_time;
["CURRENTMONTHABBREV" ] = date_and_time;
["CURRENTDAY" ] = date_and_time;
["CURRENTDAY2" ] = date_and_time;
["CURRENTDOW" ] = date_and_time;
["CURRENTDAYNAME" ] = date_and_time;
["CURRENTTIME" ] = date_and_time;
["CURRENTHOUR" ] = date_and_time;
["CURRENTWEEK" ] = date_and_time;
["CURRENTTIMESTAMP" ] = date_and_time;
["LOCALYEAR" ] = date_and_time;
["LOCALMONTH" ] = date_and_time;
["LOCALMONTH1" ] = date_and_time; -- undocumented
["LOCALMONTH2" ] = date_and_time; -- undocumented
["LOCALMONTHNAME" ] = date_and_time;
["LOCALMONTHNAMEGEN" ] = date_and_time;
["LOCALMONTHABBREV" ] = date_and_time;
["LOCALDAY" ] = date_and_time;
["LOCALDAY2" ] = date_and_time;
["LOCALDOW" ] = date_and_time;
["LOCALDAYNAME" ] = date_and_time;
["LOCALTIME" ] = date_and_time;
["LOCALHOUR" ] = date_and_time;
["LOCALWEEK" ] = date_and_time;
["LOCALTIMESTAMP" ] = date_and_time;
["SITENAME" ] = technical_metadata;
["SERVER" ] = technical_metadata;
["SERVERNAME" ] = technical_metadata;
["DIRMARK" ] = technical_metadata;
["DIRECTIONMARK" ] = technical_metadata;
["ARTICLEPATH" ] = technical_metadata; -- undocumented
["SCRIPTPATH" ] = technical_metadata;
["STYLEPATH" ] = technical_metadata;
["CURRENTVERSION" ] = technical_metadata;
["CONTENTLANGUAGE" ] = technical_metadata;
["CONTENTLANG" ] = technical_metadata;
["PAGEID" ] = technical_metadata;
["CASCADINGSOURCES" ] = technical_metadata;
["REVISIONID" ] = technical_metadata;
["REVISIONDAY" ] = technical_metadata;
["REVISIONDAY2" ] = technical_metadata;
["REVISIONMONTH" ] = technical_metadata;
["REVISIONMONTH1" ] = technical_metadata;
["REVISIONYEAR" ] = technical_metadata;
["REVISIONTIMESTAMP" ] = technical_metadata;
["REVISIONUSER" ] = technical_metadata;
["REVISIONSIZE" ] = technical_metadata;
["NUMBEROFPAGES" ] = technical_metadata;
["NUMBEROFARTICLES" ] = technical_metadata;
["NUMBEROFFILES" ] = technical_metadata;
["NUMBEROFEDITS" ] = technical_metadata;
["NUMBEROFVIEWS" ] = technical_metadata;
["NUMBEROFUSERS" ] = technical_metadata;
["NUMBEROFADMINS" ] = technical_metadata;
["NUMBEROFACTIVEUSERS"] = technical_metadata;
["FULLPAGENAME" ] = page_names;
["PAGENAME" ] = page_names;
["BASEPAGENAME" ] = page_names;
["SUBPAGENAME" ] = page_names;
["SUBJECTPAGENAME" ] = page_names;
["ARTICLEPAGENAME" ] = page_names;
["TALKPAGENAME" ] = page_names;
["ROOTPAGENAME" ] = page_names; -- undocumented
["FULLPAGENAMEE" ] = page_names;
["PAGENAMEE" ] = page_names;
["BASEPAGENAMEE" ] = page_names;
["SUBPAGENAMEE" ] = page_names;
["SUBJECTPAGENAMEE" ] = page_names;
["ARTICLEPAGENAMEE" ] = page_names;
["TALKPAGENAMEE" ] = page_names;
["ROOTPAGENAMEE" ] = page_names; -- undocumented
["NAMESPACE" ] = namespaces;
["NAMESPACENUMBER" ] = namespaces;
["SUBJECTSPACE" ] = namespaces;
["ARTICLESPACE" ] = namespaces;
["TALKSPACE" ] = namespaces;
["NAMESPACEE" ] = namespaces;
["SUBJECTSPACEE" ] = namespaces;
["TALKSPACEE" ] = namespaces;
["!" ] = "mw:Help:Magic words#Other";
}
local variables_nonnullary = {
["PROTECTIONLEVEL" ] = technical_metadata;
["DISPLAYTITLE" ] = technical_metadata;
["DEFAULTSORT" ] = technical_metadata;
["PAGESINCATEGORY" ] = technical_metadata;
["PAGESINCAT" ] = technical_metadata;
["NUMBERINGROUP" ] = technical_metadata;
["PAGESINNS" ] = technical_metadata;
["PAGESINNAMESPACE" ] = technical_metadata;
["FULLPAGENAME" ] = page_names;
["PAGENAME" ] = page_names;
["BASEPAGENAME" ] = page_names;
["SUBPAGENAME" ] = page_names;
["SUBJECTPAGENAME" ] = page_names;
["ARTICLEPAGENAME" ] = page_names;
["TALKPAGENAME" ] = page_names;
["ROOTPAGENAME" ] = page_names; -- undocumented
["FULLPAGENAMEE" ] = page_names;
["PAGENAMEE" ] = page_names;
["BASEPAGENAMEE" ] = page_names;
["SUBPAGENAMEE" ] = page_names;
["SUBJECTPAGENAMEE" ] = page_names;
["ARTICLEPAGENAMEE" ] = page_names;
["TALKPAGENAMEE" ] = page_names;
["ROOTPAGENAMEE" ] = page_names; -- undocumented
["NAMESPACE" ] = namespaces;
["NAMESPACENUMBER" ] = namespaces;
["SUBJECTSPACE" ] = namespaces;
["ARTICLESPACE" ] = namespaces;
["TALKSPACE" ] = namespaces;
["NAMESPACEE" ] = namespaces;
["SUBJECTSPACEE" ] = namespaces;
["TALKSPACEE" ] = namespaces;
["PAGEID" ] = tech_meta_another_page;
["PAGESIZE" ] = tech_meta_another_page;
["PROTECTIONLEVEL" ] = tech_meta_another_page;
["CASCADINGSOURCES" ] = tech_meta_another_page;
["REVISIONID" ] = tech_meta_another_page;
["REVISIONDAY" ] = tech_meta_another_page;
["REVISIONDAY2" ] = tech_meta_another_page;
["REVISIONMONTH" ] = tech_meta_another_page;
["REVISIONMONTH1" ] = tech_meta_another_page;
["REVISIONYEAR" ] = tech_meta_another_page;
["REVISIONTIMESTAMP" ] = tech_meta_another_page;
["REVISIONUSER" ] = tech_meta_another_page;
}
local parser_functions = {
-- built-ins
["localurl" ] = URL_data;
["localurle" ] = URL_data;
["fullurl" ] = URL_data;
["fullurle" ] = URL_data;
["canonicalurl" ] = URL_data;
["canonicalurle"] = URL_data;
["filepath" ] = URL_data;
["urlencode" ] = URL_data;
["urldecode" ] = URL_data;
["anchorencode" ] = URL_data;
["ns" ] = namespaces;
["nse" ] = namespaces;
["formatnum" ] = formatting;
["#dateformat" ] = formatting;
["#formatdate" ] = formatting;
["lc" ] = formatting;
["lcfirst" ] = formatting;
["uc" ] = formatting;
["ucfirst" ] = formatting;
["padleft" ] = formatting;
["padright" ] = formatting;
["plural" ] = localization;
["grammar" ] = localization;
["gender" ] = localization;
["int" ] = localization;
["#language" ] = miscellaneous;
["#special" ] = miscellaneous;
["#speciale" ] = miscellaneous;
["#tag" ] = miscellaneous;
-- [[mw:Extension:ParserFunctions]]
["#expr" ] = parser_functions_link .. "##expr";
["#if" ] = parser_functions_link .. "##if";
["#ifeq" ] = parser_functions_link .. "##ifeq";
["#iferror" ] = parser_functions_link .. "##iferror";
["#ifexpr" ] = parser_functions_link .. "##ifexpr";
["#ifexist" ] = parser_functions_link .. "##ifexist";
["#rel2abs" ] = parser_functions_link .. "##rel2abs";
["#switch" ] = parser_functions_link .. "##switch";
["#time" ] = parser_functions_link .. "##time";
["#timel" ] = parser_functions_link .. "##timel";
["#titleparts" ] = parser_functions_link .. "##titleparts";
-- other extensions
["#invoke" ] = "mw:Extension:Scribunto";
["#babel" ] = "mw:Extension:Babel";
["#categorytree" ] = "mw:Extension:CategoryTree#The {{#categorytree}} parser function";
["#lst" ] = LST;
["#lstx" ] = LST;
["#lsth" ] = LST; -- not available, it seems
["#lqtpagelimit" ] = "mw:Extension:LiquidThreads";
["#useliquidthreads"] = "mw:Extension:LiquidThreads";
["#target" ] = "mw:Extension:MassMessage"; -- not documented yet
}
-- rudimentary
local function is_valid_pagename(pagename)
if (pagename == "") or pagename:match("[%[%]%|%{%}#\127<>]") then
return false
end
return true
end
local function hook_special(page)
if is_valid_pagename(page) then
return "[[Special:" .. page .. "|" .. page .. "]]"
else
return page
end
end
local parser_function_hooks = {
["#special" ] = hook_special;
["#speciale"] = hook_special;
["int"] = function (mesg)
if is_valid_pagename(mesg) then
return ("[[:MediaWiki:" .. mesg .. "|" .. mesg .. "]]")
else
return mesg
end
end;
["#categorytree"] = function (cat)
if is_valid_pagename(cat) and not (mw.title.getCurrentTitle().fullText == ("Category:" .. cat)) then
return ("[[:Category:" .. cat .. "|" .. cat .. "]]")
else
return cat
end
end;
["#invoke"] = function (mod)
if is_valid_pagename(mod) and not (mw.title.getCurrentTitle().fullText == ("Module:" .. mod)) then
return ("[[Module:%s|%s]]"):format(mod, mod)
else
return mod
end
end;
["#tag"] = function (tag)
local doc_table = require('Module:wikitag link').doc_table
if doc_table[tag] then
return ("[[%s|%s]]"):format(doc_table[tag], tag)
else
return tag
end
end;
}
function export.format_link(frame)
if mw.isSubsting() then
return require('Module:unsubst').unsubst_template("format_link")
end
local args = (frame.getParent and frame:getParent().args) or frame -- Allows function to be called from other modules.
local output = { (frame.args and frame.args.nested) and "{{" or "<code>{{" }
local templ = (frame.args and frame.args.annotate) or args[1]
local noargs = (frame.args and not frame.args.annotate) and next(args) == nil
if not templ then
if mw.title.getCurrentTitle().fullText == frame:getParent():getTitle() then
-- demo mode
return "<code>{{<var>{{{1}}}</var>|<var>{{{2}}}</var>|...}}</code>"
else
error("The template name must be given.")
end
end
local function render_title(templ)
local marker, rest
marker, rest = templ:match("^([Ss][Uu][Bb][Ss][Tt]):(.*)")
if not marker then
marker, rest = templ:match("^([Ss][Aa][Ff][Ee][Ss][Uu][Bb][Ss][Tt]):(.*)")
end
if marker then
templ = rest
table.insert(output, ("[[mw:Manual:Substitution|%s]]:"):format(marker))
end
if noargs and variables_nullary[templ] then
table.insert(output, ("[[%s|%s]]"):format(variables_nullary[templ], templ))
return
end
marker, rest = templ:match("^([Mm][Ss][Gg][Nn][Ww]):(.*)")
if marker then
templ = rest
-- not the most accurate documentation ever
table.insert(output, ("[[m:Help:Magic words#Template modifiers|%s]]:"):format(marker))
else
marker, rest = templ:match("^([Mm][Ss][Gg]):(.*)")
if marker then
templ = rest
table.insert(output, ("[[m:Help:Magic words#Template modifiers|%s]]:"):format(marker)) -- ditto
end
end
marker, rest = templ:match("^([Rr][Aa][Ww]):(.*)")
if marker then
table.insert(output, ("[[m:Help:Magic words#Template modifiers|%s]]:"):format(marker)) -- missingno.
templ = rest
end
if templ:match("^%s*/") then
table.insert(output, ("[[%s]]"):format(templ))
return
end
marker, rest = templ:match("^(.-):(.*)")
if marker then
local lcmarker = marker:lower()
if parser_functions[lcmarker] then
if parser_function_hooks[lcmarker] then
rest = parser_function_hooks[lcmarker](rest)
end
table.insert(output, ("[[%s|%s]]:%s"):format(mw.uri.encode(parser_functions[lcmarker], "WIKI"), marker, rest))
return
elseif variables_nonnullary[marker] then
table.insert(output, ("[[%s|%s]]:%s"):format(variables_nonnullary[marker], marker, rest))
return
end
end
if not is_valid_pagename(templ) then
table.insert(output, templ)
return
end
if marker then
if mw.site.namespaces[marker] then
if (title == "") or (mw.title.getCurrentTitle().fullText == templ) then -- ?? no such variable "title"
table.insert(output, templ)
elseif marker == "" and templ:find("^:") then
-- for cases such as {{temp|:entry}}; MediaWiki displays [[:entry]] without a colon, like [[entry]], but colon should be shown
table.insert(output, ("[[%s|%s]]"):format(templ, templ))
else
table.insert(output, ("[[:%s|%s]]"):format(templ, templ))
end
return
elseif mw.site.interwikiMap()[marker:lower()] then
-- XXX: not sure what to do now…
table.insert(output, ("[[:%s:|%s]]:%s"):format(marker, marker, rest))
return
end
end
if (templ == "") or (mw.title.getCurrentTitle().fullText == ("Template:" .. templ)) then
table.insert(output, templ)
else
table.insert(output, ("[[Template:%s|%s]]"):format(templ, templ))
end
end
render_title(templ)
local i = (frame.args and frame.args.annotate) and 1 or 2
while args[i] do
table.insert(output, "|" .. args[i])
i = i + 1
end
for key, value in require("Module:table").sortedPairs(args) do
if type(key) == "string" then
table.insert(output, "|" .. key .. "=" .. value)
end
end
table.insert(output, (frame.args and frame.args.nested) and "}}" or "}}</code>")
return table.concat(output)
end
return export
cy6xa1x3igx8v32yt0p1sxatf4d38ex
Template:l
10
2978
8290
2022-07-22T08:45:00Z
Rebel Agent
2678
Ke dirile template
wikitext
text/x-wiki
{{#invoke:links/templates|l_term_t<noinclude>|demo=term</noinclude>}}<!--
-->{{#ifeq:{{PAGENAME}}|RecentChanges||<!--
-->{{#ifeq:{{{1|}}}|und|[[Category:Undetermined language links]]}}<!--
-->}}<!--
-->{{redlink category|{{{1|}}}|{{{2|}}}|template=l}}<!--
--><noinclude>{{documentation}}</noinclude>
99mqntzbd62dvi0u0aty63zyqj6joo9
Module:links/templates
828
2979
8291
2022-07-22T08:47:32Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
--[=[
Modules used:
[[Module:links]]
[[Module:languages]]
[[Module:scripts]]
[[Module:parameters]]
[[Module:debug]]
]=]
-- Used in [[Template:l]] and [[Template:m]].
function export.l_term_t(frame)
local face = frame.args["face"]
local allowSelfLink = frame.args["notself"]; allowSelfLink = not allowSelfLink or allowSelfLink == ""
local params = {
[1] = {required = true},
[2] = {},
[3] = {},
[4] = {alias_of = "gloss"},
["accel-form"] = {},
["accel-translit"] = {},
["accel-lemma"] = {},
["accel-lemma-translit"] = {},
["accel-gender"] = {},
["accel-nostore"] = {type = "boolean"},
["g"] = {list = true},
["gloss"] = {},
["id"] = {},
["lit"] = {},
["pos"] = {},
["t"] = {alias_of = "gloss"},
["tr"] = {},
["ts"] = {},
["sc"] = {},
}
-- Compatibility mode for {{term}}.
-- If given a nonempty value, the function uses lang= to specify the
-- language, and all the positional parameters shift one number lower.
local compat = (frame.args["compat"] or "") ~= ""
if compat then
params["lang"] = {},
table.remove(params, 1)
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = args[compat and "lang" or 1]
-- Tracking for missing language or und
if not lang then
require("Module:debug").track("link/no lang")
elseif lang == "und" then
require("Module:debug").track("link/und")
end
lang = lang or "und"
local sc = args["sc"]
local term = args[(compat and 1 or 2)]
local alt = args[(compat and 2 or 3)]
-- Check parameters
lang = require("Module:languages").getByCode(lang, 1, "allow etym")
lang = require("Module:languages").getNonEtymological(lang)
if sc then
sc = require("Module:scripts").getByCode(sc, "sc")
end
if not term and not alt and frame.args["demo"] then
term = frame.args["demo"]
end
-- Forward the information to full_link
return require("Module:links").full_link(
{
lang = lang,
sc = sc,
term = term,
alt = alt,
id = args["id"],
tr = args["tr"],
ts = args["ts"],
genders = args["g"],
gloss = args["gloss"],
pos = args["pos"],
lit = args["lit"],
accel = args["accel-form"] and {
form = args["accel-form"],
translit = args["accel-translit"],
lemma = args["accel-lemma"],
lemma_translit = args["accel-lemma-translit"],
gender = args["accel-gender"],
nostore = args["accel-nostore"],
} or nil,
},
face,
allowSelfLink
)
end
-- Used in [[Template:ll]].
function export.ll(frame)
local params = {
[1] = { required = true },
[2] = { allow_empty = true },
[3] = {},
["notself"] = { type = "boolean", default = false },
["id"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local allowSelfLink = not args["notself"]
local lang = args[1]
lang = require("Module:languages").getByCode(lang, 1, "allow etym")
lang = require("Module:languages").getNonEtymological(lang)
local text = args[2]
local alt = args[3]
if text == "" then
return alt or ""
end
local id = args["id"]
return require("Module:links").language_link(
{
term = text,
alt = alt,
lang = lang,
id = id
},
allowSelfLink
)
end
function export.def_t(frame)
local params = {
[1] = {required = true, default = ""},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
return require("Module:links").english_links(args[1])
end
function export.linkify_t(frame)
local params = {
[1] = {required = true, default = ""},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
args[1] = mw.text.trim(args[1])
if args[1] == "" or args[1]:find("[[", nil, true) then
return args[1]
else
return "[[" .. args[1] .. "]]"
end
end
function export.section_link_t(frame)
local params = {
[1] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
return require("Module:links").section_link(args[1])
end
function export.language_name_link_t(frame)
local face = frame.args["face"]
local allowSelfLink = frame.args["notself"]; allowSelfLink = not allowSelfLink or allowSelfLink == ""
local params = {
[1] = {required = true},
[2] = {},
[3] = {},
[4] = {alias_of = "gloss"},
["g"] = {list = true},
["gloss"] = {},
["id"] = {},
["lit"] = {},
["pos"] = {},
["t"] = {alias_of = "gloss"},
["tr"] = {},
["ts"] = {},
["sc"] = {},
["w"] = { type = "boolean", default = false },
}
-- Compatibility mode for {{term}}.
-- If given a nonempty value, the function uses lang= to specify the
-- language, and all the positional parameters shift one number lower.
local compat = (frame.args["compat"] or "") ~= ""
if compat then
params["lang"] = {},
table.remove(params, 1)
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = args[compat and "lang" or 1]
-- Tracking for missing language or und
if not lang then
require("Module:debug").track("link/no lang")
elseif lang == "und" then
require("Module:debug").track("link/und")
end
lang = lang or "und"
local sc = args["sc"]
local term = args[(compat and 1 or 2)]
local alt = args[(compat and 2 or 3)]
-- Check parameters
lang = require("Module:languages").getByCode(lang, 1, "allow etym")
local non_etym_lang = require("Module:languages").getNonEtymological(lang)
if sc then
sc = require("Module:scripts").getByCode(sc, "sc")
end
if not term and not alt and frame.args["demo"] then
term = frame.args["demo"]
end
--[[
Add a language name, linked to Wikipedia if the Wikipedia parameter is set to true.
Forward the information to full_link.
]]
local language_name = args.w and lang:makeWikipediaLink() or lang:getCanonicalName()
if term == "-" then
return language_name
else
return language_name .. " " ..
require("Module:links").full_link(
{
lang = non_etym_lang,
sc = sc,
term = term,
alt = alt,
id = args["id"],
tr = args["tr"],
ts = args["ts"],
genders = args["g"],
gloss = args["gloss"],
pos = args["pos"],
lit = args["lit"]
},
face,
allowSelfLink
)
end
end
return export
c74idvbcjv5qumy4nemez9113m0f9co
Module:debug
828
2980
8292
2022-07-22T08:51:17Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local escape
do
local escapes = {
["\a"] = "a", ["\b"] = "b", ["\f"] = "f", ["\n"] = "n", ["\r"] = "r",
["\t"] = "t", ["\v"] = "v", ["\\"] = "\\", ["\""] = '"', ["'"] = "'",
}
local function helper(char)
return escapes[char] and "\\" .. escapes[char]
or ("\\%03d"):format(char:byte())
end
-- Escape control characters, backslash, double quote, and bytes that aren't
-- used in UTF-8.
-- Escape stuff that can't be saved in a MediaWiki page, like invalid UTF-8
-- and NFD character sequences? Hard.
-- Similar to string.format("%q", str), which does not use C-like simple
-- escapes and does not escape bytes that are not used in UTF-8.
escape = function (str)
return (str:gsub("[%z\1-\31\\\"\127\192\193\245-\255]", helper))
end
end
export.escape = escape
-- Convert a value to a string
function export.dump(value, prefix, tsort)
local t = type(value)
prefix = prefix or ""
if t == "string" then
return '"' .. escape(value) .. '"'
elseif t == "table" then
local str_table = {}
table.insert(str_table, " {")
for key, val in require("Module:table").sortedPairs(value, tsort) do
table.insert(str_table, " " .. prefix .. "\t[" .. export.dump(key, prefix .. "\t") .. "] = " .. export.dump(val, prefix .. "\t"):gsub("^ ", "") .. ",")
end
table.insert(str_table, " " .. prefix .. "}")
return table.concat(str_table, "\n")
else
return tostring(value)
end
end
function export.highlight_dump(value, prefix, tsort, options)
options = options or {}
local func = options.modified and "modified_dump" or "dump"
local dump = export[func](value, prefix, tsort)
-- Remove spaces at beginnings of lines (which are simply to force a <pre></pre> tag).
dump = dump:gsub("%f[^%z\n] ", "")
return export.highlight(dump)
end
-- Returns true if table contains a table as one of its values
local function containsTable(t)
for key, value in pairs(t) do
if type(value) == "table" then
return true
end
end
return false
end
local function containsTablesWithSize(t, size)
for key, value in pairs(t) do
if type(value) == "table" and require("Module:table").size(value) ~= size then
return false
end
end
return true
end
--[=[
Convert a value to a string.
Like dump below, but if a table has consecutive numbered keys and does not
have a table as one of its values, it will be placed on a single line.
Used by [[Module:User:Erutuon/script recognition]].
]=]
function export.modified_dump(value, prefix, tsort)
local t = type(value)
prefix = prefix or ""
if t == "string" then
return '"' .. value .. '"'
elseif t == "table" then
local str_table = {}
local containsTable = containsTable(value)
local consecutive = require("Module:table").isArray(value)
if consecutive and not containsTable or containsTable and containsTablesWithSize(value, 3) then
table.insert(str_table, "{")
for key, val in require("Module:table").sortedPairs(value, tsort) do
if containsTable then
table.insert(str_table, "\n\t" .. prefix)
else
table.insert(str_table, " ")
end
if type(key) == "string" then
table.insert(str_table, "[" .. export.modified_dump(key) .. "] = ")
end
table.insert(str_table, type(key) == "number" and type(val) == "number" and string.format("0x%05X", val) or export.modified_dump(val))
if not (consecutive and #value == 3) or type(key) == "number" and value[key + 1] then
table.insert(str_table, ",")
end
end
if containsTable then
table.insert(str_table, "\n" .. prefix)
else
table.insert(str_table, " ")
end
table.insert(str_table, "}")
return table.concat(str_table)
end
table.insert(str_table, " {")
for key, val in require("Module:table").sortedPairs(value, tsort) do
table.insert(str_table, " " .. prefix .. "\t[" .. export.modified_dump(key, prefix .. "\t") .. "] = " .. export.modified_dump(val, prefix .. "\t"):gsub("^ ", "") .. ",")
end
table.insert(str_table, " " .. prefix .. "}")
return table.concat(str_table, "\n")
elseif t == "number" and value > 46 then
return string.format("0x%05X", value)
else
return tostring(value)
end
end
export.track = require("Module:debug/track")
-- Trigger a script error from a template
function export.error(frame)
error(frame.args[1] or "(no message specified)")
end
--[[
Convenience function for generating syntaxhighlight tags.
Display defaults to block.
Options is a table. To display inline text with HTML highlighting:
{ inline = true, lang = "html" }
]]
function export.highlight(content, options)
if type(content) == "table" then
options = content
options = {
lang = options.lang or "lua",
inline = options.inline and true
}
return function(content)
return mw.getCurrentFrame():extensionTag{
name = "syntaxhighlight",
content = content,
args = options
}
end
else
return mw.getCurrentFrame():extensionTag{
name = "syntaxhighlight",
content = content,
args = {
lang = options and options.lang or "lua",
inline = options and options.inline and true or nil
}
}
end
end
function export.track_unrecognized_args(args, template_name)
local function track(code)
export.track(template_name .. "/" .. code)
end
track("unrecognized arg")
local arg_list = {}
for arg, value in pairs(args) do
track("unrecognized arg/" .. arg)
table.insert(arg_list, ("|%s=%s"):format(arg, value))
end
mw.log(
("Unrecognized parameter%s in {{%s}}: %s."):format(
arg_list[2] and "s" or "",
template_name,
table.concat(arg_list, ", ")))
end
return export
lh9pml9xbqqss9zincq7y36za820tt6
Module:debug/track
828
2981
8293
2022-07-22T08:53:19Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
return function (key)
local frame = mw.getCurrentFrame()
if key then
if type(key) ~= "table" then
key = { key }
end
for i, value in pairs(key) do
pcall(frame.expandTemplate, frame, { title = 'tracking/' .. value })
end
else
error('No tracking key supplied to the function "' .. track .. '".')
end
end
332d44anbo5v9lwub0vhfkjrof53szz
Module:accent qualifier/data
828
2982
8294
2022-07-22T08:56:33Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local labels = {}
local aliases = {}
local CE = '<small class="ce-date2">CE</small>'
local BCE = '<small class="ce-date2">BCE</small>'
-- A
labels["AAVE"] = {
link = "African American Vernacular English",
display = "AAVE"
}
aliases["African American Vernacular English"] = "AAVE"
aliases["African American Vernacular"] = "AAVE"
aliases["African-American Vernacular English"] = "AAVE"
aliases["African-American Vernacular"] = "AAVE"
labels["æ-tensing"] = {
link = "æ-tensing",
type = "sound change"
}
aliases["ae-tensing"] = "æ-tensing"
labels["afb"] = {
link = "Gulf Arabic",
display = "Gulf Arabic"
}
aliases["Gulf"] = "afb"
aliases["Khaleeji"] = "afb"
aliases["Gulfie"] = "afb"
labels["Ala-Laukaa"] = {
link = "Ingrian phonology#Ala-Laukaa dialect",
display = "Ala-Laukaa"
}
labels["Anglicised"] = {
link = "Anglicisation#Anglicisation of non-English-language vocabulary and names",
display = "Anglicised"
}
aliases["Anglicized"] = "Anglicised"
labels["Aran"] = {
link = "Aran Islands",
display = "Aran"
}
labels["ar-Cairene"] = {
link = "Egyptian Arabic",
display = "Cairene"
}
aliases["Cairene"] = "ar-Cairene"
labels["Arvanite"] = {
link = "Arvanitika",
display = "Arvanite"
}
labels["Ashkenazi Hebrew"] = {
link = "Ashkenazi Hebrew",
display = "Ashkenazi Hebrew"
}
aliases["Ashkenazi"] = "Ashkenazi Hebrew"
labels["Australia"] = {
link = "Australian English phonology",
display = "General Australian"
}
aliases["AU"] = "Australia"
aliases["AuE"] = "Australia"
aliases["Aus"] = "Australia"
aliases["AusE"] = "Australia"
aliases["GenAus"] = "Australia"
aliases["General Australian"] = "Australia"
-- B
labels["Balearic Catalan"] = {
link = "Balearic dialect",
display = "Balearic",
}
aliases["Balearic"] = "Balearic Catalan"
labels["Batangas"] = {
link = "Batangas Tagalog",
display = "Batangas"
}
aliases["Batangas Tagalog"] = "Batangas"
aliases["Batangueño"] = "Batangas"
labels["BE-nl"] = {
link = "Belgian Dutch",
display = "Belgium"
}
aliases["BE"] = "BE-nl"
labels["Beijing"] = {
link = "Beijing dialect",
display = "Beijing"
}
labels["Bohol"] = {
link = "Boholano dialect",
display = "Bohol"
}
aliases["Binol-anon"] = "Bohol"
aliases["Boholano"] = "Bohol"
aliases["Bohol Island"] = "Bohol"
aliases["Bohol Province"] = "Bohol"
labels["Bosnia"] = {
link = "Comparison of standard Bosnian, Croatian, Montenegrin and Serbian#Accentuation",
display = "Bosnia"
}
aliases["Bosnian"] = "Bosnia"
labels["Boston"] = {
link = "Boston English",
display = "Boston"
}
aliases["Bos"] = "Boston"
labels["Brazil"] = {
link = "Brazilian Portuguese",
display = "Brazil"
}
aliases["BP"] = "Brazil"
aliases["BR"] = "Brazil"
aliases["Brazilian Portuguese"] = "Brazil"
labels["Burträsk"] = {
link = "Burträsk",
}
labels["Bygdeå"] = {
link = "Bygdeå",
}
-- C
labels["Canada"] = {
link = "Canadian English",
display = "Canada"
}
aliases["CA"] = "Canada"
aliases["Canadian"] = "Canada"
labels["Canadian Shift"] = {
link = "Canadian Shift",
display = "Canadian Vowel Shift",
type = "sound change"
}
aliases["Canadian shift"] = "Canadian Shift"
aliases["Canadian Vowel Shift"] = "Canadian Shift"
aliases["Canadian vowel shift"] = "Canadian Shift"
labels["Rio de Janeiro"] = {
link = "Carioca#Sociolect",
display = "Rio de Janeiro"
}
aliases["RJ"] = "Rio de Janeiro"
aliases["Carioca"] = "Rio de Janeiro"
labels["Castilian"] = {
link = "Castilian Spanish",
display = "Castilian"
}
aliases["Spain"] = "Castilian"
labels["Central Catalan"] = {
link = "Central Catalan",
display = "Central",
}
labels["central Germany"] = {
display = "central Germany"
}
aliases["central German"] = "central Germany"
aliases["Central German"] = "central Germany"
aliases["Central Germany"] = "central Germany"
labels["central Italy"] = {
link = "Central Italian",
display = "central Italy"
}
aliases["central Italian"] = "central Italy"
aliases["Central Italian"] = "central Italy"
aliases["Central Italy"] = "central Italy"
labels["Central Scotland"] = {
link = "Central Scots",
display = "Central Scotland"
}
labels["Central Sweden"] = {
link = "Central Swedish",
display = "Central Sweden"
}
aliases["Central Swedish"] = "Central Sweden"
labels["ceceo"] = {
link = "ceceo",
display = "''ceceo'' merger",
type = "sound change"
}
labels["Clay"] = {
link = "Clay Frisian",
display = "Clay",
}
labels["Classical"] = {
link = "Classical Latin",
display = "Classical"
}
labels["Classical Persian"] = {
link = "Persian_language#Classical_Persian",
display = "Classical Persian"
}
labels["Classical Sanskrit"] = {
link = "Sanskrit#Classical Sanskrit",
display = "Classical"
}
labels["Cois Fharraige"] = {
link = "Gaeltacht Cois Fharraige",
display = "Cois Fharraige"
}
aliases["CF"] = "Cois Fharraige"
labels["Connacht"] = {
link = "Connacht Irish",
display = "Connacht"
}
labels["Connemara"] = {
link = "Connemara",
display = "Connemara"
}
aliases["Conamara"] = "Connemara"
labels["Cork"] = {
link = "Gaeltacht#Cork Gaeltacht",
display = "Cork"
}
aliases["West Cork"] = "Cork"
aliases["West Muskerry"] = "Cork"
labels["cot-caught"] = {
link = "Cot–caught merger",
display = "''cot''–''caught'' merger",
type = "sound change"
}
aliases["caught-cot"] = "cot-caught"
labels["Croatia"] = {
link = "Comparison of standard Bosnian, Croatian, Montenegrin and Serbian#Accentuation",
display = "Croatia"
}
aliases["Croatian"] = "Croatia"
labels["cure-force"] = {
link = "Cure–force merger",
display = "''cure''–''force'' merger",
type = "sound change"
}
aliases["pour-poor"] = "cure-force"
labels["cure-nurse"] = {
link = "Cure-nurse merger",
display = "''cure''–''nurse'' merger",
type = "sound change"
}
aliases["cure-fir"] = "cure-nurse"
labels["cy-N"] = {
link = "Welsh language#Dialects",
display = "North Wales"
}
aliases["cy-g"] = "cy-N"
aliases["North Wales"] = "cy-N"
labels["cy-S"] = {
link = "Welsh language#Dialects",
display = "South Wales"
}
aliases["cy-h"] = "cy-S"
aliases["South Wales"] = "cy-S"
-- D
labels["Dhakaiya"] = {
link = "Dhakaiya Urdu",
display = "Dhakaiya"
}
aliases["Khoshbas"] = "Dhakaiya"
aliases["Sobbasi"] = "Dhakaiya"
labels["Dari"] = {
link = "Dari Persian",
display = "Dari"
}
aliases["Dari Persian"] = "Dari"
labels["Deccani"] = {
link = "Deccani language",
display = "Deccani"
}
aliases["Hyderabadi"] = "Deccani"
aliases["Telangana"] = "Deccani"
aliases["Dakhni"] = "Deccani"
aliases["Dakhini"] = "Deccani"
labels["Delhi"] = {
display = "Delhi Hindi"
}
labels["Delhi"] = {
display = "Delhi Hindi"
}
labels["distinción"] = {
link = "distinción",
display = "''z''-''s'' distinction",
type = "sound change"
}
aliases["distincion"] = "distinción"
labels["DE"] = {
link = "Dublin English",
display = "Dublin English"
}
aliases["Dublin English"] = "DE"
labels["Doabi"] = {
link = "Doabi dialect",
display = "Doabi"
}
-- E
labels["Ecclesiastical"] = {
link = "Ecclesiastical Latin",
display = "Ecclesiastical"
}
labels["Egyptological"] = {
link = "Egyptian language#Egyptological pronunciation",
display = "modern Egyptological"
}
aliases["modern Egyptological"] = "Egyptological"
labels["Estuary English"] = {
link = "Estuary English"
}
-- F
labels["father-bother"] = {
link = "Father–bother merger",
display = "''father''-''bother'' merger",
type = "sound change"
}
labels["Finland"] = {
link = "Finland Swedish#Phonology",
display = "Finland"
}
aliases["Finland Swedish"] = "Finland"
aliases["Fenno-Swedish"] = "Finland"
labels["FS"] = {
link = "Standard French",
display = "FS"
}
labels["FV"] = {
link = "French Flemish",
display = "French Flanders"
}
-- G
labels["Galway"] = {
link = "Gaeltacht#Galway Gaeltacht",
display = "Galway"
}
labels["GenAm"] = {
link = "General American"
}
aliases["GA"] = "GenAm"
aliases["General American"] = "GenAm"
labels["General Cebuano"] = {
link = "Cebuano language#Dialects",
display = "General Cebuano"
}
aliases["Carcar-Dalaguete"] = "General Cebuano"
aliases["GCeb"] = "General Cebuano"
aliases["Sialo"] = "General Cebuano"
aliases["Standard Cebuano"] = "General Cebuano"
labels["Geordie"] = {
link = "Geordie"
}
labels["Ghawa"] = {
display = "[[Ghawa syndrome]]"
}
labels["Gheg"] = {
link = "Gheg Albanian",
display = "Gheg"
}
labels["Givi"] = {
link = "Giv, South Khorasan",
display = "Givi"
}
labels["Glenties"] = {
link = "Glenties",
display = "The Glenties"
}
labels["grc-byz1"] = {
link = "Medieval Greek",
display = '10<sup>th</sup> ' .. CE .. ' Byzantine'
}
labels["grc-byz2"] = {
link = "Medieval Greek",
display = '15<sup>th</sup> ' .. CE .. ' Constantinopolitan'
}
labels["grc-cla"] = {
link = "Ancient Greek phonology",
display = '5<sup>th</sup> ' .. BCE .. ' Attic'
}
labels["grc-koi1"] = {
link = "Koine Greek phonology",
display = '1<sup>st</sup> ' .. CE .. ' Egyptian'
}
labels["grc-koi2"] = {
link = "Koine Greek phonology",
display = '4<sup>th</sup> ' .. CE .. ' Koine'
}
labels["Gwenedeg"] = {
link = "Gwenedeg",
display = "Gwened"
}
-- H
labels["hbo"] = {
link = "Biblical Hebrew#Phonology",
display = "Biblical Hebrew"
}
aliases["Biblical Hebrew"] = "hbo"
labels["Hevaha"] = {
link = "Ingrian language#Dialects",
display = "Hevaha"
}
labels["Hong Kong"] = {
link = "Hong Kong English",
display = "Hong Kong"
}
aliases["HK"] = "Hong Kong"
labels["horse-hoarse"] = {
link = "horse–hoarse merger",
display = "without the ''horse''–''hoarse'' merger",
type = "sound change"
}
labels["Hössjö"] = {
link = "sv:Hössjö",
}
labels["Hure"] = {
link = "Hure Banner",
}
labels["hy-E"] = {
link = "Eastern Armenian",
display = "Eastern Armenian, standard"
}
labels["hy-IR"] = {
link = "Armenian Iranians#Culture and language",
display = "Eastern Armenian, Iran"
}
labels["hy-W"] = {
link = "Western Armenian",
display = "Western Armenian, standard"
}
labels["hy-Y"] = {
link = "Yerevan dialect",
display = "Eastern Armenian, Yerevan"
}
-- I
labels["IL"] = {
link = "Modern Hebrew phonology",
display = "Modern Israeli Hebrew"
}
aliases["Israeli Hebrew"] = "IL"
aliases["Modern Hebrew"] = "IL"
aliases["Modern Israeli"] = "IL"
aliases["Modern Israeli Hebrew"] = "IL"
aliases["Modern/Israeli Hebrew"] = "IL"
labels["InE"] = {
link = "Indian English",
display = "Indian English"
}
labels["Inland North"] = {
link = "Inland Northern American English",
display = "Inland Northern American"
}
aliases["US Inland North"] = "Inland North"
aliases["Inland Northern"] = "Inland North"
aliases["Inland Northern American"] = "Inland North"
aliases["Inland Northern English"] = "Inland North"
aliases["Inland Northern American English"] = "Inland North"
aliases["Great Lakes"] = "Inland North"
aliases["Northern Cities Vowel Shift"] = "Inland North"
aliases["northern cities vowel shift"] = "Inland North"
labels["intrusive r"] = {
link = "Intrusive r",
display = "intrusive r",
type = "sound change"
}
labels["Iranian Persian"] = {
link = "Western Persian",
display = "Iranian Persian"
}
aliases["IR"] = "Iranian Persian"
aliases["Western Persian"] = "Iranian Persian"
labels["Ireland"] = {
link = "Hiberno-English",
display = "Ireland"
}
aliases["HE"] = "Ireland"
aliases["IE"] = "Ireland"
labels["Italian Hebrew"] = {
link = "Italian Hebrew",
display = "Italian Hebrew"
}
-- J
labels["Johor-Selangor"] = {
link = "Malayan languages",
display = "Johor-Selangor"
}
-- K
labels["Kabul, Peshawar"] = {
link = "Pashto dialects",
display = "Kabul, Peshawar"
}
labels["Kalix"] = {
link = "Kalix dialect",
display = "Kalix"
}
labels["Kandahar"] = {
link = "Kandahari Pashto",
display = "Kandahar"
}
aliases["ps-Kandahar"] = "Kandahar"
labels["Karachi"] = {
display = "Karachi Urdu"
}
labels["Kerry"] = {
link = "Gaeltacht#Kerry Gaeltacht",
display = "Kerry"
}
aliases["West Kerry"] = "Kerry"
labels["khk"] = {
link = "Khalkha Mongolian",
display = "Mongolia Khalkha",
}
labels["kw"] = {
link = "Kuwaiti Arabic",
display = "Kuwaiti Gulf Arabic"
}
aliases["Q8"] = "kw"
aliases["KW"] = "kw"
aliases["Kuwait"] = "kw"
aliases["Kuwaiti"] = "kw"
aliases["Kuwaiti Gulf Arabic"] = "kw"
labels["xme-ham"] = {
display = "Hamadani",
link = "Kermanic languages",
}
labels["xme-mah"] = {
display = "Mahallati",
link = "Kermanic languages",
}
labels["xme-von"] = {
display = "Vonishuni",
link = "Kermanic languages",
}
labels["xme-del"] = {
display = "Delijani",
link = "Kermanic languages",
}
labels["xme-kas"] = {
display = "Kashani",
link = "Kermanic languages",
}
labels["xme-kes"] = {
display = "Kese'i",
link = "Kermanic languages",
}
labels["xme-mey"] = {
display = "Meyme'i",
link = "Kermanic languages",
}
labels["xme-abz"] = {
display = "Abuzeydabadi",
link = "Kermanic languages",
}
labels["xme-aby"] = {
display = "Abyanehi",
link = "Kermanic languages",
}
labels["xme-far"] = {
display = "Farizandi",
link = "Kermanic languages",
}
labels["xme-jow"] = {
display = "Jowshaqani",
link = "Kermanic languages",
}
labels["xme-qoh"] = {
display = "Qohrudi",
link = "Kermanic languages",
}
labels["xme-yar"] = {
display = "Yarandi",
link = "Kermanic languages",
}
labels["xme-tar"] = {
display = "Tari",
link = "Kermanic languages",
}
labels["xme-sed"] = {
display = "Sedehi",
link = "Kermanic languages",
}
labels["xme-ard"] = {
display = "Ardestani",
link = "Kermanic languages",
}
labels["xme-zef"] = {
display = "Zefre'i",
link = "Kermanic languages",
}
labels["xme-isf"] = {
display = "Isfahani",
link = "Kermanic languages",
}
labels["xme-kaf"] = {
display = "Kafroni",
link = "Kermanic languages",
}
labels["xme-var"] = {
display = "Varzenei",
link = "Kermanic languages",
}
labels["xme-nay"] = {
display = "Nayini",
link = "Nayini language",
}
labels["xme-vaf"] = {
display = "Vafsi",
link = "Vafsi dialect",
}
labels["xme-ast"] = {
display = "Ashtiani language",
link = "nyq",
}
labels["xme-xun"] = {
display = "Khunsari",
link = "Khunsari language",
}
labels["xme-nat"] = {
display = "Natanzi",
link = "Natanzi language",
}
labels["xme-soi"] = {
display = "Soi",
link = "Soi language",
}
labels["xme-gaz"] = {
display = "Gazi",
link = "Gazi language",
}
labels["xme-ana"] = {
display = "Anaraki",
link = "Nayini language",
}
labels["xme-ker"] = {
display = "Kermani",
link = "Zoroastrian Dari language",
}
labels["xme-yaz"] = {
display = "Yazdi",
link = "Zoroastrian Dari language",
}
-- L
labels["Lyallpuri"] = {
link = "Faisalabad",
display = "Lyallpuri"
}
aliases["Faisalabad"] = "Lyallpuri"
labels["LAm"] = {
link = "Spanish language in the Americas",
display = "Latin American"
}
labels["Late Egyptian"] = {
link = "Late Egyptian language",
display = "reconstructed Late Egyptian"
}
labels["Latinate"] = {
link = "Latin#Phonology",
display = "Latinate"
}
labels["lleísmo"] = {
link = "Yeísmo",
display = "''ll''-''y'' distinction",
type = "sound change"
}
labels["Lövånger"] = {
link = "Lövånger",
}
labels["Luleå"] = {
link = "Luleå",
}
-- M
labels["Malwai"] = {
link = "Malwai dialect",
display = "Malwai"
}
labels["Majha"] = {
link = "Punjabi dialects and languages#Standard_Punjabi",
display = "Standard Punjabi"
}
aliases["pa"] = "Majha"
aliases["Majhi"] = "Majha"
labels["Mary-marry-merry"] = {
link = "Mary–marry–merry merger",
display = "''Mary''–''marry''–''merry'' merger",
type = "sound change"
}
aliases["Mmmm"] = "Mary-marry-merry"
labels["Mayo"] = {
link = "Gaeltacht Iorrais agus Acaill",
display = "Mayo"
}
labels["Medio-Late Egyptian"] = {
link = "Late Egyptian language",
display = "reconstructed Medio-Late Egyptian"
}
labels["Metro Cebu"] = {
link = "Metro Cebu"
}
aliases["Cebu City"] = "Metro Cebu"
aliases["Urban Cebuano"] = "Metro Cebu"
labels["Middle Egyptian"] = {
link = "Egyptian language#Middle Egyptian",
display = "reconstructed Middle Egyptian"
}
labels["Midwestern US"] = {
link = "Midwestern United States#Linguistic characteristics",
display = "Midwestern US"
}
aliases["Midwest US"] = "Midwestern US"
aliases["Midwest US English"] = "Midwestern US"
aliases["Midwestern US English"] = "Midwestern US"
labels["Mizrahi Hebrew"] = {
link = "Mizrahi Hebrew",
display = "Mizrahi Hebrew"
}
aliases["Mizrahi"] = "Mizrahi Hebrew"
aliases["Mizrakhi"] = "Mizrahi Hebrew"
aliases["Mizrachi"] = "Mizrahi Hebrew"
aliases["Mizrakhi Hebrew"] = "Mizrahi Hebrew"
aliases["Mizrachi Hebrew"] = "Mizrahi Hebrew"
labels["MLE"] = {
link = "Multicultural London English",
display = "MLE"
}
aliases["Multicultural London English"] = "MLE"
labels["MTE"] = {
link = "Multicultural Toronto English",
display = "MTE"
}
aliases["Multicultural Toronto English"] = "MTE"
aliases["Greater Toronto English"] = "MTE"
aliases["GTE"] = "MTE"
labels["Montenegro"] = {
link = "Comparison of standard Bosnian, Croatian, Montenegrin and Serbian#Accentuation",
display = "Montenegro"
}
aliases["Montenegrin"] = "Montenegro"
labels["Munster"] = {
link = "Munster Irish",
display = "Munster"
}
-- N
labels["near-square"] = {
link = "near-square merger",
display = "''near''–''square'' merger",
type = "sound change"
}
labels["Netherlands"] = {
link = "Dutch phonology",
display = "Netherlands"
}
aliases["NL"] = "Netherlands"
labels["New Latin"] = {
link = "New Latin"
}
labels["New York"] = {
link = "New York accent",
display = "NYC"
}
aliases["NY"] = "New York"
aliases["NYC"] = "New York"
aliases["New York City"] = "New York"
labels["New Zealand"] = {
link = "New Zealand English phonology",
display = "New Zealand"
}
aliases["NZ"] = "New Zealand"
aliases["GNZ"] = "New Zealand"
aliases["General New Zealand"] = "New Zealand"
labels["non-cure-force"] = {
link = "Cure–force merger",
display = "''cure''–''force'' distinction",
type = "sound change"
}
aliases["non-pour-poor"] = "non-cure-force"
labels["non-Mary-marry-merry"] = {
link = "Mary–marry–merry merger",
display = "''Mary''–''marry''–''merry'' distinction",
type = "sound change"
}
aliases["nMmmm"] = "non-Mary-marry-merry"
labels["non-rhotic"] = {
link = "Rhoticity in English",
display = "non-rhotic"
}
aliases["nonrhotic"] = "non-rhotic"
labels["non-weak vowel"] = {
link = "Weak vowel merger",
display = "weak vowel distinction",
type = "sound change"
}
labels["northern and central Germany"] = {
display = "northern Germany, central Germany"
}
aliases["north and central German"] = "northern and central Germany"
aliases["North and Central German"] = "northern and central Germany"
aliases["north and central Germany"] = "northern and central Germany"
aliases["North and Central Germany"] = "northern and central Germany"
aliases["northern and central German"] = "northern and central Germany"
aliases["Northern and Central German"] = "northern and central Germany"
aliases["Northern and Central Germany"] = "northern and central Germany"
labels["Northern England"] = {
link = "English language in Northern England",
display = "Northern England"
}
aliases["North England"] = "Northern England"
labels["northern Germany"] = {
display = "northern Germany"
}
aliases["north German"] = "northern Germany"
aliases["North German"] = "northern Germany"
aliases["north Germany"] = "northern Germany"
aliases["North Germany"] = "northern Germany"
aliases["northern German"] = "northern Germany"
aliases["Northern German"] = "northern Germany"
aliases["Northern Germany"] = "northern Germany"
labels["Northern Scotland"] = {
link = "Northern Scots",
display = "Northern Scotland"
}
-- O
labels["Old Egyptian"] = {
link = "Egyptian language#Old Egyptian",
display = "reconstructed Old Egyptian"
}
labels["Osaka"] = {
link = "Kansai dialect",
display = "Osaka"
}
-- P
labels["pa-IN"] = {
link = "Punjabi dialects and languages",
display = "India"
}
aliases["pan"] = "pa-IN"
aliases["East Punjab"] = "pa-PK"
labels["pa-PK"] = {
link = "Punjabi dialects and languages",
display = "Pakistan"
}
aliases["pnb"] = "pa-PK"
aliases["Lahnda"] = "pa-PK"
aliases["West Punjab"] = "pa-PK"
labels["Palestinian Hebrew"] = {
link = "Palestinian vocalization",
display = "Palestinian Hebrew"
}
labels["pin-pen"] = {
link = "pin–pen merger",
display = "''pin''–''pen'' merger",
type = "sound change"
}
aliases["pen-pin"] = "pin-pen"
labels["Philippine"] = {
link = "Philippine English",
display = "Philippine"
}
aliases["Philippines"] = "Philippine"
labels["Portugal"] = {
link = "European Portuguese",
display = "Portugal"
}
aliases["EP"] = "Portugal"
aliases["PT"] = "Portugal"
labels["ps-Kabul"] = {
link = "Pashto dialects",
display = "Kabuli"
}
-- Q
labels["Quanzhou"] = {
link = "Quanzhou"
}
labels["Quebec"] = {
link = "Quebec French phonology",
display = "Quebec"
}
aliases["Québec"] = "Quebec"
aliases["Joual"] = "Quebec"
labels["Quetta"] = {
link = "Pashto dialects",
display = "Quetta"
}
-- R
labels["r-dissimilation"] = {
link = "Dissimilation",
display = "''r''-dissimilation",
type = "sound change"
}
labels["Rālik"] = {
link = "Rālik Chain",
display = "Rālik"
}
aliases["Ralik"] = "Rālik";
labels["Ratak"] = {
link = "Ratak Chain",
display = "Ratak"
}
labels["rhotic"] = {
link = "Rhotic and non-rhotic accents",
display = "rhotic",
type = "sound change"
}
labels["Riau-Lingga"] = {
link = "Riau-Lingga Sultanate",
display = "Riau-Lingga"
}
labels["Rioplatense"] = {
link = "Rioplatense Spanish",
display = "Rioplatense"
}
labels["RP"] = {
link = "Received Pronunciation"
}
aliases["Received Pronunciation"] = "RP"
aliases["Received Standard"] = "RP"
aliases["RS"] = "RP"
labels["Rosmuc"] = {
link = "Rosmuc",
display = "Rosmuc"
}
aliases["Ros Muc"] = "Rosmuc"
-- S
labels["São Paulo"] = {
link = "Brazilian Portuguese",
display = "São Paulo"
}
labels["Scania"] = {
link = "Scanian dialect",
display = "Scania"
}
labels["Scotland"] = {
link = "Scottish English",
display = "Scotland"
}
labels["Sephardi Hebrew"] = {
link = "Sephardi Hebrew",
display = "Sephardi Hebrew"
}
aliases["Sephardi"] = "Sephardi Hebrew"
labels["Serbia"] = {
link = "Comparison of standard Bosnian, Croatian, Montenegrin and Serbian#Accentuation",
display = "Serbia"
}
aliases["Serbian"] = "Serbia"
labels["seseo"] = {
link = "seseo",
display = "''seseo'' merger",
type = "sound change"
}
labels["Sistani"] = {
link = "Sistani dialect",
display = "Sistani"
}
labels["Skellefteå"] = {
link = "Skellefteå"
}
labels["Soikkola"] = {
link = "Ingrian phonology#Soikkola dialect",
display = "Soikkola"
}
labels["South Africa"] = {
link = "South African English phonology",
display = "General South African"
}
aliases["SAE"] = "South Africa"
aliases["GSAE"] = "South Africa"
aliases["GenSAE"] = "South Africa"
aliases["General South African"] = "South Africa"
labels["Southern American English"] = {
link = "Southern American English"
}
aliases["Southern US"] = "Southern American English"
aliases["Southern US English"] = "Southern American English"
aliases["Southern U.S. English"] = "Southern American English"
aliases["US South"] = "Southern American English"
labels["South Brazil"] = {
link = "Brazilian Portuguese",
display = "South Brazil"
}
labels["southern Germany"] = {
display = "southern Germany"
}
aliases["south German"] = "southern Germany"
aliases["South German"] = "southern Germany"
aliases["south Germany"] = "southern Germany"
aliases["South Germany"] = "southern Germany"
aliases["southern German"] = "southern Germany"
aliases["Southern German"] = "southern Germany"
aliases["Southern Germany"] = "southern Germany"
labels["Southern Leyte"] = {
link = "Southern Leyte"
}
aliases["Kana Habagatan"] = "Southern Leyte"
labels["Southern Scotland"] = {
link = "Southern Scots",
display = "Southern Scotland"
}
aliases["Southern Scots"] = "Southern Scotland"
labels["St. Louis"] = {
link = "North American regional phonology#St. Louis and vicinity",
display = "St. Louis (Missouri)"
}
aliases["STL"] = "St. Louis"
labels["standard"] = {
display = "standard"
}
aliases["Standard"] = "standard"
labels["Standard Basque"] = {
link = "Standard Basque",
display = "standard"
}
labels["Standard Southern British English"] = {
link = "Standard Southern British English",
display = "Standard Southern British English"
}
aliases["SSBE"] = "Standard Southern British English"
labels["Standard Zhuang"] = {
link = "Standard Zhuang",
display = "Standard Zhuang"
}
labels["Stockholm e"] = {
link = "Swedish phonology",
display = "with Stockholm ''e''",
type = "sound change"
}
labels["Sweden"] = {
link = "Swedish phonology",
display = "Sweden"
}
aliases["Swedish"] = "Sweden"
labels["Syrian Hebrew"] = {
link = "Syrian Jews#Pronunciation of Hebrew",
display = "Syrian Hebrew"
}
-- T
labels["t-glottalization"] = {
link = "T-glottalization",
display = "''t''-glottalization",
type = "sound change"
}
aliases["t-glottaling"] = "t-glottalization"
labels["Tajik"] = {
link = "Tajik language",
display = "Tajik"
}
aliases["Tajiki"] = "Tajik"
labels["Tehrani"] = {
link = "Tehrani accent",
display = "Tehrani"
}
labels["th-fronting"] = {
link = "th-fronting",
type = "sound change"
}
labels["Tiberian Hebrew"] = {
link = "Tiberian Hebrew",
display = "Tiberian Hebrew"
}
aliases["Tiberian"] = "Tiberian Hebrew"
labels["Tosk"] = {
link = "Tosk Albanian",
display = "Tosk"
}
-- U
labels["UK"] = {
link = "British English",
display = "UK"
}
aliases["British"] = "UK"
aliases["U.K."] = "UK"
labels["Ulaanbaatar"] = {
link = "Ulaanbaatar"
}
aliases["UlaanBaatar"] = "Ulaanbaatar"
labels["Ulster"] = {
link = "Ulster Irish",
display = "Ulster"
}
aliases["Donegal"] = "Ulster"
labels["Umeå"] = {
link = "Umeå",
}
labels["ur"] = {
link = "Urdu#Phonology",
display = "Standard Urdu"
}
aliases["urd"] = "ur"
labels["ur-KPK"] = {
link = "Khyber Pakhtunkhwa",
display = "Khyber Pakhtunkhwa"
}
labels["US"] = {
link = "American English",
display = "US"
}
aliases["U.S."] = "US"
-- V
labels["Valencia"] = {
link = "Valencian"
}
aliases["Valencian"] = "Valencia"
aliases["Vannetais"] = "Gwenedeg"
labels["Vedic Sanskrit"] = {
link = "Vedic Sanskrit",
display = "Vedic"
}
aliases["Vedic"] = "Vedic Sanskrit"
labels["Rigvedic Sanskrit"] = {
link = "wikt:Rigvedic",
display = "Rigvedic"
}
aliases["Rigvedic"] = "Rigvedic Sanskrit"
labels["Samavedic"] = {
link = "wikt:Samavedic",
display = "Samavedic"
}
labels["Yajurvedic"] = {
link = "wikt:Yajurvedic",
display = "Yajurvedic"
}
labels["Atharvavedic"] = {
link = "wikt:Atharvavedic",
display = "Atharvavedic"
}
labels["Vulgar"] = {
link = "Vulgar Latin",
display = "Vulgar"
}
-- W
labels["Wales"] = {
link = "Welsh English",
display = "Wales"
}
aliases["Welsh"] = "Wales"
labels["Wardak"] = {
link = "Pashto dialects",
display = "Wardak"
}
labels["Waterford"] = {
link = "Gaeltacht na nDéise",
display = "Waterford"
}
aliases["Ring"] = "Waterford"
labels["Wazirwola"] = {
link = "Wazirwola dialect",
display = "Wazirwola"
}
labels["weak vowel"] = {
link = "Weak vowel merger",
display = "weak vowel merger",
type = "sound change"
}
labels["wine/whine"] = {
link = "wine–whine merger",
display = "without the ''wine''–''whine'' merger",
type = "sound change"
}
aliases["wine-whine"] = "wine/whine"
labels["Wood"] = {
link = "Wood Frisian",
display = "Wood",
}
-- X
labels["Xiamen"] = {
link = "Xiamen"
}
-- Y
labels["yeísmo"] = {
link = "Yeísmo",
display = "''ll''-''y'' neutralization",
type = "sound change"
}
labels["Yemenite Hebrew"] = {
link = "Yemenite Hebrew",
display = "Yemenite Hebrew"
}
labels["YIVO"] = {
link = "YIVO"
}
labels["Ylä-Laukaa"] = {
link = "Ingrian language#Dialects",
display = "Ylä-Laukaa"
}
labels["yod-coalescence"] = {
link = "yod-coalescence",
display = "yod-coalescence",
type = "sound change"
}
-- Z
labels["Zhangzhou"] = {
link = "Zhangzhou"
}
labels["Zurich"] = {
link = "Zürich German",
display = "Zurich"
}
aliases["Zürich"] = "Zurich"
return { labels = labels, aliases = aliases }
akyh5yejwy5y2vphcwixg8kjecyo9iq
Module:IPA/tracking
828
2983
8295
2022-07-22T08:58:14Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
--[[
symb is what is tracked. It can be a literal symbol or a Lua pattern.
If it is a table, tracking is added for any of the symbols in the list.
cat is the subtemplate that is added to the default path "IPA/" + language code + "/".
]]
local U = mw.ustring.char
local syllabic = U(0x329)
-- The validity of this table is checked by documentation function
-- in [[Module:User:Erutuon/sandbox]].
export.tracking = {
en = {
{
symb = "iə",
cat = "ambig",
},
{
symb = { "ɪi", "ʊu", "ɪj", "ʊw" },
cat = "eeoo",
},
{
symb = { "r" },
cat = "plain r",
},
},
cs = {
{
symb = "[mnrl]" .. syllabic,
cat = "syllabic-consonant",
},
},
ps = {
{
symb = "ɤ",
cat = "Pashto",
},
},
fa = {
{
symb = "ʔ",
cat = "glottal-stop",
},
},
{
{
symb = "",
cat = "",
},
},
}
function export.run_tracking(IPA, lang)
if not IPA or IPA == "" then
return
end
lang = lang:getCode()
if not export.tracking[lang] then
return
end
for i, arguments in ipairs(export.tracking[lang]) do
local symbols = arguments.symb
local category = arguments.cat
if type(symbols) == "string" then
symbols = { symbols }
end
for _, symbol in pairs(symbols) do
if mw.ustring.find(IPA, symbol) then
require("Module:debug/track")("IPA/" .. lang .. "/" .. category)
end
end
end
end
return export
ioeemmyd720mxl78g3poo7owgj72fqh
Template:trans-see
10
2984
8296
2022-07-22T09:17:21Z
Rebel Agent
2678
Ke dirile tsebe
wikitext
text/x-wiki
<div class="pseudo NavFrame"><div class="NavHead" style="text-align: left;" {{#if:{{{id|}}}|id{{=}}"Translations-{{anchorencode:{{{id}}}}}"}}>{{{1}}} <!--
--><span style="font-weight: normal" >— <i>see</i></span> <!--
-->{{#if:{{{id|}}}|[[{{{2|{{{1}}}}}}#Translations-{{{id}}}|{{{2|{{{1}}}}}}]]|[[{{{2|{{{1}}}}}}]]}}<!--
-->{{#if:{{{3|}}}|,‎ {{#if:{{{id|}}}|[[{{{3}}}#Translations-{{{id}}}|{{{3}}}]]|[[{{{3}}}]]}}}}<!--
-->{{#if:{{{4|}}}|,‎ {{#if:{{{id|}}}|[[{{{4}}}#Translations-{{{id}}}|{{{4}}}]]|[[{{{4}}}]]}}}}<!--
-->{{#if:{{{5|}}}|,‎ {{#if:{{{id|}}}|[[{{{5}}}#Translations-{{{id}}}|{{{5}}}]]|[[{{{5}}}]]}}}}<!--
-->{{#if:{{{6|}}}|,‎ {{#if:{{{id|}}}|[[{{{6}}}#Translations-{{{id}}}|{{{6}}}]]|[[{{{6}}}]]}}}}<!--
-->{{#if:{{{7|}}}|,‎ {{#if:{{{id|}}}|[[{{{7}}}#Translations-{{{id}}}|{{{7}}}]]|[[{{{7}}}]]}}}}<!--
-->{{#if:{{{8|}}}|,‎ {{#if:{{{id|}}}|[[{{{8}}}#Translations-{{{id}}}|{{{8}}}]]|[[{{{8}}}]]}}}}<!--
-->{{#if:{{{9|}}}|,‎ {{#if:{{{id|}}}|[[{{{9}}}#Translations-{{{id}}}|{{{9}}}]]|[[{{{9}}}]]}}}}<!--
-->{{#if:{{{10|}}}|,‎ {{#if:{{{id|}}}|[[{{{10}}}#Translations-{{{id}}}|{{{10}}}]]|[[{{{10}}}]]}}[[Category:Limit of template reached]]}}<!--
--></div></div><!--
--><noinclude>{{documentation}}</noinclude>
8mzmeasmjynwfxu7zgdnheawzi9ko23
Template:rhymes
10
2985
8297
2022-07-22T09:46:24Z
Rebel Agent
2678
Ke dirile template
wikitext
text/x-wiki
{{check deprecated lang param usage|lang={{{lang|}}}|<!--
-->{{#invoke:rhymes|show}}<!--
-->}}<!--
--><noinclude>{{documentation}}</noinclude>
cylhiuhtttqu3tsw64glng6vzvai220
Module:rhymes
828
2986
8298
2022-07-22T09:47:56Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local force_cat = false -- for testing
local function tag_rhyme(rhyme, lang)
local formatted_rhyme, cat
-- FIXME, should not be here. Telugu should use IPA as well.
if lang:getCode() == "te" then
formatted_rhyme = require("Module:script utilities").tag_text(rhyme, lang)
cat = ""
else
formatted_rhyme, cat = require("Module:IPA").format_IPA(lang, rhyme, true)
end
return formatted_rhyme, cat
end
local function make_rhyme_link(lang, link_rhyme, display_rhyme, qualifiers)
local retval
if not link_rhyme then
retval = table.concat{"[[Rhymes:", lang:getCanonicalName(), "|", lang:getCanonicalName(), "]]"}
else
local formatted_rhyme, cat = tag_rhyme(display_rhyme or link_rhyme, lang)
retval = table.concat{"[[Rhymes:", lang:getCanonicalName(), "/", link_rhyme, "|", formatted_rhyme, "]]", cat}
end
if qualifiers and #qualifiers > 0 then
return require("Module:qualifier").format_qualifier(qualifiers) .. " " .. retval
else
return retval
end
end
function export.show_row(frame)
local params = {
[1] = {required = true},
[2] = {required = true},
[3] = {},
}
local args = frame.getParent and frame:getParent().args or frame
if (not args[1] or args[1] == "") and mw.title.getCurrentTitle().nsText == "Template" then
return '[[Rhymes:English/aɪmz|<span class="IPA">-aɪmz</span>]]'
end
local args = require("Module:parameters").process(args, params)
local lang = require("Module:languages").getByCode(args[1], 1)
return make_rhyme_link(lang, args[2], "-" .. args[2]) .. (args[3] and (" (''" .. args[3] .. "'')") or "")
end
local function add_syllable_categories(categories, lang, rhyme, num_syl)
local prefix = "Rhymes:" .. lang .. "/" .. rhyme
table.insert(categories, prefix)
if num_syl then
for _, n in ipairs(num_syl) do
local c
if n > 1 then
c = prefix .. "/" .. n .. " syllables"
else
c = prefix .. "/1 syllable"
end
table.insert(categories, c)
end
end
end
--[=[
Meant to be called from a module. `data` is a table in the following format:
{
lang = LANGUAGE_OBJECT,
rhymes = {{rhyme = "RHYME", qualifiers = nil or {"QUALIFIER", "QUALIFIER", ...}, num_syl = nil or {#SYL, #SYL, ...}}, ...},
qualifiers = nil or {"QUALIFIER", "QUALIFIER", ...},
num_syl = nil or {#SYL, #SYL, ...},
caption = nil or "CAPTION",
nocaption = BOOLEAN,
sort = nil or "SORTKEY",
force_cat = BOOLEAN,
}
Here:
* `lang` is a language object.
* `rhymes` is the list of rhymes to display. RHYME is the IPA rhyme, without initial hyphen. QUALIFIER is a qualifier
string to display before the specific rhyme in question, formatted using format_qualifier() in [[Module:qualifier]].
#SYL is the number of syllables of the word or words containing this rhyme, for categorization purposes (see below).
* `qualifiers` (at top level), if non-nil, is a list of qualifier strings to display after the caption "Rhymes:" and
before the formatted rhymes, formatted using format_qualifier() in [[Module:qualifier]].
* `num_syl` (at top level), if non-nil, a list of the number(s) of syllables of the word or words with each rhyme
specified in `rhymes`. This applies to all rhymes specified in `rhymes`, while the corresponding `num_syl` attached
to an individual rhyme applies only to that rhyme (and overrides the global `num_syl`, if both are given).
* `caption`, if specified, overrides the default caption "Rhymes". A colon and space is automatically added after
the caption.
* `nocaption`, if specified, suppresses the caption entirely.
* `sort`, if specified, is the sort key for categories.
* `force_cat`, if specified, forces categories even on non-mainspace pages (for testing).
Note that the number of syllables is currently used only for categorization; if present, an extra category will
be added such as [[Category:Rhymes:Italian/ino/3 syllables]] in addition to [[Category:Rhymes:Italian/ino]].
]=]
function export.format_rhymes(data)
local langname = data.lang:getCanonicalName()
local links = {}
local categories = {}
for i, r in ipairs(data.rhymes) do
local rhyme = r.rhyme
table.insert(links, make_rhyme_link(data.lang, rhyme, "-" .. rhyme, r.qualifiers))
add_syllable_categories(categories, langname, rhyme, r.num_syl or data.num_syl)
end
local ret = data.nocaption and "" or (data.caption or "Rhymes") .. ": "
if data.qualifiers and data.qualifiers[1] then
ret = require("Module:qualifier").format_qualifier(data.qualifiers) .. " " .. ret
end
return ret .. table.concat(links, ", ") ..
require("Module:utilities").format_categories(categories, data.lang, data.sort, nil, force_cat or data.force_cat)
end
function export.show(frame)
local args = frame.getParent and frame:getParent().args or frame
local compat = args["lang"]
local offset = compat and 0 or 1
local params = {
[1 + offset] = {required = true, list = true, default = "aɪmz"},
[compat and "lang" or 1] = {required = true, default = "en"},
["s"] = {},
["srhymes"] = {list = "s", allow_holes = true, require_index = true},
["q"] = {},
["qrhymes"] = {list = "q", allow_holes = true, require_index = true},
["caption"] = {},
["nocaption"] = {type = "boolean"},
["sort"] = {},
}
local args = require("Module:parameters").process(args, params)
local lang = args[compat and "lang" or 1]
lang = require("Module:languages").getByCode(lang, compat and "lang" or 1)
-- temporary tracking code to find usage of {{rhymes}} in various languages
-- [[Special:WhatLinksHere/Template:tracking/rhymes/LANGCODE]]
local code = lang:getCode()
if code == "it" or code == "es" then
require("Module:debug").track("rhymes/" .. code)
end
local function parse_num_syl(val)
val = mw.text.split(val, "%s*,%s*")
local ret = {}
for _, v in ipairs(val) do
local n = tonumber(v) or error("Unrecognized #syllables '" .. v .. "', should be a number")
table.insert(ret, n)
end
return ret
end
local rhymes = {}
for i, rhyme in ipairs(args[1 + offset]) do
local rhymeobj = {rhyme = rhyme}
if args.srhymes[i] then
rhymeobj.num_syl = parse_num_syl(args.srhymes[i])
end
if args.qrhymes[i] then
rhymeobj.qualifiers = {args.qrhymes[i]}
end
table.insert(rhymes, rhymeobj)
end
return export.format_rhymes {
lang = lang,
rhymes = rhymes,
num_syl = args.s and parse_num_syl(args.s) or nil,
qualifiers = args.q and {args.q} or nil,
caption = args.caption,
nocaption = args.nocaption,
sort = args.sort,
}
end
-- {{rhymes nav}}
function export.show_nav(frame)
-- Gather parameters
local args = frame:getParent().args
local lang = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "und") or error("Language code has not been specified. Please pass parameter 1 to the template.")
lang = require("Module:languages").getByCode(lang, 1)
local parts = {}
local i = 2
while args[i] do
local part = args[i]; if part == "" then part = nil end
table.insert(parts, part)
i = i + 1
end
-- Create steps
local steps = {"» [[Wiktionary:Rhymes|Rhymes]]", "» " .. make_rhyme_link(lang)}
local categories = {}
if #parts > 0 then
local last = parts[#parts]
parts[#parts] = nil
local prefix = ""
for i, part in ipairs(parts) do
prefix = prefix .. part
parts[i] = prefix
end
for _, part in ipairs(parts) do
table.insert(steps, "» " .. make_rhyme_link(lang, part .. "-", "-" .. part .. "-"))
end
if last == "-" then
table.insert(steps, "» " .. make_rhyme_link(lang, prefix, "-" .. prefix))
table.insert(categories, "[[Category:" .. lang:getCanonicalName() .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "| ]]")
elseif mw.title.getCurrentTitle().text == lang:getCanonicalName() .. "/" .. prefix .. last .. "-" then
table.insert(steps, "» " .. make_rhyme_link(lang, prefix .. last .. "-", "-" .. prefix .. last .. "-"))
table.insert(categories, "[[Category:" .. lang:getCanonicalName() .. " rhymes/" .. prefix .. last .. "-|-]]")
else
table.insert(steps, "» " .. make_rhyme_link(lang, prefix .. last, "-" .. prefix .. last))
table.insert(categories, "[[Category:" .. lang:getCanonicalName() .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "|" .. last .. "]]")
end
elseif lang:getCode() ~= "und" then
table.insert(categories, "[[Category:" .. lang:getCanonicalName() .. " rhymes| ]]")
end
frame:callParserFunction("DISPLAYTITLE",
mw.title.getCurrentTitle().fullText:gsub(
"/(.+)$",
function (rhyme)
return "/" .. tag_rhyme(rhyme, lang)
end))
return table.concat(steps, " ") .. table.concat(categories)
end
return export
kwa1fseql6qtl47csps6mlpm917dvni
Module:syllables
828
2987
8299
2022-07-22T09:50:12Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
local diphthongs = mw.loadData("Module:IPA/data").diphthongs
local vowels = mw.loadData("Module:IPA/data/symbols").vowels .. "ᵻ" .. "ᵿ"
local U = mw.ustring.char
--[[ No use for this at the moment, though it is an interesting catalogue.
It might be usable for phonetic transcriptions.
Diacritics added to vowels:
inverted breve above, inverted breve below,
up tack, down tack,
left tack, right tack,
diaeresis (above), diaeresis below,
right half ring, left half ring,
plus sign below, minus sign below,
combining x above, rhotic hook,
tilde (above), tilde below
ligature tie (combining double breve), ligature tie below
]]
local diacritics = U(0x311)..U(0x32F)
..U(0x31D)..U(0x31E)
..U(0x318)..U(0x319)
..U(0x308)..U(0x324)
..U(0x339)..U(0x31C)
..U(0x31F)..U(0x320)
..U(0x33D)..U(0x2DE)
..U(0x303)..U(0x330)
..U(0x361)..U(0x35C)
--[[
combining acute and grave tone marks, circumflex
]]--
local tone = "[" .. U(0x341) .. U(0x340) ..U (0x302) .. "]"
local nonsyllabicDiacritics = U(0x311) .. U(0x32F)
local syllabicDiacritics = U(0x0329) .. U(0x030D)
local ties = U(0x361) .. U(0x35C)
-- long, half-long, extra short
local lengthDiacritics = U(0x2D0) .. U(0x2D1) .. U(0x306)
local vowel = "[" .. vowels .. "]" .. tone .. "?"
local tie = "[" .. ties .. "]"
local nonsyllabicDiacritic = "[" .. nonsyllabicDiacritics .. "]"
local syllabicDiacritic = "[" .. syllabicDiacritics .. "]"
local UTF8Char = "[\1-\127\194-\244][\128-\191]*"
function export.getVowels(remainder, lang)
if string.find(remainder, "^[%\[/]?%-") or string.find(remainder, "%-[%\[/]?$") then
return nil
end -- If a hyphen is at the beginning or end of the transcription, do not count syllables.
local count = 0
local diphs = diphthongs[lang:getCode()] or {}
remainder = mw.ustring.toNFD(remainder)
remainder = string.gsub(remainder, "%((.*)%)", "%1") -- Remove parentheses.
while remainder ~= "" do
-- Ignore nonsyllabic vowels
remainder = mw.ustring.gsub(remainder, "^" .. vowel .. nonsyllabicDiacritic, "")
local m =
mw.ustring.match(remainder, "^." .. syllabicDiacritic) or -- Syllabic consonant
mw.ustring.match(remainder, "^" .. vowel .. tie .. vowel) -- Tie bar
-- Starts with a recognised diphthong?
for _, diph in ipairs(diphs) do
if m then
break
end
m = m or mw.ustring.match(remainder, "^" .. diph)
end
-- If we haven't found anything yet, just match on a single vowel
m = m or mw.ustring.match(remainder, "^" .. vowel)
if m then
-- Found a vowel, add it
count = count + 1
remainder = string.sub(remainder, #m + 1)
else
-- Found a non-vowel, skip it
remainder = string.gsub(remainder, "^" .. UTF8Char, "")
end
end
if count ~= 0 then return count end
return nil
end
function export.countVowels2Test(frame)
local params = {
[1] = {required = true},
[2] = {default = ""},
}
local args = require("Module:parameters").process(frame.args, params)
local lang = require("Module:languages").getByCode(args[1]) or require("Module:languages").err(args[1], 1)
local count = export.getVowels(args[2], lang)
return 'The text "' .. args[2] .. '" contains ' .. count .. ' vowels.'
end
local function countVowels(text)
text = mw.ustring.toNFD(text) or error("Invalid UTF-8")
local _, count = mw.ustring.gsub(text, vowel, "")
local _, sequenceCount = mw.ustring.gsub(text, vowel.."+", "")
local _, nonsyllabicCount = mw.ustring.gsub(text, vowel .. nonsyllabicDiacritic, "")
local _, tieCount = mw.ustring.gsub(text, vowel .. tie .. vowel, "")
local diphthongCount = count - (nonsyllabicCount + tieCount)
return count, sequenceCount, diphthongCount
end
local function countDiphthongs(text, lang)
text = mw.ustring.toNFD(text) or error("Invalid UTF-8")
local diphthongs = diphthongs[lang:getCode()] or {}
local _, count
local total = 0
if diphthongs then
for i, diphthong in pairs(diphthongs) do
_, count = mw.ustring.gsub(text, diphthong, "")
total = total + count
end
end
return total
end
function export.countVowels(frame)
local params = {
[1] = {default = ""},
}
local args = require("Module:parameters").process(frame.args, params)
local count, sequenceCount, diphthongCount = countVowels(args[1])
local outputs = {}
table.insert(outputs, (count or 'an unknown number of') .. ' vowels')
table.insert(outputs, (sequenceCount or 'an unknown number of') .. ' vowel sequences')
table.insert(outputs, (diphthongCount or 'an unknown number of') .. ' vowels or vowels and diphthongs')
return 'The text "' .. args[1] .. '" contains ' .. mw.text.listToText(outputs) .. "."
end
function export.countVowelsDiphthongs(frame)
local params = {
[1] = {required = true},
[2] = {default = ""},
}
local args = require("Module:parameters").process(frame.args, params)
local lang = require("Module:languages").getByCode(args[1]) or require("Module:languages").err(args[1], 1)
local vowels = countVowels(args[2])
local count = vowels - countDiphthongs(args[2], lang) or 0
local out = 'The text "' .. args[2] .. '" contains ' .. (count or 'an unknown number of')
if count == 1 then
out = out .. ' vowel or diphthong.'
else
out = out .. ' vowels or diphthongs.'
end
return out
end
return export
89qaat609gtr1wjnqtjv2m5kljpokku
Template:rfap
10
2988
8300
2022-07-22T09:52:45Z
Rebel Agent
2678
Ke dirile template
wikitext
text/x-wiki
{{check deprecated lang param usage|lang={{{lang|}}}|<!--
-->{{request box<!--
-->|1=[[Image:Headset_icon.svg|20px]]<!--
-->|2=This {{<noinclude>temp|</noinclude>pagetype}} needs [[:Category:Requests for audio pronunciation in {{langname|{{#if:{{{lang|}}}|{{{lang|}}}|{{{1<noinclude>|und</noinclude>}}}}}}} entries|audio files]]. If you are a native speaker with a microphone, please [[Help:Audio pronunciations|record some]] and [[commons:Special:Upload|upload]] them. <small>(For audio required quickly, visit [[WT:APR]].)</small> {{#if:{{#if:{{{lang|}}}|{{{1|}}}|{{{2|}}}}}| <br />Particularly: "{{#if:{{{lang|}}}|{{{1|}}}|{{{2|}}}}}"}}<!--
-->|inline={{{inline|no}}}}}<!--
-->}}<!-- (end of {{check deprecated lang param usage}})
--><includeonly><!--
-->{{#if:{{{nocat|}}}||<!--
-->{{categorize<!--
-->|{{#if:{{{lang|}}}|{{{lang|}}}|{{{1|}}}}}<!--
-->|Requests for audio pronunciation in {{langname|{{#if:{{{lang|}}}|{{{lang|}}}|{{{1|}}}}}}} entries<!--
-->|{{#if:{{{variety|}}}|Requests for audio pronunciation from {{{variety}}} in {{langname|{{#if:{{{lang|}}}|{{{lang|}}}|{{{1|}}}}}}} entries}}<!--
-->|sort={{{sort|}}}<!--
-->}}<!--
-->{{#if:{{{variety|}}}|[[Category:rfap with variety]]}}<!--
-->}}<!--
--></includeonly><!--
--><noinclude>{{documentation}}</noinclude>
s98sn3zc10ecovsdrusc5cfx863d9xq
Template:request box
10
2989
8301
2022-07-22T09:54:05Z
Rebel Agent
2678
Ke dirile template
wikitext
text/x-wiki
{{#ifeq:{{yesno|{{{inline|}}}}}|yes|{{maintenance line|{{{2}}}}}
|<div class="noprint request-box" style="width: auto; margin: 0; padding: 0.5em; border-collapse: collapse;overflow: hidden;">
{{{!}} style="background:#FFFFFF; width:90%; margin: auto; border:1px dashed #999999; text-align:left"
{{!}}{{{1}}}
{{!}}{{{2}}}
{{!}}}</div>}}<noinclude>{{documentation}}[[Category:Template boxes]]</noinclude>
m65gyylguoazwtajli7p8owsxngezm7
Module:table
828
2990
8302
2022-07-22T09:56:23Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
--[[
------------------------------------------------------------------------------------
-- table (formerly TableTools) --
-- --
-- This module includes a number of functions for dealing with Lua tables. --
-- It is a meta-module, meant to be called from other Lua modules, and should --
-- not be called directly from #invoke. --
------------------------------------------------------------------------------------
--]]
--[[
Inserting new values into a table using a local "index" variable, which is
incremented each time, is faster than using "table.insert(t, x)" or
"t[#t + 1] = x". See the talk page.
]]
local libraryUtil = require('libraryUtil')
local export = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
local function _check(funcName, expectType)
if type(expectType) == "string" then
return function(argIndex, arg, nilOk)
checkType(funcName, argIndex, arg, expectType, nilOk)
end
else
return function(argIndex, arg, expectType, nilOk)
if type(expectType) == "table" then
checkTypeMulti(funcName, argIndex, arg, expectType, nilOk)
else
checkType(funcName, argIndex, arg, expectType, nilOk)
end
end
end
end
--[[
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
--]]
function export.isPositiveInteger(v)
return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end
--[[
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a value can be a valid table key. Lua will
-- generate an error if a NaN is used as a table key.
------------------------------------------------------------------------------------
--]]
function export.isNan(v)
if type(v) == 'number' and tostring(v) == '-nan' then
return true
else
return false
end
end
--[[
------------------------------------------------------------------------------------
-- shallowcopy
--
-- This returns a clone of an object. If the object is a table, the value
-- returned is a new table, but all subtables and functions are shared.
-- Metamethods are respected, but the returned table will have no metatable of
-- its own.
------------------------------------------------------------------------------------
--]]
function export.shallowcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[orig_key] = orig_value
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
-- An alias for shallowcopy(); prefer shallowcopy().
function export.shallowClone(t)
return export.shallowcopy(t)
end
--[[
Recursive deep copy function
Equivalent to mw.clone?
]]
local function deepcopy(orig, includeMetatable, already_seen)
-- Stores copies of tables indexed by the original table.
already_seen = already_seen or {}
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
if type(orig) == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[deepcopy(orig_key, includeMetatable, already_seen)] = deepcopy(orig_value, includeMetatable, already_seen)
end
already_seen[orig] = copy
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
local mt_copy = deepcopy(mt, includeMetatable, already_seen)
setmetatable(copy, mt_copy)
end
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function export.deepcopy(orig, noMetatable, already_seen)
checkType("deepcopy", 3, already_seen, "table", true)
return deepcopy(orig, not noMetatable, already_seen)
end
--[[
------------------------------------------------------------------------------------
-- append
--
-- This appends any number of tables together and returns the result. Compare the Lisp
-- expression (append list1 list2 ...).
------------------------------------------------------------------------------------
--]]
function export.append(...)
local ret = {}
for i=1,select('#', ...) do
local argt = select(i, ...)
checkType('append', i, argt, 'table')
for _, v in ipairs(argt) do
table.insert(ret, v)
end
end
return ret
end
--[[
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
--]]
function export.removeDuplicates(t)
checkType('removeDuplicates', 1, t, 'table')
local isNan = export.isNan
local ret, exists = {}, {}
local index = 1
for _, v in ipairs(t) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[index] = v
index = index + 1
else
if not exists[v] then
ret[index] = v
index = index + 1
exists[v] = true
end
end
end
return ret
end
--[[
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
--]]
function export.numKeys(t, checked)
if not checked then
checkType('numKeys', 1, t, 'table')
end
local isPositiveInteger = export.isPositiveInteger
local nums = {}
local index = 1
for k, _ in pairs(t) do
if isPositiveInteger(k) then
nums[index] = k
index = index + 1
end
end
table.sort(nums)
return nums
end
function export.maxIndex(t)
checkType('maxIndex', 1, t, 'table')
local positiveIntegerKeys = export.numKeys(t)
if positiveIntegerKeys[1] then
return math.max(unpack(positiveIntegerKeys))
else
return 0 -- ???
end
end
--[[
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix.
-- affixNums({a1 = 'foo', a3 = 'bar', a6 = 'baz'}, "a")
-- ↓
-- {1, 3, 6}.
------------------------------------------------------------------------------------
--]]
function export.affixNums(t, prefix, suffix)
local check = _check('affixNums')
check(1, t, 'table')
check(2, prefix, 'string', true)
check(3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
s = s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
return s
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
local index = 1
for k, _ in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[index] = tonumber(num)
index = index + 1
end
end
end
table.sort(nums)
return nums
end
--[[
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like ("foo1", "bar1", "foo2", "baz2"), returns a table
-- of subtables in the format
-- { [1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'} }
-- Keys that don't end with an integer are stored in a subtable named "other".
-- The compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
--]]
function export.numData(t, compress)
local check = _check('numData')
check(1, t, 'table')
check(2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = tostring(k):match('^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = export.compressSparseArray(ret)
ret.other = other
end
return ret
end
--[[
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
--]]
function export.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local index = 1
local nums = export.numKeys(t)
for _, num in ipairs(nums) do
ret[index] = t[num]
index = index + 1
end
return ret
end
--[[
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
--]]
function export.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = export.numKeys(t)
local i = 0
return function()
i = i + 1
local key = nums[i]
if key then
return key, t[key]
else
return nil, nil
end
end
end
--[[
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
--]]
function export.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
--[[
-- This returns the length of a table, or the first integer key n counting from
-- 1 such that t[n + 1] is nil. It is similar to the operator #, but may return
-- a different value when there are gaps in the array portion of the table.
-- Intended to be used on data loaded with mw.loadData. For other tables, use #.
--]]
function export.length(t)
local i = 0
repeat
i = i + 1
until t[i] == nil
return i - 1
end
--[[
Recursively compare two values that may be tables, including tables with
nested tables as values. Return true if both values are structurally equal.
Note that this handles arbitary levels of nesting. If all tables are known
to be lists (with only integral keys), use export.deepEqualsList, which will
be more efficient.
NOTE: This is *NOT* smart enough to properly handle cycles; in such a case, it
will get into an infinite loop.
]]
function export.deepEquals(x, y)
if type(x) == "table" and type(y) == "table" then
-- Two tables are the same if they have the same number of elements
-- and all keys that are present in one of the tables compare equal
-- to the corresponding keys in the other table, using structural
-- comparison.
local sizex = 0
for key, value in pairs(x) do
if not export.deepEquals(value, y[key]) then
return false
end
sizex = sizex + 1
end
local sizey = export.size(y)
if sizex ~= sizey then
return false
end
return true
end
return x == y
end
--[[
Recursively compare two values that may be lists (i.e. tables with integral
keys), including lists with nested lists as values. Return true if both values
are structurally equal. Note that this handles arbitary levels of nesting.
Results are undefined if tables with non-integral keys are present anywhere in
either structure; if that may be the case, use export.deepEquals, which will
handle such tables correctly but be less efficient on lists than
export.deepEqualsList.
NOTE: This is *NOT* smart enough to properly handle cycles; in such a case, it
will get into an infinite loop.
]]
function export.deepEqualsList(x, y)
if type(x) == "table" and type(y) == "table" then
if #x ~= #y then
return false
end
for key, value in ipairs(x) do
if not export.deepEqualsList(value, y[key]) then
return false
end
end
return true
end
return x == y
end
--[[
Given a list and a value to be found, return true if the value is in the array
portion of the list. Comparison is by value, using `deepEquals`.
NOTE: This used to do shallow comparison by default and accepted a third
'deepCompare' param to do deep comparison. This param is still accepted but now
ignored.
]]
function export.contains(list, x)
checkType('contains', 1, list, 'table')
for _, v in ipairs(list) do
if export.deepEquals(v, x) then return true end
end
return false
end
--[[
Given a general table and a value to be found, return true if the value is in
either the array or hashmap portion of the table. Comparison is by value, using
`deepEquals`.
NOTE: This used to do shallow comparison by default and accepted a third
'deepCompare' param to do deep comparison. This param is still accepted but now
ignored.
]]
function export.tableContains(tbl, x)
checkType('tableContains', 1, tbl, 'table')
for _, v in pairs(tbl) do
if export.deepEquals(v, x) then return true end
end
return false
end
--[[
Given a list and a value to be inserted, append or insert the value if not
already present in the list. Comparison is by value, using `deepEquals`.
Appends to the end, like the default behavior of table.insert(), unless `pos`
is given, in which case insertion happens at position `pos` (i.e. before the
existing item at position `pos`).
NOTE: The order of `item` and `pos` is reversed in comparison to table.insert(),
which uses `table.insert(list, item)` to insert at the end but
`table.insert(list, pos, item)` to insert at position POS.
NOTE: This used to do shallow comparison by default and accepted a fourth
'deepCompare' param to do deep comparison. This param is still accepted but now
ignored.
]]
function export.insertIfNot(list, item, pos)
if not export.contains(list, item) then
if pos then
table.insert(list, pos, item)
else
table.insert(list, item)
end
end
end
--[[
Finds key for specified value in a given table.
Roughly equivalent to reversing the key-value pairs in the table –
reversed_table = { [value1] = key1, [value2] = key2, ... }
– and then returning reversed_table[valueToFind].
The value can only be a string or a number
(not nil, a boolean, a table, or a function).
Only reliable if there is just one key with the specified value.
Otherwise, the function returns the first key found,
and the output is unpredictable.
]]
function export.keyFor(t, valueToFind)
local check = _check('keyFor')
check(1, t, 'table')
check(2, valueToFind, { 'string', 'number' })
for key, value in pairs(t) do
if value == valueToFind then
return key
end
end
return nil
end
--[[
The default sorting function used in export.keysToList if no keySort
is defined.
]]
local function defaultKeySort(key1, key2)
-- "number" < "string", so numbers will be sorted before strings.
local type1, type2 = type(key1), type(key2)
if type1 ~= type2 then
return type1 < type2
else
return key1 < key2
end
end
--[[
Returns a list of the keys in a table, sorted using either the default
table.sort function or a custom keySort function.
If there are only numerical keys, numKeys is probably more efficient.
]]
function export.keysToList(t, keySort, checked)
if not checked then
local check = _check('keysToList')
check(1, t, 'table')
check(2, keySort, 'function', true)
end
local list = {}
local index = 1
for key, _ in pairs(t) do
list[index] = key
index = index + 1
end
-- Place numbers before strings, otherwise sort using <.
if not keySort then
keySort = defaultKeySort
end
table.sort(list, keySort)
return list
end
--[[
Iterates through a table, with the keys sorted using the keysToList function.
If there are only numerical keys, sparseIpairs is probably more efficient.
]]
function export.sortedPairs(t, keySort)
local check = _check('keysToList')
check(1, t, 'table')
check(2, keySort, 'function', true)
local list = export.keysToList(t, keySort, true)
local i = 0
return function()
i = i + 1
local key = list[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
function export.reverseIpairs(list)
checkType('reverse_ipairs', 1, list, 'table')
local i = #list + 1
return function()
i = i - 1
if list[i] ~= nil then
return i, list[i]
else
return nil, nil
end
end
end
--[=[
Joins an array with serial comma and serial conjunction, normally "and".
An improvement on mw.text.listToText, which doesn't properly handle serial
commas.
Options:
- conj
Conjunction to use; defaults to "and".
- italicizeConj
Italicize conjunction: for [[Module:Template:also]]
- dontTag
Don't tag the serial comma and serial "and". For error messages, in
which HTML cannot be used.
]=]
function export.serialCommaJoin(seq, options)
local check = _check("serialCommaJoin", "table")
check(1, seq)
check(2, options, true)
local length = #seq
if not options then
options = {}
end
local conj
if length > 1 then
conj = options.conj or "and"
if options.italicizeConj then
conj = "''" .. conj .. "''"
end
end
if length == 0 then
return ""
elseif length == 1 then
return seq[1] -- nothing to join
elseif length == 2 then
return seq[1] .. " " .. conj .. " " .. seq[2]
else
local comma = options.dontTag and "," or '<span class="serial-comma">,</span>'
conj = options.dontTag and ' ' .. conj .. " " or '<span class="serial-and"> ' .. conj .. '</span> '
return table.concat(seq, ", ", 1, length - 1) ..
comma .. conj .. seq[length]
end
end
--[[
Concatenates all values in the table that are indexed by a number, in order.
sparseConcat{ a, nil, c, d } => "acd"
sparseConcat{ nil, b, c, d } => "bcd"
]]
function export.sparseConcat(t, sep, i, j)
local list = {}
local list_i = 0
for _, v in export.sparseIpairs(t) do
list_i = list_i + 1
list[list_i] = v
end
return table.concat(list, sep, i, j)
end
--[[
Values of numberic keys in array portion of table are reversed:
{ "a", "b", "c" } -> { "c", "b", "a" }
--]]
function export.reverse(t)
checkType("reverse", 1, t, "table")
local new_t = {}
local new_t_i = 1
for i = #t, 1, -1 do
new_t[new_t_i] = t[i]
new_t_i = new_t_i + 1
end
return new_t
end
function export.reverseConcat(t, sep, i, j)
return table.concat(export.reverse(t), sep, i, j)
end
-- { "a", "b", "c" } -> { a = 1, b = 2, c = 3 }
function export.invert(array)
checkType("invert", 1, array, "table")
local map = {}
for i, v in ipairs(array) do
map[v] = i
end
return map
end
--[[
{ "a", "b", "c" } -> { ["a"] = true, ["b"] = true, ["c"] = true }
--]]
function export.listToSet(t)
checkType("listToSet", 1, t, "table")
local set = {}
for _, item in ipairs(t) do
set[item] = true
end
return set
end
--[[
Returns true if all keys in the table are consecutive integers starting at 1.
--]]
function export.isArray(t)
checkType("isArray", 1, t, "table")
local i = 0
for _ in pairs(t) do
i = i + 1
if t[i] == nil then
return false
end
end
return true
end
return export
qngdifkzhm48c4ao05cne39capwc0ti
Template:langname
10
2991
8303
2022-07-22T10:01:53Z
Rebel Agent
2678
Ke dirile template
wikitext
text/x-wiki
<includeonly>{{safesubst:#invoke:languages/templates|getByCode|{{{1}}}|getCanonicalName}}</includeonly><noinclude>
{{documentation}}
</noinclude>
ie1odf96p0hd3cw3do2bii2qoengusl
Module:languages/templates
828
2992
8304
2022-07-22T10:04:18Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
function export.exists(frame)
local args = frame.args
local lang = args[1] or error("Language code has not been specified. Please pass parameter 1 to the module invocation.")
lang = require("Module:languages").getByCode(lang)
if lang then
return "1"
else
return ""
end
end
-- Used by the following JS:
-- * [[WT:ACCEL]]
-- * [[WT:EDIT]]
-- * [[WT:NEC]]
function export.getByCode(frame)
local iparams = {
[1] = {required = true},
[2] = {required = true},
[3] = {},
[4] = {},
[5] = {},
}
local iargs = require("Module:parameters").process(frame.args, iparams)
local langcode = iargs[1]
local lang = require("Module:languages").getByCode(langcode, true)
return require("Module:language-like").templateGetByCode(lang, iargs,
function(itemname)
local list
if itemname == "getWikimediaLanguages" then
list = lang:getWikimediaLanguages()
elseif itemname == "getScripts" then
list = lang:getScriptCodes()
elseif itemname == "getAncestors" then
list = lang:getAncestors()
end
if list then
local index = iargs[3]
index = tonumber(index) or error("Please specify the numeric index of the desired item.")
local retval = list[index]
if retval then
if type(retval) == "string" then
return retval
else
return retval:getCode()
end
else
return ""
end
end
if itemname == "transliterate" then
local text = iargs[3]
local sc = iargs[4]
local module_override = iargs[5]
sc = require("Module:scripts").getByCode(sc, 4)
return lang:transliterate(text, sc, module_override) or ""
elseif itemname == "makeEntryName" then
local text = iargs[3]
return lang:makeEntryName(text) or ""
elseif itemname == "makeSortKey" then
local text = iargs[3]
return lang:makeSortKey(text) or ""
elseif itemname == "countCharacters" then
local text = args[3] or ""
local sc = require("Module:scripts").getByCode(iargs[4], 4, "disallow nil")
return sc:countCharacters(text)
end
end
)
end
function export.getByCanonicalName(frame)
local args = frame.args
local langname = args[1] or error("Language name has not been specified. Please pass parameter 1 to the module invocation.")
local lang = require("Module:languages").getByCanonicalName(langname)
if lang then
return lang:getCode()
else
return ""
end
end
function export.getByName(frame)
local args = frame.args
local langname = args[1] or error("Language name has not been specified. Please pass parameter 1 to the module invocation.")
local lang = require("Module:languages").getByName(langname)
if lang then
return lang:getCode()
else
return ""
end
end
function export.makeEntryName(frame)
local args = frame.args
local langname = args[1] or error("Language name has not been specified. Please pass parameter 1 to the module invocation.")
local lang = require("Module:languages").getByCode(langname)
if lang then
return lang:makeEntryName(args[2])
else
return ""
end
end
function export.getCanonicalName(frame)
local langCode, args
if require("Module:yesno")(frame.args.parent) then
args = frame:getParent().args
else
args = frame.args
end
langCode = args[1]
if not langCode or langCode == "" then
error("Supply a language code in parameter 1.")
end
return mw.loadData("Module:languages/code to canonical name")[langCode]
or not args.return_if_invalid and "" or langCode
end
return export
lw6ouppnon2ycbze4i1ulntb02ss8qf
Module:language-like
828
2993
8305
2022-07-22T10:07:15Z
Rebel Agent
2678
Ke dirile module
Scribunto
text/plain
local export = {}
-- Implementation of getOtherNames() for languages, etymology languages,
-- families and scripts. If `onlyOtherNames` is passed in, only return
-- the names in the `otherNames` field, otherwise combine `otherNames`,
-- `aliases` and `varieties`.
function export.getOtherNames(self, onlyOtherNames)
local data
if self._extraData then
data = self._extraData
else
data = self._rawData
end
if onlyOtherNames then
return data.otherNames or {}
end
-- Combine otherNames, aliases and varieties. First try to optimize and not create any
-- new memory. This is possible if exactly one of the three exist, and if it's `varieties`,
-- there are no nested lists in `varieties`.
if data.otherNames and not data.aliases and not data.varieties then
return data.otherNames
elseif data.aliases and not data.otherNames and not data.varieties then
return data.aliases
elseif data.varieties and not data.otherNames and not data.aliases then
local saw_table = false
for _, name in ipairs(data.varieties) do
if type(name) == "table" then
saw_table = true
break
end
end
if not saw_table then
return data.varieties
end
end
-- Have to do it the "hard way".
local ret = {}
if data.otherNames then
for _, name in ipairs(data.otherNames) do
table.insert(ret, name)
end
end
if data.aliases then
for _, name in ipairs(data.aliases) do
table.insert(ret, name)
end
end
if data.varieties then
for _, name in ipairs(data.varieties) do
if type(name) == "table" then
for _, n in ipairs(name) do
table.insert(ret, n)
end
else
table.insert(ret, name)
end
end
end
return ret
end
-- Implementation of getVarieties() for languages, etymology languages,
-- families and scripts. If `flatten` is passed in, flatten down to a
-- list of stings; otherwise, keep the structure.
function export.getVarieties(self, flatten)
local data
if self._extraData then
data = self._extraData
else
data = self._rawData
end
if data.varieties then
-- If flattening not requested, just return them.
if not flatten then
return data.varieties
end
-- Check if no nested table; if so, just return the result.
local saw_table = false
for _, name in ipairs(data.varieties) do
if type(name) == "table" then
saw_table = true
break
end
end
if not saw_table then
return data.varieties
end
-- At this point, we need to flatten the varieties.
local ret = {}
for _, name in ipairs(data.varieties) do
if type(name) == "table" then
for _, n in ipairs(name) do
table.insert(ret, n)
end
else
table.insert(ret, name)
end
end
return ret
else
return {}
end
end
-- Implementation of template-callable getByCode() function for languages,
-- etymology languages, families and scripts. `item` is the language,
-- family or script in question; `args` is the arguments passed in by the
-- module invocation; `extra_processing`, if specified, is a function of
-- one argument (the requested property) and should return the value to
-- be returned to the caller, or nil if the property isn't recognized.
-- `extra_processing` is called after special-cased properties are handled
-- and before general-purpose processing code that works for all string
-- properties.
function export.templateGetByCode(item, args, extra_processing)
-- The item that the caller wanted to look up
local itemname = args[2] or error("Function to call (parameter 2) has not been specified.")
local list
if itemname == "getOtherNames" then
list = item:getOtherNames()
elseif itemname == "getOnlyOtherNames" then
list = item:getOtherNames(true)
elseif itemname == "getAliases" then
list = item:getAliases()
elseif itemname == "getVarieties" then
list = item:getVarieties(true)
end
if list then
local index = args[3]; if index == "" then index = nil end
index = tonumber(index or error("Numeric index of the desired item in the list (parameter 3) has not been specified."))
return list[index] or ""
end
if itemname == "getFamily" and item.getFamily then
return item:getFamily():getCode()
end
if extra_processing then
local retval = extra_processing(itemname)
if retval then
return retval
end
end
if item[itemname] then
local ret = item[itemname](item)
if type(ret) == "string" then
return ret
else
error("The function \"" .. itemname .. "\" did not return a string value.")
end
end
error("Requested invalid item name \"" .. itemname .. "\".")
end
return export
3jgkiy44irau7thwbogjol2d5vqovih