45,647
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local m_labeldata = mw.loadData("Module:labels/data") | local m_labeldata = mw.loadData("Module:labels/data") | ||
local | --local m_links = require("Module:links") unused | ||
local | |||
local m_utilities_format_categories = require("Module:utilities/format_categories") | |||
local export = {} | local export = {} | ||
Line 54: | Line 55: | ||
end | end | ||
return | return m_utilities_format_categories(categories, lang, sort_key, nil, force_cat) .. | ||
m_utilities_format_categories(categories2, lang, sort_key2, nil, force_cat) | |||
end | end | ||
Line 63: | Line 64: | ||
local categories = "" | local categories = "" | ||
local alias | local alias | ||
local data = m_labeldata[label] | |||
-- get language-specific labels from data module | |||
local langcode = lang:getCode() | |||
local langlabels_ok, langlabels = pcall(function() return mw.loadData("Module:labels/data/lang/" .. langcode) end) | |||
if langlabels_ok then | |||
-- prefer per-language label in order to pick subvariety labels over regional ones | |||
data = langlabels[label] or data | |||
end | |||
data = data or {} | |||
if data.deprecated then | |||
deprecated = true | deprecated = true | ||
end | end | ||
if | if type(data) == "string" or data.alias_of then | ||
alias = label | alias = label | ||
label = m_labeldata | label = data.alias_of or data | ||
if langlabels_ok then | |||
data = langlabels[label] or m_labeldata[label] | |||
else | |||
data = m_labeldata[label] | |||
end | |||
data = data or {} | |||
end | end | ||
if | if data.deprecated then | ||
deprecated = true | deprecated = true | ||
end | end | ||
Line 133: | Line 119: | ||
if data.glossary then | if data.glossary then | ||
local glossary_entry = type(data.glossary) == "string" and data.glossary or label | local glossary_entry = type(data.glossary) == "string" and data.glossary or label | ||
label = "[[ | label = "[[Appendix:Glossary#" .. glossary_entry .. "|" .. ( data.display or label ) .. "]]" | ||
elseif data.Wikipedia then | elseif data.Wikipedia then | ||
Wikipedia_entry = type(data.Wikipedia) == "string" and data.Wikipedia or label | Wikipedia_entry = type(data.Wikipedia) == "string" and data.Wikipedia or label | ||
Line 145: | Line 131: | ||
label = '<span class="deprecated-label">' .. label .. '</span>' | label = '<span class="deprecated-label">' .. label .. '</span>' | ||
if not nocat then | if not nocat then | ||
categories = categories .. | categories = categories .. m_utilities_format_categories({ "Entries with deprecated labels" }, lang, sort_key, nil, force_cat) | ||
end | end | ||
end | end | ||
Line 213: | Line 199: | ||
label = "" | label = "" | ||
else | else | ||
label = (omit_comma and "" or '<span class="ib-comma | label = (omit_comma and "" or '<span class="ib-comma">,</span>') .. | ||
(omit_space and "" or " ") .. | (omit_space and "" or " ") .. | ||
ret.label | ret.label | ||
Line 221: | Line 207: | ||
return | return | ||
"<span class=\"ib-brac\">(</span><span class=\"ib-content | "<span class=\"ib-brac\">(</span><span class=\"ib-content\">" .. | ||
table.concat(labels, "") .. | table.concat(labels, "") .. | ||
"</span><span class=\"ib-brac\">)</span>" | "</span><span class=\"ib-brac\">)</span>" |