Module:grk-mar-entryname
Appearance
- The following documentation is located at Module:grk-mar-entryname/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will generate entry names for Mariupol Greek language text.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{entryname}}
.
Within a module, use Module:languages#Language:makeEntryName.
For testcases, see Module:grk-mar-entryname/testcases.
Functions
makeEntryName(text, lang, sc)
- Generates an entry name for a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. - When entry name generation fails, returns
nil
.
local export = {}
local u = mw.ustring.char
local remove_diacritics = u(0x030C) .. u(0x0324) .. u(0x032E) -- caron, diaeresis below, breve below
function export.makeEntryName(text, lang, sc)
text = mw.ustring.toNFD(text) -- decompose
if sc == "Cyrl" then -- if script is Cyrillic, remove acute accents
text = mw.ustring.gsub(text, "[" .. u(0x0301) .. "]", "")
end
return mw.ustring.toNFC(mw.ustring.gsub(text, "[" .. remove_diacritics .. "]", "")) -- remove appropriate diacritics, then recompose again
end
return export