Module:User:Erutuon/show data
Appearance
- The following documentation is located at Module:User:Erutuon/show data/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
Displays the data for the code of a language, language family, or etymology language from the appropriate data module. Used in User:Erutuon/scripts/showLanguageData.js.
{{#invoke:User:Erutuon/show_data|main|code1|code2|...}}
m["en"] = {
"English",
1860,
"gmw-ang",
"Latn, Brai, Shaw, Dsrt", -- entries in Shaw or Dsrt might require prior discussion
wikimedia_codes = "en, simple",
ancestors = "en-ear",
sort_key = {
Latn = {
-- Many of these are needed for sorting language names.
remove_diacritics = "'\"%-%.,%s·ʻʼ" .. c.diacritics,
-- These are found in entry names.
from = {"æ", "🅱", "[¢©ᴄ]", "[ðđ]", "[əǝ]", "[ħʜ]", "ɨ", "ł", "[ŋɲ]", "[øɔ]", "œ", "ꝓ", "ß", "ʋ"},
to = {"ae", "b", "c", "d", "e", "h", "i", "l", "n", "o", "oe", "p", "ss", "v"}
},
},
standardChars = {
Latn = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",
Brai = c.braille,
c.punc
},
}
m["enm"] = {
"Middle English",
36395,
"gmw-ang",
"Latn",
entry_name = {remove_diacritics = c.acute .. c.macron .. c.dotabove},
}
m["ang"] = {
"Old English",
42365,
"gmw-ang",
"Latn, Runr",
translit = {
Runr = "Runr-translit"
},
entry_name = {
Latn = {
remove_diacritics = c.acute .. c.macron .. c.dotabove,
from = {"Ƿ", "ƿ"},
to = {"W", "w"}
},
},
sort_key = {
Latn = {
remove_diacritics = c.acute .. c.macron .. c.dotabove,
from = {"æ", "ð", "þ", "ƿ"},
to = {"ae", "t" .. p[1], "t" .. p[2], "w" .. p[1]}
},
},
standardChars = {
Latn = "AaÆæBbCcDdEeFfGgHhIiLlMmNnOoŒœPpRrSsTtUuWwXxYyÐðÞþ",
c.punc,
},
}
local export = {}
local pattern_escape = require "Module:string utilities".pattern_escape
local function get_module(code)
if require "Module:families/data"[code] then
return "Module:families/data"
elseif require "Module:etymology languages/data"[code] then
return "Module:etymology languages/data"
else
local name = require "Module:languages".getDataModuleName(code)
if name then
return "Module:" .. name
end
end
end
function export.get_data(codes)
local data_module_content = require "Module:array"()
for _, code in ipairs(codes) do
local module = get_module(code)
if not module then
return "-- No module for code " .. code .. "."
end
local module_text = mw.title.new(module):getContent()
if not module_text then
return "-- Module " .. module .. " has no content."
end
local data = module_text:match('m%["' .. pattern_escape(code) .. '"%]%s*=%s*%b{}')
if not data then
return "-- Code " .. code .. " not found in " .. module .. "."
end
data_module_content:insert(data)
end
return data_module_content:concat("\n\n")
end
function export.main(frame)
local codes = frame.args
return require "Module:debug".highlight(export.get_data(codes))
end
return export