48,355
edits
No edit summary |
No edit summary |
||
| Line 110: | Line 110: | ||
local export = {} | local export = {} | ||
local etymology_languages_data_module = "Module:etymology languages/data" | local etymology_languages_data_module = "Module:etymology languages/data" | ||
local families_module = "Module:families" | local families_module = "Module:families" | ||
| Line 166: | Line 165: | ||
check_object = require(utilities_module).check_object | check_object = require(utilities_module).check_object | ||
return check_object(...) | return check_object(...) | ||
end | end | ||
| Line 302: | Line 296: | ||
return uupper(...) | return uupper(...) | ||
end | end | ||
local function normalize_code(code) | local function normalize_code(code) | ||
| Line 490: | Line 479: | ||
else | else | ||
text, fail, cats = module[function_name](sc:toFixedNFD(text), self, sc) | text, fail, cats = module[function_name](sc:toFixedNFD(text), self, sc) | ||
end | end | ||
else | else | ||
| Line 1,558: | Line 1,538: | ||
if (not text) or text == "" then | if (not text) or text == "" then | ||
return text, nil, {} | return text, nil, {} | ||
end | end | ||
-- Remove directional characters, soft hyphens, strip markers and HTML tags. | -- Remove directional characters, soft hyphens, strip markers and HTML tags. | ||
| Line 1,651: | Line 1,628: | ||
:gsub("\4", ":") | :gsub("\4", ":") | ||
end | end | ||
--[[if not self:hasType("conlang") then | |||
text = gsub(text,"^%*", "") | |||
end | |||
text = gsub(text,"^%*%*", "*")]] | |||
return text, fail, cats, subbedChars | return text, fail, cats, subbedChars | ||
| Line 1,688: | Line 1,672: | ||
sc = checkScript(text, self, sc) | sc = checkScript(text, self, sc) | ||
if not (sc:isTransliterated() or module_override) then | if not (sc:isTransliterated() or module_override) then | ||
return nil, true, {} | return nil, true, {} | ||
end | end | ||
| Line 1,736: | Line 1,715: | ||
return m1 .. uupper(m2) | return m1 .. uupper(m2) | ||
end) | end) | ||
end | end | ||
| Line 2,071: | Line 2,045: | ||
--[==[Finds the language whose code matches the one provided. If it exists, it returns a <code class="nf">Language</code> object representing the language. Otherwise, it returns {{code|lua|nil}}, unless <code class="n">paramForError</code> is given, in which case an error is generated. If <code class="n">paramForError</code> is {{code|lua|true}}, a generic error message mentioning the bad code is generated; otherwise <code class="n">paramForError</code> should be a string or number specifying the parameter that the code came from, and this parameter will be mentioned in the error message along with the bad code. If <code class="n">allowEtymLang</code> is specified, etymology-only language codes are allowed and looked up along with normal language codes. If <code class="n">allowFamily</code> is specified, language family codes are allowed and looked up along with normal language codes.]==] | --[==[Finds the language whose code matches the one provided. If it exists, it returns a <code class="nf">Language</code> object representing the language. Otherwise, it returns {{code|lua|nil}}, unless <code class="n">paramForError</code> is given, in which case an error is generated. If <code class="n">paramForError</code> is {{code|lua|true}}, a generic error message mentioning the bad code is generated; otherwise <code class="n">paramForError</code> should be a string or number specifying the parameter that the code came from, and this parameter will be mentioned in the error message along with the bad code. If <code class="n">allowEtymLang</code> is specified, etymology-only language codes are allowed and looked up along with normal language codes. If <code class="n">allowFamily</code> is specified, language family codes are allowed and looked up along with normal language codes.]==] | ||
function export.getByCode(code, paramForError, allowEtymLang, allowFamily) | function export.getByCode(code, paramForError, allowEtymLang, allowFamily) | ||
if type(code) ~= "string" then | if type(code) ~= "string" then | ||
local typ | local typ | ||
| Line 2,090: | Line 2,060: | ||
local m_data = load_data(languages_data_module) | local m_data = load_data(languages_data_module) | ||
local norm_code = normalize_code(code) | local norm_code = normalize_code(code) | ||