Modulo:Primopiano

Da Wikinotizie, le notizie a contenuto aperto

La documentazione per questo modulo può essere creata in Modulo:Primopiano/man

local p = {}

function p.incipit(frame)
    local txt = frame:getParent().args['testo']
    if txt~=nil and mw.text.trim(txt)~='' then
        return txt
    end
    local title = frame:getParent().args['link-titolo']
    if title~=nil then
        title = mw.title.new(title)
        if title~=nil then
            txt = title:getContent()
            txt = string.match(txt,'\n([^%[%]%{%}%|%<%>\n][^\n]+)\n')
            txt = string.gsub(txt,'%[%[.-%|(.-)%]%]','%1')
            txt = string.gsub(txt,'%[%[(.-)%]%]','%1')
            return txt
        end
    end
    return ''
end

return p