Module:Sandbox/Erutuon/Glossing abbreviations: Difference between revisions

Content deleted Content added
add a few for Arabic
m Primefac moved page Module:Sandbox/Uanfala/Glossing abbreviations to Module:Sandbox/Erutuon/Glossing abbreviations without leaving a redirect: per reasonable comment on talk page
 
(3 intermediate revisions by 2 users not shown)
Line 18:
["def"] = "definite",
["ndef"] = "indefinite",
["sg"] = "singular number",
["du"] = "dual number",
["pl"] = "plural number",
}
 
Line 34 ⟶ 37:
local args = frame:getParent().args[1] and frame:getParent().args or frame.args
local abbreviation = args[1] or error("Provide an abbreviation in parameter 1")
local key = string.gsub(abbreviation, "%.$", "")
key = string.lower(key)
local expanded = data[key] or error("The abbreviation "..(abbreviation or "nil").." is not recognized")
return '<abbr title="'..expanded..'">'..abbreviation..'</abbr>'
local _, count = mw.ustring.gsub(abbreviation, "%u", "")
if count > #abbreviation * 3/4 then
return '<abbr class="smallcaps" style="font-variant: small-caps; text-transform: lowercase;" title="'..expanded..'">'..abbreviation..'</abbr>'
else
return '<abbr title="'..expanded..'">'..abbreviation..'</abbr>'
end
end