"ഘടകം:Autotaxobox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

Content deleted Content added
(ചെ.) en:Module:Autotaxobox എന്നതിൽ നിന്ന് ഒരു പതിപ്പ് ഇറക്കുമതി ചെയ്തു
updated to tested sandbox version (handles italicization of taxon names better)
വരി 8:
]]
 
local TaxonItalics = require('Module:TaxonItalics') -- use a function from Module:TaxonItalics to italicize a taxon name
local p = {}
 
Line 267 ⟶ 268:
end
end
if linkTarget == '' then linkTarget = linkText end
if italic == 'yes' then linkText = TaxonItalics.italicizeTaxonName(linkText, false) end
local link = ''
if bold == 'yes' then link = '<b>' .. linkText .. '</b>'
else
if linkTarget == linkText or linkTarget == '' then link = linkText
else link = linkTarget .. '|' .. linkText
end
link = '[[' .. link .. ']]'
end
if italic == 'yes' and not string.find(link, "''", 1, true) then link = '<i>' .. link .. '</i>' end
if (extinct == 'yes' or extinct == 'true') and not string.find(link, '†', 1, true) then
link = '<span style="font-style:normal;font-weight:normal;">†</span>' .. link
Line 299 ⟶ 301:
end
return res .. '|}\n'
end
 
--[[============================== find =====================================
Returns the taxon above the specified taxon with a given rank.
Usage: {{#invoke:Autotaxobox|find|TAXON|RANK}}
=============================================================================]]
 
function p.find(frame)
local currTaxon = frame.args[1] or ''
if currTaxon == '' then return '<span class="error">no taxon supplied</span>' end
local rank = frame.args[2] or ''
if rank == '' then return '<span class="error">no rank supplied</span>' end
local inHierarchy = true -- still in the taxonomic hierarchy or off the top?
local searching = true -- still searching
while inHierarchy and searching do
local ok, parent = p.getTaxonInfoItem(frame, currTaxon, 'parent')
if ok and parent ~= '' then
currTaxon = parent
local ok, currRank = p.getTaxonInfoItem(frame, currTaxon, 'rank')
if currRank == rank then
searching = false
end
else
inHierarchy = false
end
end
if inHierarchy and not searching then return currTaxon
else return '<span class="error">rank not found</span>'
end
end
 
"https://ml.wikipedia.org/wiki/ഘടകം:Autotaxobox" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്