Módulo:ABNT: mudanças entre as edições

Conteúdo deletado Conteúdo adicionado
Sem resumo de edição
Sem resumo de edição
 
(24 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 2:
 
function p.CreateReference( frame )
-- Define o alvo da referência: pode ser o primeiro parâmetro passado à predefinição,
-- predefinição; o valor da query string "fullpagename" (via UrlGetParameters) ou o título da página.
-- (via UrlGetParameters); o parâmetro nomeado Page (via WSSearchFront);
local target = frame:getParent().args[1]
-- ou o título da página.
local target = frame:getParent().args[1]
if target == '' or target == nil then
target = mw.uri.decode( frame:callParserFunction( '#urlget', 'fullpagename' ) )
end
if target == '' or target == nil then
target = frame:getParent().args.Page
end
if target == '' or target == nil then
target = mw.title.getCurrentTitle().prefixedText
end
local reference
-- Alvo definido
-- Definir se há criador(es) para o início da referência
local creator = frame:callParserFunction{ name = '#show', args = { target, '?Has creator#', link = 'none', valuesep = '; '} }
-- Definir se há editores(es)colaboradores para o início da referência
local editorcontributor = frame:callParserFunction{ name = '#show', args = { target, '?Has editorcontributor#', link = 'none', valuesep = '; '} }
-- Definir o título e o subtítulo
local title = frame:callParserFunction{ name = '#show', args = { target, '?Display title of#', link = 'none' } }
title = string.gsub( title, '(:.*)', '<span style="font-weight: normal;">%1</span>')
-- Condição: entrada pelopelos autor OU pelo editoragentes OU pelo título
iflocal #creator >agents= 1 then{}
if #creator >= 1 or #contributor >= 1 then
creator = string.gsub( creator, '(,%s.*|%s%(.*)', '')
if creator ~= '' then
creator = frame:callParserFunction{ name = '#regex', args = { creator, '/(^.*?,)|(;.*?,)/', '<span style="text-transform: uppercase;">$1$2</span>' } }
reference =table.insert(agents, creator) ..-- '.como <b>'criador ..vem titledo ..campo '</b>.1XX, não há mais de um 'valor
end
elseif #editor >= 1 then
editor = frame:callParserFunction{ name = '#regex', args = { editor, '/(^.*?,)|(;.*?,)/', '<span style="text-transform: uppercase;">$1$2</span>' } }
reference = editor .. ' (Org.). <b>' .. title .. '</b>. '
else
reference = string.gsub( title, '^(.-%s)', '<span style="text-transform: uppercase;">%1</span>') .. '. '
 
for v in string.gmatch(contributor, "([^;]+)") do -- como colaborador vem do campo 7XX, pode haver mais de um valor
table.insert(agents, v)
else end
 
for k, v in pairs(agents) do
if string.match( v, '^(.*,.*),') then
-- 'Assis, Machado de, 1839-1908' > 'Assis, Machado de'
agents[k] = string.match( v, '^(.*,.*),')
end
end
 
for k, v in pairs(agents) do
creator =if string.gsubmatch( creatorv, '^(,%s.*|)%s%(.*')', '')then
-- 'Tolkien, J. R. R. (John Ronald Reuel), 1892-1973' > 'Tolkien, J. R. R.'
agents[k] = string.match( v, '^(.*)%s%(')
end
end
 
local agentStr = table.concat(agents, "; ")
creatoragentStr = frame:callParserFunction{ name = '#regexrreplace', args = { creatoragentStr, '/(^.*?,)|(;.*?,)/', '<span style="text-transform: uppercase;">$1$2</span>' } }
reference = editoragentStr .. ' (Org.). <b>' .. title .. '</b>. '
 
else
-- Entrada pelo título
editorreference = frame:callParserFunction{string.gsub( name = '#regex', args = { editortitle, '/(^.*?,)|(;.*?,-%s)/', '<span style="text-transform: uppercase;">$%1$2</span>'. } }')
end
-- Entrada e título definidos
Linha 80 ⟶ 104:
-- Verificar se há ISBN
local isbn = frame:callParserFunction{ name = '#show', args = { target, '?Has ISBN#', link = 'none' } }
isbn = string.match( isbn, '^%d+') or ''
 
if #isbn >= 1 then
isbn = frame:callParserFunction{ name = '#invoke:ConverterHyphenate', args = { 'ISBN', isbn, 'Sim' } }
reference = reference .. ' ISBN ' .. isbn .. '. '
end