Módulo:Citar web
Fonte: EverybodyWiki Bios & Wiki
Este módulo está na categoria sujeitos a proteção de página. Ele é um módulo de alta visibilidade em uso por um grande número de páginas, ou é transcluído muito frequentemente. Por causa do vandalismo ou erros que podem afectar muitas páginas, e mesmo edições triviais podem causar cargas substanciais nos servidores, ele está protegido de editar. |
Este módulo é usado em mais de 440 000 páginas. (Ver Wikipedia:Predefinições em alto risco) Para evitar sobrecargas desnecessárias ao servidor e outros transtornos, quaisquer mudanças devem ser previamente testadas, seja na predefinição de testes ou em Módulo:Citar web/Testes (ou ainda em sua página de testes). Por favor, sempre considere expor eventuais mudanças na página de discussão, antes de implementá-las. |
Descrição[editar]
Este módulo destina-se a proporcionar funções básicas da predefinição {{Citar web}}
.
Outra documentação:
local w = require('Módulo:Citação/CS1')
--[[--------------------------< w . w e b >--------------------------------------
Este é o método principal da predefinição {{citar web}}.
]]
w.web= function(frame)
local config, args, A = tratarArgumentos(frame)
config.CitationClass = ''
config.ChapterNaoSuportado = true
local classe = 'web'
if not is_set(A.URL) then
table.insert(z.message_tail, { set_error('cite_web_url', {}, true)})
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
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(A.Section) then
Title = Title .. ' ' .. wrap_msg ('section', A.Section)
end
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
-- Função com o código abstraído
local B
A, B = citation0( config, args, A)
config.CitationClass = classe
B.config = config
return textoFinal(A, B)
end
return w