Saltar para o conteúdo

Módulo:Citar grupo de notícias

Permanently protected module
Origem: Wikipédia, a enciclopédia livre.
Documentação do módulo[ver] [editar] [histórico] [purgar]

Descrição

Este módulo destina-se a proporcionar funções básicas da predefinição {{Citar grupo de notícias}}.


Outra documentação:

local g = require('Módulo:Citação/CS1')

--[[--------------------------< g . g d n o t i c i a s >-----------------------------------------

Este é o método principal da predefinição {{citar grupo de notícias}}.

]]

g.gdnoticias = function(frame)
    local config, args, A = tratarArgumentos(frame)
    config.CitationClass = ''
    config.naoUsaPage = true
    config.ChapterNaoSuportado = true

    local coins_publisher = is_parameter_ext_wikilink(A.PublisherName) and A.PublisherName:match("%[[^%s]*%s*(.*)%]") or A.PublisherName
    -- tratamento especial a cite newsgroup. Feito após COinS porque modifica Publishername
    if is_set (A.PublisherName) then
        A.PublisherName = substitute (cfg.messages['newsgroup'], external_link( 'news:'
            .. A.PublisherName, A.PublisherName, A:ORIGIN('PublisherName'), nil ))
    end

    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

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

    B.coins_table.PublisherName = coins_publisher

    config.CitationClass = 'newsgroup'
    B.config = config

    return textoFinal(A, B)
end

return g