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

Ir para navegação Ir para pesquisar
fixing lua-language-server complains
imported>Jaideraf
Sem resumo de edição
(fixing lua-language-server complains)
 
-- 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.)"
-- Encoding level
local encodingLevel =
frame:expandTemplate {
title = "Field data string",
args = { "000", "17", "1", property = "Leader", fullpagename = target }
} or false
if encodingLevel == "n" then
a = "Segundo o Líder, este registro de autoridade está <b>completo</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 accessPointPresence =
frame:callParserFunction {
name = "#ask:[[" ..
target ..
"#100||" ..
target .. "#110||" .. target .. "#111||" .. target .. "#130||" .. target .. "#150||" .. target .. "#151]]",
args = { "?Field data", format = "count", mainlabel = "-" }
} or 0
accessPointPresence = tonumber(accessPointPresence) or 0
 
-- 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"
end
local f100 =
mw.text.trim(
frame:expandTemplate { title = "Field data string", args = { "100", "0", "0", fullpagename = target } } or ""
)
if f100 ~= "" then
info = "A autoridade é do tipo <b>pessoa</b>"
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 = "A autoridade é do tipo <b>entidade coletiva</b>"
table.insert(infos, info)
end
local f110b = frame:expandTemplate { title = "Select", args = { "110", "b", target } } or ""
if f110b ~= "" then
if not string.match(f110, ".%s?%$b") then
-- 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 = "A autoridade é do tipo <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 = "A autoridade é do tipo <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(tonumber(f130:sub(2, 2)) or 0))
info = string.format('* %s, ele será alfabetado como "<b>%s</b>".', info, a)
table.insert(infos, info)
end
local f150 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "150", "0", "0", fullpagename = target } }) or
""
if f150 ~= "" then
if f150:sub(1, 1) ~= "#" then
end
local f400 =
mw.text.trim(
frame:expandTemplate { title = "Field data string", args = { "400", "0", "0", fullpagename = target } } or ""
)
if f400 ~= "" then
info = "A remissiva Ver é do tipo <b>pessoa</b>"
end
-- Testa se existe ', ' no subcampo $a (Nome, Sobrenome)
local f400a = frame:expandTemplate { title = "Select", args = { "400", "a", target } } or ""
if f400a ~= "" then
if not string.match(f400a, ".-,.") then
end
end
local f400q = frame:expandTemplate { title = "Select", args = { "400", "q", target } } or ""
if f400q ~= "" then
if not string.match(f400q, "^%(") then
end
end
local f400d = frame:expandTemplate { title = "Select", args = { "400", "d", target } } or ""
if f400d ~= "" then
if string.match(f400, "%$d %d%d%d%d$") then
-- Testa se existe um ponto de acesso principal 110
local f410 =
mw.text.trim(
frame:expandTemplate { title = "Field data string", args = { "410", "0", "0", fullpagename = target } } or ""
)
if f410 ~= "" then
info = "A remissiva Ver é do tipo <b>entidade coletiva</b>"
table.insert(infos, info)
end
local f410b = frame:expandTemplate { title = "Select", args = { "410", "b", target } } or ""
if f410b ~= "" then
if not string.match(f410, ".%s?%$b") then
-- Testa se existe um ponto de acesso principal 111
local f411 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "411", "0", "0", fullpagename = target } }) or
""
if f411 ~= "" then
info = "A remissiva Ver é do tipo <b>evento</b>"
-- Testa se existe um ponto de acesso principal 130
local f430 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "430", "0", "0", fullpagename = target } }) or
""
if f430 ~= "" then
info = "A remissiva Ver é do tipo <b>título uniforme</b>"
table.insert(infos, info)
else
local f430a = frame:expandTemplate { title = "Select", args = { "430", "a", target } } or ""
a = ucfirst(f430a:sub(tonumber(f430:sub(2, 2)) or 0))
info = string.format('* %s, ele será alfabetado como "<b>%s</b>".', info, a)
table.insert(infos, info)
end
local f450 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "450", "0", "0", fullpagename = target } }) or
""
if f450 ~= "" then
if f450:sub(1, 1) ~= "#" or f450:sub(2, 2) ~= "#" then
end
local f643 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "643", "0", "0", fullpagename = target } }) or
""
if f643 ~= "" then
if f643:sub(1, 1) ~= "#" or f643:sub(2, 2) ~= "#" then
end
local f670 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "670", "0", "0", fullpagename = target } }) or
""
if f670 ~= "" then
if f670:sub(1, 1) ~= "#" or f670:sub(2, 2) ~= "#" then
end
local f675 =
mw.text.trim(frame:expandTemplate { title = "Field data string", args = { "675", "0", "0", fullpagename = target } }) or
""
if f675 ~= "" then
if f675:sub(1, 1) ~= "#" or f675:sub(2, 2) ~= "#" 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
-- 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