"ഘടകം:TaxonItalics" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
Content deleted Content added
No edit summary |
No edit summary |
||
വരി 1:
--[[=========================================================================
Italicize a taxon name appropriately by invoking italicizeTaxonName.
The
* If the name has italic markup at the start or the end, do nothing.
* Else
* Else if the name is made up of four words and the third word is a▼
de-italicize the connecting term.▼
▲ de-italicize the connecting term.
▲ botanical connecting term or a variant of "cf.", add italic markup to the
botanical connecting term or a variant of "cf.", add italic markup to the
* Else do nothing.▼
outside of the name and de-italicize the connecting term.
=============================================================================]]
Line 51 ⟶ 53:
-- trim the name and replace any use of the HTML italic tags by Wikimedia markup
name = string.gsub(string.gsub(mw.text.trim(name), "<i>", "''"), "</i>", "''")
local result = name▼
local italMarker = "''"
▲ local result = name
if name ~= '' then
if string.sub(name, 1, 2) == "''" or string.sub(name, -2) == "''" then
Line 60 ⟶ 62:
local words = mw.text.split(name, " ", true)
if #words == 4 then
result = italMarker .. name .. italMarker▼
▲ -- test for the third word of a four word name being a connecting term
▲ if cTerms3[words[3]] then
▲ -- de-italicize the connecting term by adding internal italic markup
▲ result = italMarker .. words[1] .. " " .. words[2] .. italMarker .. " " .. cTerms3[words[3]] .. " " .. italMarker .. words[4] .. italMarker
-- third word is not a connecting term, so add outside italic markup▼
result = italMarker .. name .. italMarker▼
end
elseif #words == 3 then
▲
▲ -- test for the second word of a three word name being a connecting term
▲ if cTerms2[words[2]] then
end
else
▲ -- add outside italic markup to names not made up of four words
result =
end
-- add outside markup
end
end
|