Module:Titre en italique

De Les Mots de l'agronomie

La documentation pour ce module peut être créée à Module:Titre en italique/doc

local p = {}

function p.newPagename(frame)
    local pagename = mw.title.getCurrentTitle().text

    local args = frame.args
    local lang
    if args[1] ~= '' then
        lang = args[1]
    end

    local position = pagename:find(' %(')

    local base
    local disambig
    if position then
        base = pagename:sub(1, position - 1)
        disambig = pagename:sub(position)
    else
        base = pagename
        disambig = ''
    end

    if lang then
        base = '<span lang="' .. lang .. '">' .. base .. '</span>'
    end

    return "''" .. base .. "''" .. disambig
end

return p