模組:Taxobox

维基百科,自由的百科全书
文档图示 模块文档[创建]
local p = {}

function italicize(arg)
    return '\'\'' .. arg .. '\'\''
end

function strip(arg)
    return (arg:gsub('[\'%s]*(.-)[\'%s]*$', '%1'))
end

function p.species(frame)
    local species = frame.args[1]
    local species_zh = frame.args[2]
    if species_zh == '' then
        return italicize(strip(species))
    else
        return strip(species_zh) .. ' ' .. italicize(strip(species))
    end
end

return p