Módulo:MARCimporter: mudanças entre as edições
Conteúdo deletado Conteúdo adicionado
m formatter |
fix formOfItem |
||
| (3 revisões intermediárias pelo mesmo usuário não estão sendo mostradas) | |||
Linha 11:
local leader = ''
local baseAddressOfData = 0
local directory =
local dataValuesGroup = ''
-- inicializa as variáveis auxiliares
local directoryEntry =
local entryTag =
local entryDataLength =
local entryInitPosition =
local dataField = {} -- Cada tabela que contém os dados dos campos. Formato:
-- { tag='', length='', initPosition='', data='', ind1='', ind2='' }
local dataFields = {} -- Tabela que contém cada tabela dataField. Formato:
Linha 36:
local function normalizeData(data)
data = data
:gsub('|(.)', ' $%1 ') -- substitui "|a" por " $a "
:gsub('(%d)p%.', '%1 p.') -- // "1p." por "1 p."
:gsub('(%d)cm', '%1 cm') -- // "1cm" por "1 cm"
:gsub('(%d)ed%.', '%1 ed.') -- // "1ed." por "1 ed."
:gsub('%.%s?%-$', '.') -- // ". -" por "."
:gsub('(%$.*)(%$w.*)', '%2 %1') -- move o subcampo $w para a frente
:gsub('(%s%$9%s.*)', '') -- remove o subcampo $9
:gsub('(%$z.*)(%$u.*)', '%2 %1') -- move o subcampo $u para a frente
:gsub('[\n\r]', '') -- remove line feed e carriage return
return data
end
Linha 69:
--> 00277
-- obtém o diretório (-1 para não pegar RS)
directory = record:sub(25, baseAddressOfData - 1) or
--> 0010010000000050017000100080041000270200027000680400017000950...
-- obtém os dados dos campos em um único grupo
Linha 120:
-- == MARC tags handler == --
record = record
:gsub(' ', ' ') -- LC bib handling (\t+\s)
:gsub(' ', ' ') -- LC aut handling (\t)
:gsub(' ', ' ') -- Pergamum handling (control fields) (non-breaking space)
:gsub(' ', ' ') -- Pergamum handling (data fields) (non-breaking space)
record = record .. '\n'
if record:match('^FMT') or record:match('^LDR') -- Aleph handling
then
record = record:gsub('\t', ' ') -- 1
:gsub('^(FMT%s[A-Z].-\n)', '') -- 2
:gsub('LDR%s([0%s][0%s][0%s][0%s][0%s].-\n)', '000 %1') -- 3
:gsub('\n(%d%d%d)%s(%$.%s)', '\n%1 %2') -- 4
:gsub('\n(%d%d%d)(%d)', '\n%1 %2') -- 5
:gsub('\n(%d%d%d%s%d%s)', '\n%1 ') -- 6 (manter essa ordem)
end
-- configuração das variáveis básicas do registro (via MARC tags):
Linha 169:
end
-- == Handler unificado == --
if leader:sub(7, 7) == 'z' and (controlField003:lower():match('br') or controlField003:lower():match('br-rjbn'))
then
-- cria uma tabela com os dados...
Linha 320:
if formOfItem == ' '
then
formOfItem = '
end
local natureOfContents = controlField008:sub(25, 25)
Linha 338:
end
local festschrift = controlField008:sub(31, 31)
if festschrift == '
then
festschrift = ''
Linha 473:
end
local headingUseSeriesAddedEntry = controlField008:sub(17, 17)
if headingUseSeriesAddedEntry == ' '
then
headingUseSeriesAddedEntry = 'b'
end
local typeOfSubjectSubdivision = controlField008:sub(18, 18)
if typeOfSubjectSubdivision == ' '
| |||