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

Content deleted Content added
(ചെ.) Peter coxhead moved page Module:Sandbox/Peter coxhead/TaxonItalics to Module:TaxonItalics without leaving a redirect: ready to be deployed
add code to link
വരി 51:
function p.italicizeTaxonName(frame)
local name = frame.args[1] or ''
local linked = frame.args['linked'] == 'yes'
local italMarker = "''"
-- trim the name and replace any use of the HTML italic tags by Wikimedia markup
Line 61 ⟶ 62:
name = string.gsub(name, "''", "") -- first remove internal italics
local words = mw.text.split(name, " ", true)
local deitalicized = false
if #words == 4 then
-- test for the third word of a four word name being a connecting term
Line 66 ⟶ 68:
-- de-italicize the connecting term by adding internal italic markup
result = words[1] .. " " .. words[2] .. italMarker .. " " .. cTerms3[words[3]] .. italMarker .. " " .. words[4]
deitalicized = true
end
elseif #words == 3 then
Line 72 ⟶ 75:
-- de-italicize the connecting term by adding internal italic markup
result = words[1] .. " " .. italMarker .. cTerms2[words[2]] .. italMarker .. " " .. words[3]
deitalicized = true
end
else
Line 78 ⟶ 82:
end
-- add outside markup
if linked then
result = italMarker .. result .. italMarker
if deitalicized then
result = "[[" .. name .. "|" .. italMarker .. result .. italMarker .. "]]"
else
result = italMarker .. "[[" .. name .. "]]" .. italMarker
end
else
result = italMarker .. result .. italMarker
end
end
end
"https://ml.wikipedia.org/wiki/ഘടകം:TaxonItalics" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്