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

Ir para navegação Ir para pesquisar
sem sumário de edição
Sem resumo de edição
Sem resumo de edição
-- Somente realiza as análises se existir o campo 245
local f245 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "245", "0", "0", fullpagename = target } }) or
""
if f245 ~= "" then
-- Record status
local recordStatus =
frame:expandTemplate {
title = "Field data string",
args = { "000", "5", "1", property = "Leader", fullpagename = target }
} or false
if recordStatus == "n" then
a = "Segundo o Líder, este é um registro <b>novo</b> (não um alterado ou revisado, expandido, excluído, etc.)"
-- Type of record
local typeOfRecord =
frame:expandTemplate {
title = "Field data string",
args = { "000", "6", "1", property = "Leader", fullpagename = target }
} or false
if typeOfRecord == "a" then
a = "Segundo o Líder, este registro descreve um <b>material textual</b>"
-- Bibliographic level
local bibliographicLevel =
frame:expandTemplate {
title = "Field data string",
args = { "000", "7", "1", property = "Leader", fullpagename = target }
} or false
if bibliographicLevel == "m" then
a =
"Segundo o Líder, este registro descreve um <b>item monográfico</b> (não parte de um item, não um item seriado, não uma coleção, etc.)"
info = string.format("* %s.", a)
table.insert(infos, info)
-- Encoding level
local encodingLevel =
frame:expandTemplate {
title = "Field data string",
args = { "000", "17", "1", property = "Leader", fullpagename = target }
} or false
if encodingLevel == "1" then
a =
"Segundo o Líder, este registro tem um nível <b>completo</b> de catalogação (mas o material não foi examinado)"
info = string.format("* %s.", a)
table.insert(infos, info)
elseif encodingLevel == "#" then
a =
"Segundo o Líder, este registro tem um nível <b>completo</b> de catalogação (a descrição foi realizada com o material em mãos)"
info = string.format("* %s.", a)
table.insert(infos, info)
-- Descriptive cataloging form
local descriptiveCatalogingForm =
frame:expandTemplate {
title = "Field data string",
args = { "000", "18", "1", property = "Leader", fullpagename = target }
} or false
if descriptiveCatalogingForm == "a" then
a = "Segundo o Líder, este registro possui uma catalogação <b>compatível com as regras do AACR 2</b>"
-- Explica a sintaxe '(Biblioteca)NúmeroDeControle'
local f001 =
frame:expandTemplate {
title = "Field data string",
args = { "001", "0", "", property = "Control field data", fullpagename = target }
} or ""
local f003 =
frame:expandTemplate {
title = "Field data string",
args = { "003", "0", "", property = "Control field data", fullpagename = target }
} or ""
a = "Internamente, este registro é identificado pelo código"
b = "para sistemas externos, o código é"
-- Campo 005
local creationDate =
mw.smw.ask("[[" .. target .. "]]|?Creation date#-F[l, d \\d\\e F \\d\\e Y]|headers=hide|mainlabel=-") or ""
if type(creationDate) == "table" then
for _, row in pairs(creationDate) do
end
local modificationDate =
mw.smw.ask("[[" .. target .. "]]|?Modification date#-F[l, d \\d\\e F \\d\\e Y]|headers=hide|mainlabel=-") or ""
if type(modificationDate) == "table" then
for _, row in pairs(modificationDate) do
}
local f008pubPlace =
frame:expandTemplate {
title = "Field data string",
args = { "008", "15", "3", property = "Control field data", fullpagename = target } or ""
}
if string.match(f008pubPlace, "^[A-Z]") then
a = "O uso de maiúsculas não é permitido no campo 008, local de publicação"
}
local f008lang =
frame:expandTemplate {
title = "Field data string",
args = { "008", "35", "3", property = "Control field data", fullpagename = target }
} or ""
if string.match(f008lang, "^[A-Z]") then
a = "O uso de maiúsculas não é permitido no campo 008, idioma"
-- Se existe o campo 041, mostra '(traduzido do... )' na mesma linha do idioma presente no 008
local f041 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "041", "0", "0", fullpagename = target } }) or
""
if f041 ~= "" then
if f041:sub(1, 1) == "1" then
local f041h = frame:expandTemplate { title = "Select", args = { "041", "h", target } } or ""
f041h = langTbl[f041h] or f041h
info = string.format("%s (traduzido do %s).", info, f041h)
-- Testa se existe(m) ISBN(s) inválido(s)
local f020 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "020", "0", "0", fullpagename = target } }) or
""
if f020 ~= "" then
local printedIsbn = frame:expandTemplate { title = "Print ISBN" } or false""
if string.match(printedIsbn, "error") then
a = "ISBN inválido, por favor, reveja os números informados"
for _, data in pairs(row) do
if type(data) == "table" then
f020 = mw.text.trim(table.concat(data))
else
f020 = mw.text.trim(data)
end
end
table.insert(infos, info)
elseif string.match(f020, "%(") then
end a =
a = 'O campo de ISBN só pode conter números e "X" maiúsculo. Use o subcampo $q para outros dados (sem parênteses)'
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
table.insert(infos, info)
end
local f041a = frame:expandTemplate { title = "Select", args = { "041", "a", target } } or ""
if string.match(f041a, "^[A-Z]") then
a = "O uso de maiúsculas não é permitido nos códigos de idioma (campo 041)"
-- queryResult = mw.smw.ask( '[[' .. target .. '#100||' .. target .. '#110||' .. target .. '#111||' .. target .. '#130]]' )
local accessPointPresence =
frame:callParserFunction {
name = "#ask:[[" .. target .. "#100||" .. target .. "#110||" .. target .. "#111||" .. target .. "#130]]",
args = { "?Field data", format = "count", mainlabel = "-" }
} or 0
accessPointPresence = tonumber(accessPointPresence)
-- Testa se há subcampo $b e se há espaço no subcampo $c do campo 090
local f090 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "090", "0", "0", fullpagename = target } }) or
""
if f090 ~= "" then
local f090b = frame:expandTemplate { title = "Select", args = { "090", "b", target } } or ""
if f090b == "" then
a = "Está faltando o subcampo $b do campo 090 (notação de Cutter)"
table.insert(infos, info)
end
local f090c = frame:expandTemplate { title = "Select", args = { "090", "c", target } } or ""
if string.match(f090c, "%sed") then
a = "Nossa política de catalogação proíbe espaços na indicação de edição no número de chamada (090 $c)"
end
-- Testa (conta) se existe mais de um ponto de acesso principal
local f100existance = frame:expandTemplate { title = "Exist", args = { "100", target } } or ""
if accessPointPresence > 1 or f100existance == "multiple" then
a = "Foi registrado <b>mais de um ponto de acesso principal</b>. Isso não é permitido"
if f100existance ~= "" then
local f100 =
mw.text.trim(
frame:expandTemplate { title = "Field data string", args = { "100", "0", "0", fullpagename = target } }
) or ""
info = "O ponto de acesso principal foi dado a uma <b>pessoa</b>"
if f100:sub(1, 1) == "0" then
end
-- Testa se existe ', ' no subcampo $a (Nome, Sobrenome)
local f100a = frame:expandTemplate { title = "Select", args = { "100", "a", target } } or ""
if f100a ~= "" then
if not string.match(f100a, ".-,.") then
end
end
local f100q = frame:expandTemplate { title = "Select", args = { "100", "q", target } } or ""
if f100q ~= "" then
if not string.match(f100q, "^%(") then
end
end
local f100d = frame:expandTemplate { title = "Select", args = { "100", "d", target } } or ""
if f100d ~= "" then
if string.match(f100, "%$d %d%d%d%d$") then
-- Testa se existe um ponto de acesso principal 110
local f110 =
mw.text.trim(
frame:expandTemplate { title = "Field data string", args = { "110", "0", "0", fullpagename = target } } or ""
)
if f110 ~= "" then
info = "O ponto de acesso principal foi dado a uma <b>entidade coletiva</b>"
-- Testa se existe um ponto de acesso principal 111
local f111 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "111", "0", "0", fullpagename = target } }) or
""
if f111 ~= "" then
info = "O ponto de acesso principal foi dado a um <b>evento</b>"
-- Testa se existe um ponto de acesso principal 130
local f130 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "130", "0", "0", fullpagename = target } }) or
""
if f130 ~= "" then
info = "O ponto de acesso principal foi dado a um <b>título uniforme</b>"
table.insert(infos, info)
else
local f130a = frame:expandTemplate { title = "Select", args = { "130", "a", target } } or ""
a = ucfirst(f130a:sub(f130:sub(1, 1)))
info = string.format('* %s, ele será alfabetado como "<b>%s</b>".', info, a)
if f245ind1 == "1" then
a =
'Não houve um ponto de acesso principal nos campos 1XX, desse modo, o primeiro indicador do campo 245 deve ter o valor "0"'
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
if f245ind1 == "0" then
a =
'Houve um ponto de acesso principal nos campos 1XX, desse modo, o primeiro indicador do campo 245 deve ter o valor "1"'
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
-- Testa a relação entre a presença do campo 240 em relação a presença do campo 041 e a presença do subcampo $l
local f240 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "240", "0", "0", fullpagename = target } }) or
""
if f240 ~= "" then
if f041 == "" then
table.insert(infos, info)
end
local f240l = frame:expandTemplate { title = "Select", args = { "240", "l", target } } or ""
if f240l ~= "" then
if string.match(f240l, "^[a-zA-Z][a-zA-Z][a-zA-Z]$") then
else
local f240a =
string.gsub(mw.text.trim(frame:expandTemplate { title = "Select", args = { "240", "a", target } }), "[/:=.]$", "") or ""
"") or ""
a = "O título uniforme será alfabetado como"
b = ucfirst(f240a:sub(f240:sub(2, 2) + 1))
end
-- Testa se foi preenchido o segundo indicador do 245, se foi, mostra como será a alfabetação, removendo a pontuação final do subcampo $a ('/',':','='' ou '.')
local f245a = frame:expandTemplate { title = "Select", args = { "245", "a", target } } or ""
if f245:sub(2, 2) == "#" then
a = "Está faltando o segundo indicador do campo 245"
end
-- Testa se o subcampo $b começa com letras maiúsculas
local f245b = frame:expandTemplate { title = "Select", args = { "245", "b", target } } or ""
if f245b ~= "" then
if string.match(f245b, "[a-zA-Z][/:=]$") then
end
-- Testa se o subcampo $c está presente
local f245c = frame:expandTemplate { title = "Select", args = { "245", "c", target } } or ""
if f245c ~= "" then
-- Testa se existe espaço antes do ponto e vírgula na indicação de responsabilidade, subcampo $c do 245
if string.match(f245, ":%s?%$c") then
a =
'Ou o subtítulo foi colocado no subcampo $c, ou a pontuação que precede a indicação de responsabilidade (" / ") não foi informada corretamente (campo 245).'
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
-- Testa se existe espaço antes de "ed." (subcampo $a do 250)
local f250 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "250", "0", "0", fullpagename = target } }) or
""
if f250 ~= "" then
local f250a = frame:expandTemplate { title = "Select", args = { "250", "a", target } } or ""
if string.match(f250a, "%d%.?ed%.") then
a = 'Inclua um espaço antes da indicação "ed." (subcampo $a do campo 250)'
-- Testa se existe 260, se existir, verifica a pontuação final dos subcampos $a, $b e $c do campo 260
local f260 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "260", "0", "0", fullpagename = target } }) or
""
if f260 ~= "" then
local f260a = frame:expandTemplate { title = "Select", args = { "260", "a", target } } or ""
if f260a ~= "" then
if string.match(f260a, "[a-zA-ZÀ-ü%],]%s?$") then
table.insert(infos, info)
end
local f260b = frame:expandTemplate { title = "Select", args = { "260", "b", target } } or ""
if f260b ~= "" then
if string.match(f260b, "[a-zA-Z.]$") then
a =
'Normalmente, o final do subcampo $b do campo 260 requer uma das seguintes pontuações ", " ou " : ". Reveja a pontuação'
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
table.insert(infos, info)
end
local f260c = frame:expandTemplate { title = "Select", args = { "260", "c", target } } or ""
if f260c ~= "" then
-- Testa se o subcampo $c é precedido ou não por ","
-- Testa se existe espaço entre o número e a indicaçação de extensão do texto
local f300 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "300", "0", "0", fullpagename = target } }) or
""
if f300 ~= "" then
local f300a = frame:expandTemplate { title = "Select", args = { "300", "a", target } } or ""
if f300a ~= "" then
if string.match(f300a, "%d[a-z]%.") then
end
end
local f300b = frame:expandTemplate { title = "Select", args = { "300", "b", target } } or ""
if f300b ~= "" then
-- Testa se existe ".;" no subcampo $b do campo 300
if string.match(f300b, "il%.?, col") then
a = "'Ilustrações coloridas' (il. color.) é uma expressão só, remova a vírgula"
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
end
-- Testa se o subcampo $b contém "il. ; color" ou "il. ; p&b"
if string.match(f300b, "il%.; color") then
a = "'Ilustrações coloridas' (il. color.) é uma expressão só, remova o ponto e vírgula da expressão"
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
end
if string.match(f300b, "il. ; p&b") then
a = "'Ilustrações pretas e brancas' (il. p&b) é uma expressão só, remova o ponto e vírgula da expressão"
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
end
end
local f300c = frame:expandTemplate { title = "Select", args = { "300", "c", target } } or ""
end
local f300c = frame:expandTemplate {title = "Select", args = {"300", "c", target}} or ""
if f300c ~= "" then
-- Testa se a sintaxe das dimensões está correta
if string.match(f300c, "%d[a-z]") then
a =
'Atenção, a sintaxe correta para a dimensão é: "NN cm" ou, menos frequentemente, "NN x NN cm" (subcampo $c do campo 300)'
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
end
local f440 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "440", "0", "0", fullpagename = target } }) or
""
if f440 ~= "" then
a = "O campo 440 é obsoleto. Mova seu conteúdo para o campo 490"
-- Testa se existem indicadores, parênteses no subcampo $a do campo 490 e se existe ";" antes da numeração da série
local f490 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "490", "0", "0", fullpagename = target } }) or
""
if f490 ~= "" then
if f490:sub(2, 2) ~= "#" then
table.insert(infos, info)
end
local f490a = frame:expandTemplate { title = "Select", args = { "490", "a", target } } or ""
if f490a ~= "" then
if string.match(f490a, "^%(") then
end
end
local f490v = frame:expandTemplate { title = "Select", args = { "490", "v", target } } or ""
if f490v ~= "" then
if not string.match(f490, ";%s?%$v") then
-- Testa a consistência entre o indicador do 490 e a presença do campo 830
local f830 =
mw.text.trim(
frame:expandTemplate { title = "Field data string", args = { "830", "0", "0", fullpagename = target } }
) or ""
if f490:sub(1, 1) == "#" then
a = "Está faltando o primeiro indicador do campo 490"
if f830 == "" then
a =
"Foi especificado um ponto de acesso secundário para a série (490, primeiro indicador com valor 1), porém, um campo 830 não foi informado"
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
if f830 ~= "" then
a =
"O primeiro indicador do campo 490 indica que não foi gerado um ponto de acesso para a série, porém, um campo 830 foi informado"
info = string.format('* <strong class="error">%s.</strong>', a)
table.insert(infos, info)
-- Testa se a nota 500 acaba com "."
local f500 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "500", "0", "0", fullpagename = target } }) or
""
if f500 ~= "" then
if string.match(f500, "[a-zA-ZÀ-ü0-9:;-]$") then
-- Testa se a nota 504 acaba com "." e se existe uso de maiúsculas no meio da nota
local f504 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "504", "0", "0", fullpagename = target } }) or
""
if f504 ~= "" then
if string.match(f504, "[a-zA-ZÀ-ü0-9]$") then
end
local f600 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "600", "0", "0", fullpagename = target } }) or
""
-- Testa os indicadores dos campos 6XX
if f600 ~= "" then
end
-- Testa se existe "," no subcampo $a (Nome, Sobrenome)
local f600a = frame:expandTemplate { title = "Select", args = { "600", "a", target } } or ""
if f600a ~= "" then
if not string.match(f600a, ".*,.") then
end
end
local f600q = frame:expandTemplate { title = "Select", args = { "600", "q", target } } or ""
if f600q ~= "" then
if not string.match(f600q, "^%(") then
end
local f610 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "610", "0", "0", fullpagename = target } }) or
""
if f610 ~= "" then
if f610:sub(1, 1) == "#" then
end
local f611 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "611", "0", "0", fullpagename = target } }) or
""
if f611 ~= "" then
if f611:sub(1, 1) == "#" then
end
local f630 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "630", "0", "0", fullpagename = target } }) or
""
if f630 ~= "" then
if f630:sub(1, 1) == "#" then
end
local f650 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "650", "0", "0", fullpagename = target } }) or
""
if f650 ~= "" then
if f650:sub(1, 1) ~= "0" then
end
local f651 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "651", "0", "0", fullpagename = target } }) or
""
if f651 ~= "" then
if f651:sub(1, 1) ~= "#" then
-- Testa os pontos de acesso secundários, tal como os principais
local f700 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "700", "0", "0", fullpagename = target } }) or
""
if f700 ~= "" then
info = "Um ponto de acesso secundário foi dado a uma <b>pessoa</b>"
end
-- Testa se existe mais de um subcampo $a no mesmo campo 700
local exist700 = frame:expandTemplate { title = "Exist", args = { "700", target } } or false
if exist700 == "yes" then
if string.match(f700, "%$a.*%$a.-$") then
end
-- testa se existe "," no subcampo $a (Nome, Sobrenome)
local f700a = frame:expandTemplate { title = "Select", args = { "700", "a", target } } or ""
if f700a ~= "" then
if not string.match(f700a, ".-,.") then
end
end
local f700q = frame:expandTemplate { title = "Select", args = { "700", "q", target } } or ""
if f700q ~= "" then
if not string.match(f700q, "^%(") then
end
local f710 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "710", "0", "0", fullpagename = target } }) or
""
if f710 ~= "" then
info = "Um ponto de acesso secundário foi dado a uma <b>entidade coletiva</b>"
end
local f711 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "711", "0", "0", fullpagename = target } }) or
""
if f711 ~= "" then
info = "Um ponto de acesso secundário foi dado a um <b>evento</b>"
end
local f740 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "740", "0", "0", fullpagename = target } }) or
""
if f740 ~= "" then
if f740:sub(1, 1) == "#" then
-- Testa os indicadores do campo 830
local f830 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "830", "0", "0", fullpagename = target } }) or
""
if f830 ~= "" then
if f830:sub(1, 1) ~= "#" then
table.insert(infos, info)
end
local f830v = frame:expandTemplate { title = "Select", args = { "830", "v", target } } or ""
if f830v ~= "" then
if not string.match(f830, ";%s?%$v") then
end
local f856 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "856", "0", "0", fullpagename = target } }) or
""
if f856 ~= "" then
if f856:sub(1, 1) ~= "4" then
table.insert(infos, info)
end
local f856a = frame:expandTemplate { title = "Select", args = { "856", "a", target } } or ""
if f856a ~= "" then
a = "Normalmente, o subcampo utilizado no 856 é o $u, não o $a"
-- Testa por inteiro o registro de modo a acusar: "," ou o "." precedido de espaço; designadores de subcampos errados
local isoRecord =
frame:callParserFunction {
name = "#ask:[[-Has subobject::" .. target .. "]][[Field data::+]]",
args = {
"?Field data",
format = "plainlist",
link = "none",
headers = "hide",
mainlabel = "-",
outro = "",
sep = "",
valuesep = "",
propsep = ""
}
} or ""
if string.match(isoRecord, "%s[.,][^.]") then
a = "Pontos finais ou vírgulas nunca devem ser precedidos por um espaço"

Menu de navegação