Module:also: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 4: Line 4:
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs


function codify(text) --removes diacritics and non-alphanumeric characters, converts to upper case
function export.codify(text) --removes diacritics and non-alphanumeric characters, converts to upper case
text = mw.ustring.toNFC(text)
text = mw.ustring.toNFC(text)
text = mw.ustring.gsub(text,"[ÁÀÂÄǍĂĀÃÅĄ]","A")
text = mw.ustring.gsub(text,"[ÁÀÂÄǍĂĀÃÅĄ]","A")
Line 78: Line 78:
for _, term in ipairs(termlist) do -- sorts data into "codes"
for _, term in ipairs(termlist) do -- sorts data into "codes"
local code = codify(term)
local code = export.codify(term)
if data[code] == nil then data[code] = {} end
if data[code] == nil then data[code] = {} end
table.insert(data[code], term)
table.insert(data[code], term)
Line 101: Line 101:
if here_key == "" then
if here_key == "" then
local toAdd = false
local toAdd = false
local check_key = codify(here)
local check_key = export.codify(here)
for key, _ in pairs(data) do
for key, _ in pairs(data) do

Navigation menu