Module:Latin
Appearance
From Wikipedia, the free encyclopedia
You might want to create a documentation page for this Scribunto module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
local p = {} function p._removeaccents(rv) rv = mw.ustring.gsub(rv,"[ÁÀÂÄǍĂĀÃÅĄ]","A") rv = mw.ustring.gsub(rv,"[ÆǢǼ]","Ae") rv = mw.ustring.gsub(rv,"[ĆĊĈČÇ]","C") rv = mw.ustring.gsub(rv,"[ĎĐḌÐḐ]","D") rv = mw.ustring.gsub(rv,"[ÉÈĖÊËĚĔĒẼĘẸƐƎƏỀỂỄẾỆ]","E") rv = mw.ustring.gsub(rv,"[ĠĜĞĢ]","G") rv = mw.ustring.gsub(rv,"[ĤĦḤ]","H") rv = mw.ustring.gsub(rv,"[İÍÌÎÏǏĬĪĨĮỊ]","I") rv = mw.ustring.gsub(rv,"[Ĵ]","J") rv = mw.ustring.gsub(rv,"[Ķ]","K") rv = mw.ustring.gsub(rv,"[ĹL·ĽĻŁḶḸ]","L") rv = mw.ustring.gsub(rv,"[Ṃ]","M") rv = mw.ustring.gsub(rv,"[ŃŇÑŅṆŊ]","N") rv = mw.ustring.gsub(rv,"[ÓÒÔÖǑŎŌÕǪỌŐØƆ]","O") rv = mw.ustring.gsub(rv,"[Œ]","Oe") rv = mw.ustring.gsub(rv,"[ŔŘŖṚṜꝚⱤɌƦȐȒṘ]","R") rv = mw.ustring.gsub(rv,"[ŚŜŠŞȘṢ]","S") rv = mw.ustring.gsub(rv,"[ŤŢȚṬ]","T") rv = mw.ustring.gsub(rv,"[Þ]","Th") rv = mw.ustring.gsub(rv,"[ÚÙÛÜǓŬŪŨŮŲỤŰǗǛǙǕ]","U") rv = mw.ustring.gsub(rv,"[Ŵ]","W") rv = mw.ustring.gsub(rv,"[ÝŶŸỸȲ]","Y") rv = mw.ustring.gsub(rv,"[ŹŻŽ]","Z") rv = mw.ustring.gsub(rv,"[áàâäǎăāãåąắăằắẳẵặâầẩẫấậả]","a") rv = mw.ustring.gsub(rv,"[æǣǽ]","ae") rv = mw.ustring.gsub(rv,"[ćċĉčç]","c") rv = mw.ustring.gsub(rv,"[ďđḍðḑ]","d") rv = mw.ustring.gsub(rv,"[éèėêëěĕēẽęẹɛǝəềểễếệ]","e") rv = mw.ustring.gsub(rv,"[ġĝğģ]","g") rv = mw.ustring.gsub(rv,"[ĥħḥḩ]","h") rv = mw.ustring.gsub(rv,"[ıíìîïǐĭīĩįị]","i") rv = mw.ustring.gsub(rv,"[ĵ]","j") rv = mw.ustring.gsub(rv,"[ķ]","k") rv = mw.ustring.gsub(rv,"[ĺl·ľļłḷḹ]","l") rv = mw.ustring.gsub(rv,"[ṃ]","m") rv = mw.ustring.gsub(rv,"[ńňñņṇŋ]","n") rv = mw.ustring.gsub(rv,"[óòôöǒŏōõǫọőøɔơồ]","o") rv = mw.ustring.gsub(rv,"[œ]","oe") rv = mw.ustring.gsub(rv,"[ŕřŗṛṝꝛɽɍʀȑȓṙ]","r") rv = mw.ustring.gsub(rv,"[śŝšşșṣ]","s") rv = mw.ustring.gsub(rv,"[ß]","ss") rv = mw.ustring.gsub(rv,"[ťţțṭ]","t") rv = mw.ustring.gsub(rv,"[þ]","th") rv = mw.ustring.gsub(rv,"[úùûüǔŭūũůųụűǘǜǚǖưứừ]","u") rv = mw.ustring.gsub(rv,"[ŵ]","w") rv = mw.ustring.gsub(rv,"[ýŷÿỹȳ]","y") rv = mw.ustring.gsub(rv,"[źżž]","z") return rv end function p.removeaccents(frame) local rv = mw.ustring.toNFC (frame.args[1]) -- if (true) then return mw.ustring.isutf8 (rv) end return p._removeaccents(rv) end --[[ The next function returns a % encoding concomitant with ISO/IEC 8859-1. It encodes % and any non-reserved and non-unreserved characters. Space is currently encoded as an underscore. Reserved characters are currently not encoded. ]] function p.urlencodeISO88591(frame) local rv = mw.ustring.toNFC (frame.args[1]) -- % first to avoid double encoding rv = mw.ustring.gsub(rv,"%%","%%%%") -- space to underscore, then punctuation which is not reserved rv = mw.ustring.gsub(rv," ","_") rv = mw.ustring.gsub(rv,"034円;","%%22") -- quote mark rv = mw.ustring.gsub(rv,"<","%%3C") rv = mw.ustring.gsub(rv,">","%%3E") rv = mw.ustring.gsub(rv,"\\","%%5C") -- backslash does not work with "092円", "%\" or "\" rv = mw.ustring.gsub(rv,"%^","%%5E") rv = mw.ustring.gsub(rv,"`","%%60") rv = mw.ustring.gsub(rv,"{","%%7B") rv = mw.ustring.gsub(rv,"|","%%7C") rv = mw.ustring.gsub(rv,"}","%%7D") -- all the rest of the codepoints that are printable rv = mw.ustring.gsub(rv,"194円160円","%%A0") rv = mw.ustring.gsub(rv,"194円161円","%%A1") rv = mw.ustring.gsub(rv,"194円162円","%%A2") rv = mw.ustring.gsub(rv,"194円163円","%%A3") rv = mw.ustring.gsub(rv,"194円164円","%%A4") rv = mw.ustring.gsub(rv,"194円165円","%%A5") rv = mw.ustring.gsub(rv,"194円166円","%%A6") rv = mw.ustring.gsub(rv,"194円167円","%%A7") rv = mw.ustring.gsub(rv,"194円168円","%%A8") rv = mw.ustring.gsub(rv,"194円169円","%%A9") rv = mw.ustring.gsub(rv,"194円170円","%%AA") rv = mw.ustring.gsub(rv,"194円171円","%%AB") rv = mw.ustring.gsub(rv,"194円172円","%%AC") rv = mw.ustring.gsub(rv,"194円173円","%%AD") rv = mw.ustring.gsub(rv,"194円174円","%%AE") rv = mw.ustring.gsub(rv,"194円175円","%%AF") rv = mw.ustring.gsub(rv,"194円176円","%%B0") rv = mw.ustring.gsub(rv,"194円177円","%%B1") rv = mw.ustring.gsub(rv,"194円178円","%%B2") rv = mw.ustring.gsub(rv,"194円179円","%%B3") rv = mw.ustring.gsub(rv,"194円180円","%%B4") rv = mw.ustring.gsub(rv,"194円181円","%%B5") rv = mw.ustring.gsub(rv,"194円182円","%%B6") rv = mw.ustring.gsub(rv,"194円183円","%%B7") rv = mw.ustring.gsub(rv,"194円184円","%%B8") rv = mw.ustring.gsub(rv,"194円185円","%%B9") rv = mw.ustring.gsub(rv,"194円186円","%%BA") rv = mw.ustring.gsub(rv,"194円187円","%%BB") rv = mw.ustring.gsub(rv,"194円188円","%%BC") rv = mw.ustring.gsub(rv,"194円189円","%%BD") rv = mw.ustring.gsub(rv,"194円190円","%%BE") rv = mw.ustring.gsub(rv,"194円191円","%%BF") rv = mw.ustring.gsub(rv,"195円128円","%%C0") rv = mw.ustring.gsub(rv,"195円129円","%%C1") rv = mw.ustring.gsub(rv,"195円130円","%%C2") rv = mw.ustring.gsub(rv,"195円131円","%%C3") rv = mw.ustring.gsub(rv,"195円132円","%%C4") rv = mw.ustring.gsub(rv,"195円133円","%%C5") rv = mw.ustring.gsub(rv,"195円134円","%%C6") rv = mw.ustring.gsub(rv,"195円135円","%%C7") rv = mw.ustring.gsub(rv,"195円136円","%%C8") rv = mw.ustring.gsub(rv,"195円137円","%%C9") rv = mw.ustring.gsub(rv,"195円138円","%%CA") rv = mw.ustring.gsub(rv,"195円139円","%%CB") rv = mw.ustring.gsub(rv,"195円140円","%%CC") rv = mw.ustring.gsub(rv,"195円141円","%%CD") rv = mw.ustring.gsub(rv,"195円142円","%%CE") rv = mw.ustring.gsub(rv,"195円143円","%%CF") rv = mw.ustring.gsub(rv,"195円144円","%%D0") rv = mw.ustring.gsub(rv,"195円145円","%%D1") rv = mw.ustring.gsub(rv,"195円146円","%%D2") rv = mw.ustring.gsub(rv,"195円147円","%%D3") rv = mw.ustring.gsub(rv,"195円148円","%%D4") rv = mw.ustring.gsub(rv,"195円149円","%%D5") rv = mw.ustring.gsub(rv,"195円150円","%%D6") rv = mw.ustring.gsub(rv,"195円151円","%%D7") rv = mw.ustring.gsub(rv,"195円152円","%%D8") rv = mw.ustring.gsub(rv,"195円153円","%%D9") rv = mw.ustring.gsub(rv,"195円154円","%%DA") rv = mw.ustring.gsub(rv,"195円155円","%%DB") rv = mw.ustring.gsub(rv,"195円156円","%%DC") rv = mw.ustring.gsub(rv,"195円157円","%%DD") rv = mw.ustring.gsub(rv,"195円158円","%%DE") rv = mw.ustring.gsub(rv,"195円159円","%%DF") rv = mw.ustring.gsub(rv,"195円160円","%%E0") rv = mw.ustring.gsub(rv,"195円161円","%%E1") rv = mw.ustring.gsub(rv,"195円162円","%%E2") rv = mw.ustring.gsub(rv,"195円163円","%%E3") rv = mw.ustring.gsub(rv,"195円164円","%%E4") rv = mw.ustring.gsub(rv,"195円165円","%%E5") rv = mw.ustring.gsub(rv,"195円166円","%%E6") rv = mw.ustring.gsub(rv,"195円167円","%%E7") rv = mw.ustring.gsub(rv,"195円168円","%%E8") rv = mw.ustring.gsub(rv,"195円169円","%%E9") rv = mw.ustring.gsub(rv,"195円170円","%%EA") rv = mw.ustring.gsub(rv,"195円171円","%%EB") rv = mw.ustring.gsub(rv,"195円172円","%%EC") rv = mw.ustring.gsub(rv,"195円173円","%%ED") rv = mw.ustring.gsub(rv,"195円174円","%%EE") rv = mw.ustring.gsub(rv,"195円175円","%%EF") rv = mw.ustring.gsub(rv,"195円176円","%%F0") rv = mw.ustring.gsub(rv,"195円177円","%%F1") rv = mw.ustring.gsub(rv,"195円178円","%%F2") rv = mw.ustring.gsub(rv,"195円179円","%%F3") rv = mw.ustring.gsub(rv,"195円180円","%%F4") rv = mw.ustring.gsub(rv,"195円181円","%%F5") rv = mw.ustring.gsub(rv,"195円182円","%%F6") rv = mw.ustring.gsub(rv,"195円183円","%%F7") rv = mw.ustring.gsub(rv,"195円184円","%%F8") rv = mw.ustring.gsub(rv,"195円185円","%%F9") rv = mw.ustring.gsub(rv,"195円186円","%%FA") rv = mw.ustring.gsub(rv,"195円187円","%%FB") rv = mw.ustring.gsub(rv,"195円188円","%%FC") rv = mw.ustring.gsub(rv,"195円189円","%%FD") rv = mw.ustring.gsub(rv,"195円190円","%%FE") rv = mw.ustring.gsub(rv,"195円191円","%%FF") return rv end return p