"ഘടകം: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 part of the name
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.",
else--f.
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.",
sersect = "sersect.",
--subsect.
subsection = "subsect.",
["subsect."] = "subsect.",
subsect = "subsect.",
--ser.
["subsect."] = "subsect.",
series = "ser.",
ser = "ser.",
["ser."] = "ser.",
subserser = "subserser.",
--subser.
subseries = "subser.",
subser = "subser.",
["subser."] = "subser.",
["cf."]subser = "cfsubser.",
--cf.
cf = "cf.",
["cf."] = "cf.",
["c.f."] = "cf."
}
Line 72 ⟶ 84:
 
--[[=========================================================================
Utility function to abbreviate taxonan namesinput otherstring thanto theits lastfirst part of thecharacter
followed by ".".
name to the first letter.
Both "×" and an HTML entity at the start of the string are skipped over in
It is assumed that "×" will not occur as an input by itself. Both "×" and any
determining first character.
HTML entity are ignored.
=============================================================================]]
function p.abbreviate(str)
local result = ""
if mw.ustring.len(str) >< 12 then
--single character strings are left unchanged
--deal with the hybrid symbol that could be present at the start of the string
result = str
else
--dealskip withover thea hybrid symbol that could be present at the start of the string
if mw.ustring.sub(str,1,1) == "×" then
result = "×"
str = mw.ustring.sub(str,2,#mw.ustring.len(str))
end;
--dealskip withover thean HTML entity that could be present at the start of the string
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)
.. str = mw.ustring.sub(str,i+1,i+1) mw.ustring. "."len(str))
elseend
--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, "&#215;", "×"), "&times;", "×")
name = string.gsub(name, "</?span.->", "") -- remove any span markup
name = string.gsub(name, "× ", "×&#32;")
-- now italicize and abbreviate if required
"https://ml.wikipedia.org/wiki/ഘടകം:TaxonItalics" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്