Módulo:Citar comunicado de imprensa

Origem: Wikipédia, a enciclopédia livre.
local c = require('Módulo:Citação/CS1')


--[[--------------------------< c . i m p r e n s a >------------------------------------------------------

Este é o método principal da predefinição {{citar comunicado de imprensa}}.

]]

c.imprensa = function(frame)
    local config, args, A = tratarArgumentos(frame)
    config.CitationClass = ''
    local classe = 'pressrelease'

    A.TitleType = set_titletype (classe, A.TitleType)

    config.ChapterNaoSuportado = true
    local chap_param
    -- pega o nome do parâmetro de um destes peta-parâmetros relacionados a "chapter"
    if is_set (A.Chapter) then
        chap_param = A:ORIGIN ('Chapter')
    elseif is_set (A.TransChapter) then
        chap_param = A:ORIGIN ('TransChapter')
    elseif is_set (A.ChapterURL) then
        chap_param = A:ORIGIN ('ChapterURL')
    elseif is_set (A.ScriptChapter) then
        chap_param = A:ORIGIN ('ScriptChapter')
    else is_set (A.ChapterFormat)
        chap_param = A:ORIGIN ('ChapterFormat')
    end

     -- se foi encontrado algum...
    if is_set (chap_param) then
        -- ... adiciona mensagem de erro
        table.insert( z.message_tail, { set_error( 'chapter_ignored', {chap_param}, true ) } )
        -- e esvazia para evitar problemas com concatenações
        A.Chapter = ''
        A.TransChapter = '';
        A.ChapterURL = '';
        A.ScriptChapter = '';
        A.ChapterFormat = '';
    end

    do
        local TransTitle = A.TransTitle
        local Title = A.Title
        if is_set(A.TitleLink) and is_set(A.Title) then
            Title = "[[" .. A.TitleLink .. "|" .. Title .. "]]"
        end
        config.TituloFormatado = {}
        if (is_set(Title)) then
            Title = kern_quotes (Title)
            Title = wrap_style ('quoted-title', Title)
            config.TituloFormatado.Title = Title
        end
        if (is_set(TransTitle)) then
            TransTitle= wrap_style ('trans-quoted-title', TransTitle ) -- .. ", "
            config.TituloFormatado.TransTitle = TransTitle
        end
    end

    local B
    -- Função com o código abstraído
    A, B = citation0(config, args, A)

    config.CitationClass = classe
    B.config = config

    return textoFinal(A, B)
end

return c