local p = -- Processes "ipa=" parameter when specified inside the template. Adds slashes for phonemic transcription,-- unless the argument is already encapsulated within slashes (for phonemic transcription) or square brackets (for-- phonetic transcription).function p.process_ipa(frame) local ipa = frame:getParent.args["ipa"] if ipa
nil then return "" end if mw.ustring.match(ipa, "^%/.*%/$")
nil then return ("/" .. ipa .. "/") else return ipa endend
-- Generate a wikilink to language name, followed by a whitespace, when the language code ends with "+".-- Depends on language code being expanded to full language name via the template, and-- passed through "langname=" parameter, which is faster than expanding that template in Scribunto.function p.process_langcode(frame) local langcode = frame:getParent.args["1"] if langcode
nil then return "" end if mw.ustring.match(langcode, "%+$") then local langname = frame.args["langname"] return "" .. langname .. ": " else return "" endend
-- If language code provided as the first argument ends with "+", it returns the code without the "+" suffix.-- Otherwise, it returns the first argument.function p.get_bare_langcode(frame) local langcode = frame:getParent.args["1"] if langcode
nil then return "" end if mw.ustring.match(langcode, "%+$") then -- strip the "+" suffix local bare_langcode = mw.ustring.sub(langcode, 1, mw.ustring.len(langcode)-1); return (bare_langcode) else return "" end end
return p