"ഘടകം:TaxonItalics" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
Content deleted Content added
updated to tested sandbox version |
updated to tested sandbox version |
||
വരി 14:
The module also:
* Ensures that the hybrid symbol, ×, is not italicized
* Has an option to abbreviate parts of taxon names other than the last
to the first letter (e.g. "Pinus sylvestris var. sylvestris" becomes
"P. s. var. sylvestris").
വരി 23:
local cTerms3 = {
--subsp.
subspecies = "subsp.",
["subsp."] = "subsp.",
Line 28 ⟶ 29:
["ssp."] = "subsp.",
ssp = "subsp.",
--var.
varietas = "var.",
["var."] = "var.",
var = "var.",
--subvar.
subvarietas = "subvar.",
["subvar."] = "subvar.",
subvar = "subvar.",
forma = "f.",
["f."] = "f.",
f = "f.",
--subf.
subforma = "subf.",
["subf."] = "subf.",
Line 42 ⟶ 47:
}
local cTerms2 = {
--subg.
subgenus = "subg.",
["subg."] = "subg.",
subg = "subg.",
--sect.
section = "sect.",
["sect."] = "sect.",
--subsect.
subsection = "subsect.",
["subsect."] = "subsect.",▼
subsect = "subsect.",
--ser.
▲ ["subsect."] = "subsect.",
series = "ser.",
▲ ser = "ser.",
["ser."] = "ser.",
--subser.
subseries = "subser.",
▲ subser = "subser.",
["subser."] = "subser.",
--cf.
cf = "cf.",
["cf."] = "cf.",
["c.f."] = "cf."
}
Line 72 ⟶ 84:
--[[=========================================================================
Utility function to abbreviate
followed by ".".
Both "×" and an HTML entity at the start of the string are skipped over in
determining first character.
=============================================================================]]
function p.abbreviate(str)
local result = ""
if mw.ustring.len(str)
--single character strings are left unchanged
--deal with the hybrid symbol that could be present at the start of the string▼
result = str▼
else
if mw.ustring.sub(str,1,1) == "×" then
result = "×"
str = mw.ustring.sub(str,2,
end
--
if mw.ustring.sub(str,1,1) == "&" then
local i,dummy = mw.ustring.find(str,";",2,plain)
result = result .. mw.ustring.sub(str,1,i)
--if there's anything left, reduce it to its first character plus "."
if str ~= "" then
result = result .. mw.ustring.sub(str,1,1) .. "."
end
▲ else
▲ result = str
end
return result
Line 109 ⟶ 125:
name = string.gsub(mw.text.trim(name), "</?i>", italMarker)
name = string.gsub(string.gsub(name, "×", "×"), "×", "×")
name = string.gsub(name, "</?span.->", "") -- remove any span markup
name = string.gsub(name, "× ", "× ")
-- now italicize and abbreviate if required
|