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

De Wikincat
Ir para navegação Ir para pesquisar
imported>Jaideraf
(Criou página com 'local p = {} function p.BibRules( frame ) -- Define o alvo -- local target = frame:getParent().args[1] -- if target == '' or target == nil then -- target...')
 
imported>Jaideraf
Sem resumo de edição
Linha 10: Linha 10:
-- target = mw.title.getCurrentTitle().prefixedText
-- target = mw.title.getCurrentTitle().prefixedText
-- end
-- end
local test
local test, info
local info = ''
local infos = {}
if frame:expandTemplate{ title = 'Exist', args = { '245' } } ~= '' then
if frame:expandTemplate{ title = 'Exist', args = { '245' } } ~= '' then
-- Record status

test = frame:expandTemplate{ title = 'Field data string', args = { '000', '5', '1', property = 'Leader' } } or false
test = frame:expandTemplate{ title = 'Field data string', args = { '000', '5', '1', property = 'Leader' } } or false

if test == 'n' then
if test == 'n' then
info = "* Segundo o Líder, este é um registro '''novo''' (não um alterado ou revisado, expandido, excluído, etc.)."
info = "* Segundo o Líder, este é um registro '''novo''' (não um alterado ou revisado, expandido, excluído, etc.)."
table.insert(infos, info)
elseif test == 'c' then
elseif test == 'c' then
info = "* Segundo o Líder, este é um registro '''alterado ou revisado''' (não um novo, expandido, excluído, etc.)."
info = "* Segundo o Líder, este é um registro '''alterado ou revisado''' (não um novo, expandido, excluído, etc.)."
table.insert(infos, info)
elseif test == 'a' or test == 'd' or test == 'p' then
elseif test == 'a' or test == 'd' or test == 'p' then
info = "* Segundo o Líder, este é um registro '''expandido''' ou '''excluído''' (não novo)."
info = "* Segundo o Líder, este é um registro '''expandido''' ou '''excluído''' (não novo)."
table.insert(infos, info)
end
end
-- Type of record
test = frame:expandTemplate{ title = 'Field data string', args = { '000', '6', '1', property = 'Leader' } } or false
if test == 'a' then
info = "* Segundo o Líder, este registro descreve um '''material textual'''."
table.insert(infos, info)
end
-- Bibliographic level
test = frame:expandTemplate{ title = 'Field data string', args = { '000', '7', '1', property = 'Leader' } } or false
if test == 'm' then
info = "* Segundo o Líder, este registro descreve um '''item monográfico''' (não parte de um item, não um item seriado, não uma coleção, etc.)."
table.insert(infos, info)
end
-- Encoding level
test = frame:expandTemplate{ title = 'Field data string', args = { '000', '17', '1', property = 'Leader' } } or false
if test == '1' then
info = "* Segundo o Líder, este registro tem um nível '''completo''' de catalogação (mas o material não foi examinado)."
table.insert(infos, info)
else
info = "* Segundo o Líder, este registro tem um nível '''completo''' de catalogação (a descrição foi realizada com o material em mãos)."
table.insert(infos, info)
end


end
end
return info
return table.concat( infos, '\n\n' )


end
end

Edição das 17h31min de 25 de julho de 2021

A documentação para este módulo pode ser criada em Módulo:BibRules/doc

local p = {}

function p.BibRules( frame )
    -- Define o alvo
    -- 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 = mw.title.getCurrentTitle().prefixedText
    -- end
    local test, info
    local infos = {}
    if frame:expandTemplate{ title = 'Exist', args = { '245' } } ~= '' then
      -- Record status
      test = frame:expandTemplate{ title = 'Field data string', args = { '000', '5', '1', property = 'Leader' } } or false
      if test == 'n' then
        info = "* Segundo o Líder, este é um registro '''novo''' (não um alterado ou revisado, expandido, excluído, etc.)."
        table.insert(infos, info)
      elseif test == 'c' then
        info = "* Segundo o Líder, este é um registro '''alterado ou revisado''' (não um novo, expandido, excluído, etc.)."
        table.insert(infos, info)
      elseif test == 'a' or test == 'd' or test == 'p' then
        info = "* Segundo o Líder, este é um registro '''expandido''' ou '''excluído''' (não novo)."
        table.insert(infos, info)
      end
      -- Type of record
      test = frame:expandTemplate{ title = 'Field data string', args = { '000', '6', '1', property = 'Leader' } } or false
      if test == 'a' then
        info = "* Segundo o Líder, este registro descreve um '''material textual'''."
        table.insert(infos, info)
      end
      -- Bibliographic level
      test = frame:expandTemplate{ title = 'Field data string', args = { '000', '7', '1', property = 'Leader' } } or false
      if test == 'm' then
        info = "* Segundo o Líder, este registro descreve um '''item monográfico''' (não parte de um item, não um item seriado, não uma coleção, etc.)."
        table.insert(infos, info)
      end
      -- Encoding level
      test = frame:expandTemplate{ title = 'Field data string', args = { '000', '17', '1', property = 'Leader' } } or false
      if test == '1' then
        info = "* Segundo o Líder, este registro tem um nível '''completo''' de catalogação (mas o material não foi examinado)."
        table.insert(infos, info)
      else
        info = "* Segundo o Líder, este registro tem um nível '''completo''' de catalogação (a descrição foi realizada com o material em mãos)."
        table.insert(infos, info)
      end


    end
    return table.concat( infos, '\n\n' )

end

return p