Module:TaxonItalics and Module:TaxonItalics/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
updated to tested sandbox version; adds "dab" parameter |
Simplifications |
||
Line 154: | Line 154: | ||
name = mw.text.trim(name) |
name = mw.text.trim(name) |
||
-- if the name begins with '[', then assume formatting is present |
-- if the name begins with '[', then assume formatting is present |
||
if |
if mw.ustring.sub(name,1,1) == '[' then return name end |
||
-- otherwise begin by replacing any use of the HTML italic tags |
-- otherwise begin by replacing any use of the HTML italic tags |
||
-- by Wikimedia markup; replace any entity alternatives to the hybrid symbol |
-- by Wikimedia markup; replace any entity alternatives to the hybrid symbol |
||
Line 189: | Line 189: | ||
end |
end |
||
result = words[1] .. " " .. words[2] .. " " .. words[3] |
result = words[1] .. " " .. words[2] .. " " .. words[3] |
||
elseif abbreviated then -- not a name as above; only deal with abbreviation |
|||
⚫ | |||
if #words > 1 then |
|||
result = l.abbreviate(words[1]) |
|||
for i = 2, #words-1, 1 do |
|||
result = l.abbreviate(words[ |
result = result .. " " .. l.abbreviate(words[i]) |
||
⚫ | |||
result = result .. " " .. l.abbreviate(words[i]) |
|||
end |
|||
result = result .. " " .. words[#words] |
|||
end |
end |
||
result = result .. " " .. words[#words] |
|||
result = name |
|||
end |
end |
||
⚫ | |||
⚫ | |||
end |
end |
||
-- deal with any hybrid symbol as it should not be italicized |
-- deal with any hybrid symbol as it should not be italicized |
||
Line 238: | Line 235: | ||
function p.hasConnectingTerm(name) |
function p.hasConnectingTerm(name) |
||
local words = mw.text.split(name, " ", true) |
local words = mw.text.split(name, " ", true) |
||
return (#words == 4 and cTerms3[words[3]]) |
|||
or (#words == 3 and cTerms2[words[2]]) |
|||
else return false |
|||
end |
|||
end |
end |
||