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

Conteúdo deletado Conteúdo adicionado
Sem resumo de edição
fix formOfItem
 
(28 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 3:
-- um handler para registros em "MARC tags", uma configuração para registros
-- bibliográficos e uma configuração para registros de autoridade.
function p.record( frame )
-- recebe o registro, o terceiro argumento da Predefinição:MARCimporter
local record = frame.args[3] or ''
-- recebe o modo de normalização Unicode ("Sim" para ativar o modo NFD)
local isNFD = frame.args[2] or ''
-- inicializa as variáveis básicas do registro
local leader = ''
local baseAddressOfData = 0
local directory = 0''
local dataValuesGroup = ''
-- inicializa as variáveis auxiliares
local directoryEntry = 0''
local entryTag = 0''
local entryDataLength = 0''
local entryInitPosition = 0''
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:
-- { 1={}, 2={}, 3={}, 4={}, n={} }
local controlField003controlField001 = ''
local controlField006controlField003 = ''
local controlField007controlField006 = ''
local controlField008controlField007 = ''
local tag040controlField008 = ''
local firstTemplatetag040 = ''
local fieldTemplatesfirstTemplate = ''
local lastTemplatefieldTemplates = '{{EndOfRecord}}</pre>'
local queryStringlastTemplate = '{{EndOfRecord}}</pre>'
local fieldQueryStringqueryString = ''
local formLinkfieldQueryString = ''
local formLink = ''
local function normalizeData( data )
local function normalizeData(data)
data = data
data = data
:gsub( '|(.)', ' $%1 ' ) -- substitui "|a" por " $a "
:gsub( '|(%d)p%.)', ' $%1 p.' ) -- //substitui "1p.|a" por "1 p.$a "
:gsub( '(%d)cmp%.', '%1 cmp.' ) -- // "1cm1p." por "1 cmp."
:gsub( '(%d)ed%.cm', '%1 ed.cm' ) -- // "1ed.1cm" por "1 ed.cm"
:gsub( '(%.%s?d)ed%-$.', '%1 ed.' ) -- // "1ed. -" por "1 ed."
:gsub( '(%$.*)(%s?%-$w.*)', '%2 %1.' ) -- move o subcampo $w para a frente -- // ". -" por "."
:gsub('(%$.*)(%$w.*)', '%2 %1') -- move o subcampo $w para a frente
return data
:gsub('(%s%$9%s.*)', '') -- remove o subcampo $9
end
:gsub('(%$z.*)(%$u.*)', '%2 %1') -- move o subcampo $u para a frente
if record:match( '^%d%d%d%d' )
:gsub('[\n\r]', '') -- remove line feed e carriage return
then
return data
-- == MARC ISO 2709 handler == --
end
-- O MediaWiki substitui caracteres de controle (RS, US, GS) pelo
if record:match('^%d%d%d%d')
-- caractere de "desconhecido" (losango com interrogação) e, aqui,
then
-- substituo esse caractere por um pipe (é necessário substituir
-- == MARC ISO 2709 handler == --
-- por um caractere da faixa ASCII).
-- O MediaWiki substitui caracteres de controle (RS, US, GS) pelo
record = record:gsub( '�', '|' )
-- caractere de "desconhecido" (losango com interrogação) e, aqui,
-- verifica se a forma de normalização Unicode é a
-- substituo esse caractere por um pipe (é necessário substituir
-- Normalization Form Canonical Decomposition (NFD)
-- por um caractere da faixa ASCII).
if isNFD == 'Sim'
record = record:gsub('�', '|')
then
-- verifica se a forma de normalização Unicode é a
record = mw.ustring.toNFD( record )
-- Normalization Form Canonical Decomposition (NFD)
end
if isNFD == 'Sim'
-- configuração das variáveis básicas do registro (via ISO 2709):
then
-- obtém o líder
record = mw.ustring.toNFD(record)
leader = record:sub( 1, 24 ) or ''
end
--> 00898nam a2200277 a 4500
-- configuração das variáveis básicas do registro (via ISO 2709):
-- obtém o endereço base dos dados
-- obtém o líder
baseAddressOfData = tonumber( leader:sub( 13, 17 ) ) or 0
leader = record:sub(1, 24) or ''
--> 00277
--> 00898nam a2200277 a 4500
-- obtém o diretório (-1 para não pegar RS)
-- obtém o endereço base dos dados
directory = record:sub( 25, baseAddressOfData - 1 ) or 0
baseAddressOfData = tonumber(leader:sub(13, 17)) or 0
--> 0010010000000050017000100080041000270200027000680400017000950...
--> 00277
-- obtém os dados dos campos em um único grupo
-- obtém o diretório (-1 para não pegar RS)
dataValuesGroup = record:sub( baseAddressOfData + 1 ) or ''
directory = record:sub(25, baseAddressOfData - 1) or ''
--> 278 até o final do registro
--> 0010010000000050017000100080041000270200027000680400017000950...
-- enquanto o tamanho do diretório for maior que 0...
-- obtém os dados dos campos em um único grupo
while #directory > 0
dataValuesGroup = record:sub(baseAddressOfData + 1) or ''
do
--> 278 até o final do registro
directoryEntry = directory:sub( 1, 12 ) -- 245008100177
-- enquanto o tamanho do diretório for maior que 0...
entryTag = directoryEntry:sub( 1, 3 ) -- 245
while #directory > 0
entryDataLength = directoryEntry:sub( 4, 7 ) -- 0081
do
entryInitPosition = directoryEntry:sub( 8, 12 ) -- 00177
directoryEntry = directory:sub(1, 12) -- 245008100177
-- cria uma tabela com os dados...
entryTag = directoryEntry:sub(1, 3) -- 245
dataField = {
entryDataLength = directoryEntry:sub(4, 7) -- 0081
tag = entryTag,
entryInitPosition = directoryEntry:sub(8, 12) -- 00177
length = entryDataLength,
-- cria uma tabela com os dados...
initPosition = entryInitPosition
dataField = {
}
tag = entryTag,
-- e insere cada tabela dataField na tabela dataFields
length = entryDataLength,
table.insert( dataFields, dataField )
initPosition = entryInitPosition
-- esvazia o diretório de 12 em 12
}
directory = directory:sub( 13 )
-- e insere cada tabela dataField na tabela dataFields
end
-- para cada item da tabela table.insert(dataFields..., dataField)
-- esvazia o diretório de 12 em 12
for index, dataField in ipairs( dataFields )
directory = directory:sub(13)
do
end
-- configura as variáveis para uso na função string.sub( i, j )
-- para cada item da tabela dataFields...
-- (+1 porque em Lua se começa do 1, não do 0)
for index, dataField in ipairs(dataFields)
local i = dataFields[index].initPosition + 1
do
-- (-1 para não pegar RS)
-- configura as variáveis para uso na função string.sub( i, j )
local j = dataFields[index].initPosition + dataFields[index].length - 1
-- (+1 porque em Lua se começa do 1, não do 0)
-- localiza o dado em dataValuesGroup, normaliza o dado
local i = dataFields[index].initPosition + 1
-- e armazena na tabela
-- (-1 para não pegar RS)
dataFields[index].data = normalizeData( dataValuesGroup:sub( i, j ) )
local j = dataFields[index].initPosition + dataFields[index].length - 1
-- armazena os campos de controle (00X) para posterior decomposição
-- localiza o dado em dataValuesGroup, normaliza o dado
if dataFields[index].tag == '006'
-- e armazena na tabela
then
controlField006 = dataFields[index].data = normalizeData(dataValuesGroup:gsubsub( '[|#$]'i, ' ' j))
-- armazena os campos de controle (00X) para posterior decomposição
end
if dataFields[index].tag == '007006'
then
controlField007 controlField006 = dataFields[index].data:gsub( '[|#$]', ' ' )
end
if dataFields[index].tag == '008007'
then
controlField008 controlField007 = dataFields[index].data:gsub( '[|#$\r]', ' ' )
end
if dataFields[index].tag == '008'
end
then
else
controlField008 = dataFields[index].data:gsub('[|#$-]', ' ')
-- == MARC tags handler == --
end
record = record
end
:gsub( ' ', ' ' ) -- LC bib handling (\t+\s)
else
:gsub( ' ', ' ' ) -- LC aut handling (\t)
-- == MARC tags handler == --
:gsub( '    ', ' ' ) -- Pergamum handling (control fields) (non-breaking space)
record = record
:gsub( ' ', ' ' ) -- Pergamum handling (data fields) (non-breaking space)
:gsub(' ', ' ') -- LC bib handling (\t+\s)
record = record .. '\n'
:gsub(' ', ' ') -- LC aut handling (\t)
if record:match( '^FMT' ) or record:match( '^LDR' ) -- Aleph handling
:gsub('    ', ' ') -- Pergamum handling (control fields) (non-breaking space)
then
:gsub(' ', ' ') -- Pergamum handling (data fields) (non-breaking space)
record = record:gsub( '\t', ' ' ) -- 1
record = record .. '\n'
:gsub( '^(FMT%s[A-Z].-\n)', '' ) -- 2
if record:match('^FMT') or record:match('^LDR') -- Aleph handling
:gsub( 'LDR%s([0%s][0%s][0%s][0%s][0%s].-\n)', '000 %1' ) -- 3
then
:gsub( '\n(%d%d%d)%s(%$.%s)', '\n%1 %2' ) -- 4
record = record:gsub( '\n(%d%d%d)(%d)t', '\n%1 %2' ) -- 51
:gsub( '\n^(%d%d%d%s%dFMT%s[A-Z].-\n)', '\n%1 ' ) -- 6 (manter essa ordem) -- 2
:gsub('LDR%s([0%s][0%s][0%s][0%s][0%s].-\n)', '000 %1') -- 3
end
:gsub('\n(%d%d%d)%s(%$.%s)', '\n%1 %2') -- 4
-- configuração das variáveis básicas do registro (via MARC tags):
:gsub('\n(%d%d%d)(%d)', '\n%1 %2') -- 5
-- obtém o líder
:gsub('\n(%d%d%d%s%d%s)', '\n%1 ') -- 6 (manter essa ordem)
leader = record:match( '^000%s([%d%s][%d%s][%d%s][%d%s][%d%s].-)\n' ) or ''
end
leader = leader:gsub( '[|#$]', ' ' )
-- configuração das variáveis básicas do registro (via MARC tags):
-- obtém os campos de controle
-- obtém o líder
controlField003 = record:match( '\n003%s(.-)\n' ) or ''
controlField006 leader = record:match( '\n006^000%s([a-z%d%s][%d%s][%d%s][%d%s][%d%s].-)\n' ) or ''
controlField006 leader = controlField006leader:gsub( '[|#$]', ' ' )
-- obtém os campos de controle
controlField007 = record:match( '\n007%s([a-z].-)\n' ) or ''
controlField001 = record:match('\n001%s(.-)\n') or ''
controlField007 = controlField007:gsub( '[|#$]', ' ' )
controlField008 controlField003 = record:match( '008\n003%s([%d%s][%d%s][%d%s][%d%s][%d%s][%d%s].-)\n' ) or ''
controlField003 = mw.text.trim(controlField003)
controlField008 = controlField008:gsub( '[|#$]', ' ' )
controlField006 = record:match('\n006%s([a-z].-)\n') or ''
-- para cada linha do registro, identifica o campo e seu conteúdo
controlField006 = controlField006:gsub('[|#$]', ' ')
-- (o conteúdo inclui os indicadores)
controlField007 = record:match('\n007%s([a-z].-)\n') or ''
for tagMatch, dataMatch in record:gmatch(
controlField007 = controlField007:gsub('[|#$\r]', ' ')
'([0-8]%d%d) ([0-9_%s][0-9_%s] [$|].-)\n' )
controlField008 = record:match('008%s([%d%s][%d%s][%d%s][%d%s][%d%s][%d%s].-)\n') or ''
do
controlField008 = controlField008:gsub('[|#$-]', ' ')
-- transforma o dado para o formato igual ao manipulado pelo
-- para cada linha do registro, identifica o campo e seu conteúdo
-- MARC ISO 2709 handler
-- (o conteúdo inclui os indicadores)
dataMatch = dataMatch:gsub( '%s?|(.)%s', '|%1' )
for tagMatch, dataMatch in record:gmatch(
-- normaliza o dado
'([0-8]%d%d) ([0-9_%s][0-9_%s] [$|].-)\n')
dataMatch = normalizeData(dataMatch)
do
-- transforma o dado para o formato igual ao manipulado pelo
-- MARC ISO 2709 handler
dataMatch = dataMatch:gsub('%s?|(.)%s', '|%1')
-- normaliza o dado
dataMatch = normalizeData(dataMatch)
 
-- cria uma tabela com os dados...
dataField = {
tag = tagMatch,
data = dataMatch
}
}
-- e insere cada tabela dataField na tabela dataFields
table.insert( dataFields, dataField )
end
end
-- == Handler unificado == --
if leader:sub( 7, 7 ) == 'z' and (controlField003:lower():match('br') ==or controlField003:lower():match('Brbr-rjbn'))
then
-- cria uma tabela com os dados...
dataField = {
tag = '670',
data = '## $a CA-BN ' .. os.date( '%Y' )
}
}
-- e insere a tabela dataField na tabela dataFields
table.insert( dataFields, dataField )
-- também mova o número de controle para o campo 035
end
dataField = {
-- função de ordenação dos campos
tag = '035',
local function sortByTag ( a, b )
data = '## $a ' .. '(' .. controlField003 .. ')' .. controlField001
if ( a.tag < b.tag )
}
then
table.insert(dataFields, dataField)
return true
end
elseif ( a.tag > b.tag )
-- função de ordenação dos campos
then
local function sortByTag(a, b)
return false
if (a.tag < b.tag)
else
then
return a.originalOrder < b.originalOrder
return true
end
elseif (a.tag > b.tag)
end
then
-- para cada item da tabela dataFields...
return false
for index, dataField in ipairs( dataFields )
else
do
return a.originalOrder < b.originalOrder
-- verifica se a tag é a 040
end
if dataFields[index].tag == '040'
end
-- se for, adiciona o subcampo para a agência modificadora do registro
-- para cada item da tabela dataFields...
-- e marca como verdadeiro a presença deste campo
for index, dataField in ipairs(dataFields)
then
do
dataFields[index].data = dataFields[index].data .. ' $d BR-FlWIK'
-- verifica se a tag é a 040
tag040 = dataFields[index].data
if dataFields[index].tag == '040'
end
-- se for, adiciona o subcampo para a agência modificadora do registro
-- verifica se a tag é uma das seguintes
-- e marca como verdadeiro a presença deste campo
if dataFields[index].tag == '092' or dataFields[index].tag == '595'
then
dataFields[index].data = dataFields[index].data .. ' $d BR-FlWIK'
-- se for, exclua da tabela dataFields
tag040 = dataFields[index].data
table.remove( dataFields, index )
end
-- verifica se a tag é uma das seguintes
end
if dataFields[index].tag == '092' or dataFields[index].tag == '595'
-- se não há campo 040, então será criado agora
then
if tag040 == ''
-- se for, exclua da tabela dataFields
then
table.remove(dataFields, index)
-- cria uma tabela com os dados...
end
dataField = {
end
tag = '040',
-- se o registro for da LC
data = '## $a BR-FlWIK $b por $c BR-FlWIK'
if leader:sub(7, 7) == 'z' and tag040:match('a DLC')
}
then
-- e insere a tabela dataField na tabela dataFields
-- cria uma tabela com os dados...
table.insert( dataFields, dataField )
dataField = {
end
tag = '670',
if leader:sub( 7, 7 ) == 'z' and tag040:match( 'a DLC' )
data = '## $a CA-LC ' .. os.date('%Y')
then
}
-- cria uma tabela com os dados...
-- e insere a tabela dataField na tabela dataFields
dataField = {
table.insert(dataFields, dataField)
tag = '670',
end
data = '## $a CA-LC ' .. os.date( '%Y' )
-- se não há campo 040, então será criado agora
}
if tag040 == ''
-- e insere a tabela dataField na tabela dataFields
then
table.insert( dataFields, dataField )
-- cria uma tabela com os dados...
end
dataField = {
for index, dataField in ipairs( dataFields )
tag = '040',
do
data = '## $a BR-FlWIK $b por $c BR-FlWIK'
-- guarda a ordem original do campo para posterior inclusão de outros
}
-- campos (mantendo a ordem original)
-- e insere a tabela dataField na tabela dataFields
dataFields[index].originalOrder = index
table.insert(dataFields, dataField)
end
end
-- ordena os campos do registro
for index, dataField in ipairs(dataFields)
table.sort( dataFields, sortByTag )
do
for index, dataField in ipairs( dataFields )
-- guarda a ordem original do campo para posterior inclusão de outros
do
-- campos (mantendo a ordem original)
-- se os campos forem maior que 009, então gerarão indicadores
if tonumber( dataFields[index].tagoriginalOrder )= > 9index
end
then
-- ordena os campos do registro
dataFields[index].ind1 =
table.sort(dataFields, sortByTag)
dataFields[index].data:sub( 1, 1 ):gsub( '[ _]', '#' )
for index, dataField in ipairs(dataFields)
dataFields[index].ind2 =
do
dataFields[index].data:sub( 2, 2 ):gsub( '[ _]', '#' )
-- se os campos forem maior que 009, então gerarão indicadores
end
if tonumber(dataFields[index].tag) > 9
-- se, também, os campos estiverem entre 010 e 830 (com exceção para 856),
then
-- criará a query string do link para o formulário e a sintaxe da
dataFields[index].ind1 =
-- Predefinição Field
dataFields[index].data:sub(1, 1):gsub('[ _]', '#')
if
tonumber( dataFields[index].tag )ind2 == 10 or
tonumber( dataFields[index].tagdata:sub(2, 2):gsub('[ >_]', 12 and'#')
end
tonumber( dataFields[index].tag ) < 831 or
-- se, também, os campos estiverem entre 010 e 830 (com exceção para 856),
tonumber( dataFields[index].tag ) == 856
-- criará a query string do link para o formulário e a sintaxe da
then
-- query string maker (part 2),-- Predefinição Field
if
fieldQueryString = fieldQueryString ..
tonumber(dataFields[index].tag) == 10 or
'&Field[' .. index .. '][tag]=' .. dataField.tag ..
tonumber(dataFields[index].tag) > 12 and
'&Field[' .. index .. '][ind1]=' .. dataField.ind1 ..
tonumber(dataFields[index].tag) < 831 or
'&Field[' .. index .. '][ind2]=' .. dataField.ind2 ..
tonumber(dataFields[index].tag) == 856
'&Field[' .. index .. '][data]=' .. mw.uri.encode( dataField.data:sub( 4 ) )
then
-- template string maker (part 2), Predefinição Field
-- query string maker (part 2), Predefinição Field
fieldTemplates = fieldTemplates .. '{{Field' ..
fieldQueryString = fieldQueryString ..
'\n|tag=' .. dataField.tag ..
'&Field[' .. index .. '\n|ind1][tag]=' .. dataField.ind1tag ..
'&Field[' .. index .. '\n|ind2][ind1]=' .. dataField.ind2ind1 ..
'&Field[' .. index .. '][ind2]=' .. dataField.ind2 ..
'\n|data=' .. dataField.data:sub( 4 ) ..
'&Field[' .. index .. '][data]=' .. mw.uri.encode(dataField.data:sub(4), 'PATH')
'\n}}\n'
-- template string maker (part 2), Predefinição Field
end
fieldTemplates = fieldTemplates .. '{{Field' ..
end
'\n|tag=' .. dataField.tag ..
if frame.args[1] == 'bib' or frame.args[1] == ''
'\n|ind1=' .. dataField.ind1 ..
then
'\n|ind2=' .. dataField.ind2 ..
-- inicializa as variáveis derivadas (registro bibliográfico)
'\n|data=' .. dataField.data:sub(4) ..
-- líder
'\n}}\n'
local recordStatus = leader:sub( 6, 6 )
end
local typeOfRecord = leader:sub( 7, 7 )
end
local bibliographicLevel = leader:sub( 8, 8 )
if frame.args[1] == 'bib' or frame.args[1] == ''
local encodingLevel = leader:sub( 18, 18 )
then
if encodingLevel == ' '
-- inicializa as variáveis derivadas (registro bibliográfico)
then
-- líder
encodingLevel = ''
local recordStatus = leader:sub(6, 6)
end
local descriptiveCatalogingFormtypeOfRecord = leader:sub( 197, 19 7)
local bibliographicLevel = leader:sub(8, 8)
if descriptiveCatalogingForm == ' '
local encodingLevel = leader:sub(18, 18)
then
if encodingLevel == ' '
descriptiveCatalogingForm = ''
then
end
encodingLevel = ''
local multipartResourceRecordLevel = leader:sub( 20, 20 )
end
if multipartResourceRecordLevel == ' '
local descriptiveCatalogingForm = leader:sub(19, 19)
then
if descriptiveCatalogingForm == ' '
multipartResourceRecordLevel = ''
then
end
descriptiveCatalogingForm = ''
-- control field 008
end
local dateEnteredOnFile = controlField008:sub( 1, 6 )
local typeOfDatemultipartResourceRecordLevel = controlField008leader:sub( 720, 7 20)
if multipartResourceRecordLevel == ' '
local date1 = controlField008:sub( 8, 11 )
then
local date2 = controlField008:sub( 12, 15 )
multipartResourceRecordLevel = ''
local placeOfPublication = controlField008:sub( 16, 18 )
end
local illustrations = controlField008:sub( 19, 19 )
-- control field 008
if illustrations == ' '
local dateEnteredOnFile = controlField008:sub(1, 6)
then
local typeOfDate = controlField008:sub(7, 7)
illustrations = ''
local date1 = controlField008:sub(8, 11)
end
local targetAudiencedate2 = controlField008:sub( 2312, 23 15)
local placeOfPublication = controlField008:sub(16, 18)
if targetAudience == ' '
local illustrations = controlField008:sub(19, 19)
then
if illustrations == ' '
targetAudience = ''
then
end
illustrations = ''
local formOfItem = controlField008:sub( 24, 24 )
end
if formOfItem == ' '
local targetAudience = controlField008:sub(23, 23)
then
if targetAudience == ' '
formOfItem = ''
then
end
targetAudience = ''
local natureOfContents = controlField008:sub( 25, 25 )
end
if natureOfContents == ' '
local formOfItem = controlField008:sub(24, 24)
then
if formOfItem == ' '
natureOfContents = ''
then
end
formOfItem = ''
local governmentPublication = controlField008:sub( 29, 29 )
end
if governmentPublication == ' '
local natureOfContents = controlField008:sub(25, 25)
then
if natureOfContents == ' '
governmentPublication = ''
then
end
natureOfContents = ''
local conferencePublication = controlField008:sub( 30, 30 )
end
if conferencePublication == '0'
local governmentPublication = controlField008:sub(29, 29)
then
if governmentPublication == ' ' or governmentPublication == '0'
conferencePublication = ''
then
end
governmentPublication = ''
local festschrift = controlField008:sub( 31, 31 )
end
if festschrift == '0'
local conferencePublication = controlField008:sub(30, 30)
then
if conferencePublication == '0'
festschrift = ''
then
end
conferencePublication = ''
local index = controlField008:sub( 32, 32 )
end
if index == '0'
local festschrift = controlField008:sub(31, 31)
then
if festschrift == ' '
index = ''
then
end
festschrift = ''
local literaryForm = controlField008:sub( 34, 34 )
end
if literaryForm == '0'
local index = controlField008:sub(32, 32)
then
if index == '0' or index == ' '
literaryForm = ''
then
end
index = ''
local biography = controlField008:sub( 35, 35 )
end
if biography == ' '
local literaryForm = controlField008:sub(34, 34)
then
if literaryForm == '0' or literaryForm == ' '
biography = ''
then
end
literaryForm = ''
local language = controlField008:sub( 36, 38 )
end
local modifiedRecord = controlField008:sub( 39, 39 )
local biography = controlField008:sub(35, 35)
if modifiedRecord == ' ' or modifiedRecord == '&#13;'
if biography == ' '
then
then
modifiedRecord = ''
biography = ''
end
end
local catalogingSource = controlField008:sub( 40, 40 )
local language = controlField008:sub(36, 38)
if catalogingSource == ' '
local modifiedRecord = controlField008:sub(39, 39)
then
if modifiedRecord == ' ' or modifiedRecord:match('\r')
catalogingSource = ''
then
end
modifiedRecord = ''
-- query string maker (part 1), Predefinição BibRecord
end
queryString =
local catalogingSource = controlField008:sub(40, 40)
'BibRecord[dateEnteredOnFile]=' .. dateEnteredOnFile ..
if catalogingSource == ' '
'&BibRecord[recordStatus]=' .. recordStatus ..
then
'&BibRecord[typeOfRecord]=' .. typeOfRecord ..
catalogingSource = ''
'&BibRecord[bibliographicLevel]=' .. bibliographicLevel ..
end
'&BibRecord[encodingLevel]=' .. encodingLevel ..
-- query string maker (part 1), Predefinição BibRecord
'&BibRecord[descriptiveCatalogingForm]=' .. descriptiveCatalogingForm ..
queryString =
'&BibRecord[multipartResourceRecordLevel]=' .. multipartResourceRecordLevel ..
'&BibRecord[controlField006dateEnteredOnFile]=' .. controlField006dateEnteredOnFile ..
'&BibRecord[controlField007recordStatus]=' .. controlField007recordStatus ..
'&BibRecord[typeOfDatetypeOfRecord]=' .. typeOfDatetypeOfRecord ..
'&BibRecord[date1bibliographicLevel]=' .. date1bibliographicLevel ..
'&BibRecord[date2encodingLevel]=' .. date2encodingLevel ..
'&BibRecord[placeOfPublicationdescriptiveCatalogingForm]=' .. placeOfPublicationdescriptiveCatalogingForm ..
'&BibRecord[illustrationsmultipartResourceRecordLevel]=' .. illustrationsmultipartResourceRecordLevel ..
'&BibRecord[targetAudiencecontrolField006]=' .. targetAudiencecontrolField006 ..
'&BibRecord[formOfItemcontrolField007]=' .. formOfItemcontrolField007 ..
'&BibRecord[natureOfContentstypeOfDate]=' .. natureOfContentstypeOfDate ..
'&BibRecord[governmentPublicationdate1]=' .. governmentPublicationdate1 ..
'&BibRecord[conferencePublicationdate2]=' .. conferencePublicationdate2 ..
'&BibRecord[festschriftplaceOfPublication]=' .. festschriftplaceOfPublication ..
'&BibRecord[indexillustrations]=' .. indexillustrations ..
'&BibRecord[literaryFormtargetAudience]=' .. literaryFormtargetAudience ..
'&BibRecord[biographyformOfItem]=' .. biographyformOfItem ..
'&BibRecord[languagenatureOfContents]=' .. languagenatureOfContents ..
'&BibRecord[modifiedRecordgovernmentPublication]=' .. modifiedRecordgovernmentPublication ..
'&BibRecord[catalogingSourceconferencePublication]=' .. catalogingSourceconferencePublication ..
'&BibRecord[festschrift]=' .. festschrift ..
fieldQueryString
'&BibRecord[index]=' .. index ..
-- template string maker (part 1), Predefinição BibRecord
firstTemplate = '<pre>{{&BibRecord\n[literaryForm]=' .. literaryForm ..
'&BibRecord[biography]=' .. biography ..
'|dateEnteredOnFile=' .. dateEnteredOnFile .. '\n' ..
'&BibRecord[language]=' .. language ..
'|recordStatus=' .. recordStatus .. '\n' ..
'&BibRecord[modifiedRecord]=' .. modifiedRecord ..
'|typeOfRecord=' .. typeOfRecord .. '\n' ..
'&BibRecord[catalogingSource]=' .. catalogingSource ..
'|bibliographicLevel=' .. bibliographicLevel .. '\n' ..
fieldQueryString
'|encodingLevel=' .. encodingLevel .. '\n' ..
-- template string maker (part 1), Predefinição BibRecord
'|descriptiveCatalogingForm=' .. descriptiveCatalogingForm .. '\n' ..
firstTemplate = '<pre>{{BibRecord\n' ..
'|multipartResourceRecordLevel=' .. multipartResourceRecordLevel .. '\n' ..
'|controlField006dateEnteredOnFile=' .. controlField006dateEnteredOnFile .. '\n' ..
'|controlField007recordStatus=' .. controlField007recordStatus .. '\n' ..
'|typeOfDatetypeOfRecord=' .. typeOfDatetypeOfRecord .. '\n' ..
'|date1bibliographicLevel=' .. date1bibliographicLevel .. '\n' ..
'|date2encodingLevel=' .. date2encodingLevel .. '\n' ..
'|placeOfPublicationdescriptiveCatalogingForm=' .. placeOfPublicationdescriptiveCatalogingForm .. '\n' ..
'|illustrationsmultipartResourceRecordLevel=' .. illustrationsmultipartResourceRecordLevel .. '\n' ..
'|targetAudiencecontrolField006=' .. targetAudiencecontrolField006 .. '\n' ..
'|formOfItemcontrolField007=' .. formOfItemcontrolField007 .. '\n' ..
'|natureOfContentstypeOfDate=' .. natureOfContentstypeOfDate .. '\n' ..
'|governmentPublicationdate1=' .. governmentPublicationdate1 .. '\n' ..
'|conferencePublicationdate2=' .. conferencePublicationdate2 .. '\n' ..
'|festschriftplaceOfPublication=' .. festschriftplaceOfPublication .. '\n' ..
'|indexillustrations=' .. indexillustrations .. '\n' ..
'|literaryFormtargetAudience=' .. literaryFormtargetAudience .. '\n' ..
'|biographyformOfItem=' .. biographyformOfItem .. '\n' ..
'|languagenatureOfContents=' .. languagenatureOfContents .. '\n' ..
'|modifiedRecordgovernmentPublication=' .. modifiedRecordgovernmentPublication .. '\n' ..
'|conferencePublication=' .. conferencePublication .. '\n' ..
'|catalogingSource=' .. catalogingSource ..
'|festschrift=' .. festschrift .. '\n' ..
'\n}}\n'
'|index=' .. index .. '\n' ..
-- cria o botão para a importação do registro
'|literaryForm=' .. literaryForm .. '\n' ..
formLink = frame:callParserFunction{ name = '#formlink',
'|biography=' .. biography .. '\n' ..
args = { 'form=BibRecord', 'link text=Importar registro',
'|language=' .. language .. '\n' ..
'link type=post button', 'query string=' .. queryString } }
'|modifiedRecord=' .. modifiedRecord .. '\n' ..
else
'|catalogingSource=' .. catalogingSource ..
-- inicializa as variáveis derivadas (registro de autoridade)
'\n}}\n'
-- líder
-- cria o botão para a importação do registro
local recordStatus = leader:sub( 6, 6 )
formLink = frame:callParserFunction { name = '#formlink',
local encodingLevel = leader:sub( 18, 18 )
args = { 'form=BibRecord', 'link text=Importar registro',
if encodingLevel == ' '
'link type=post button', 'query string=' .. queryString } }
then
else
encodingLevel = ''
-- inicializa as variáveis derivadas (registro de autoridade)
end
-- líder
local punctuationPolicy = leader:sub( 19, 19 )
local recordStatus = leader:sub(6, 6)
if punctuationPolicy == ' ' or punctuationPolicy == '4'
local encodingLevel = leader:sub(18, 18)
then
if encodingLevel == ' '
punctuationPolicy = ''
then
end
encodingLevel = ''
-- control field 008
end
local dateEnteredOnFile = controlField008:sub( 1, 6 )
local directOrIndirectGeogSubdivpunctuationPolicy = controlField008leader:sub( 719, 7 19)
if punctuationPolicy == ' ' or punctuationPolicy == '4'
if directOrIndirectGeogSubdiv == ' '
then
punctuationPolicy = ''
directOrIndirectGeogSubdiv = ''
end
-- control field 008
local romanizationScheme = controlField008:sub( 8, 8 )
local languageOfCatalogdateEnteredOnFile = controlField008:sub( 91, 9 6)
local directOrIndirectGeogSubdiv = controlField008:sub(7, 7)
if languageOfCatalog == ' '
if directOrIndirectGeogSubdiv == ' '
then
then
languageOfCatalog = ''
directOrIndirectGeogSubdiv = ''
end
end
local kindOfRecord = controlField008:sub( 10, 10 )
local descriptiveCatalogingRulesromanizationScheme = controlField008:sub( 118, 11 8)
local subjectHeadingSystemlanguageOfCatalog = controlField008:sub( 129, 12 9)
if languageOfCatalog == ' '
local typeOfSeries = controlField008:sub( 13, 13 )
then
local numberedOrUnnumberedSeries = controlField008:sub( 14, 14 )
languageOfCatalog = ''
if numberedOrUnnumberedSeries == ' '
end
then
local kindOfRecord = controlField008:sub(10, 10)
numberedOrUnnumberedSeries = ''
local descriptiveCatalogingRules = controlField008:sub(11, 11)
end
local headingUseMainOrAddedEntrysubjectHeadingSystem = controlField008:sub( 1512, 15 12)
local headingUseSubjectAddedEntrytypeOfSeries = controlField008:sub( 1613, 16 13)
local numberedOrUnnumberedSeries = controlField008:sub(14, 14)
if headingUseSubjectAddedEntry == ' '
if numberedOrUnnumberedSeries == ' '
then
then
headingUseSubjectAddedEntry = ''
numberedOrUnnumberedSeries = ''
end
end
local headingUseSeriesAddedEntry = controlField008:sub( 17, 17 )
local typeOfSubjectSubdivisionheadingUseMainOrAddedEntry = controlField008:sub( 1815, 18 15)
local headingUseSubjectAddedEntry = controlField008:sub(16, 16)
if typeOfSubjectSubdivision == ' '
if headingUseSubjectAddedEntry == ' '
then
then
typeOfSubjectSubdivision = ''
headingUseSubjectAddedEntry = ''
end
end
local typeOfGovernmentAgency = controlField008:sub( 29, 29 )
local headingUseSeriesAddedEntry = controlField008:sub(17, 17)
if typeOfGovernmentAgency == ' '
if headingUseSeriesAddedEntry == ' '
then
then
typeOfGovernmentAgency = ''
headingUseSeriesAddedEntry = 'b'
end
end
local referenceEvaluation = controlField008:sub( 30, 30 )
local typeOfSubjectSubdivision = controlField008:sub(18, 18)
if referenceEvaluation == ' '
if typeOfSubjectSubdivision == ' '
then
then
referenceEvaluation = ''
typeOfSubjectSubdivision = ''
end
end
local recordUpdateInProcess = controlField008:sub( 32, 32 )
local undifferentiatedPersonalNametypeOfGovernmentAgency = controlField008:sub( 3329, 33 29)
if undifferentiatedPersonalNametypeOfGovernmentAgency == ' '
then
typeOfGovernmentAgency = ''
undifferentiatedPersonalName = ''
end
local levelOfEstablishmentreferenceEvaluation = controlField008:sub( 3430, 34 30)
if levelOfEstablishmentreferenceEvaluation == ' '
then
referenceEvaluation = ''
levelOfEstablishment = ''
end
local modifiedRecordrecordUpdateInProcess = controlField008:sub( 3932, 39 32)
local undifferentiatedPersonalName = controlField008:sub(33, 33)
if modifiedRecord == ' ' or modifiedRecord == '&#13;'
if undifferentiatedPersonalName == ' '
then
then
modifiedRecord = ''
undifferentiatedPersonalName = ''
end
end
local catalogingSource = controlField008:sub( 40, 40 )
local levelOfEstablishment = controlField008:sub(34, 34)
if catalogingSource == ' '
if levelOfEstablishment == ' '
then
then
catalogingSource = ''
levelOfEstablishment = ''
end
end
-- query string maker (part 1), Predefinição AutRecord
local modifiedRecord = controlField008:sub(39, 39)
queryString =
if modifiedRecord == ' ' or modifiedRecord:match('\r')
'AutRecord[dateEnteredOnFile]=' .. dateEnteredOnFile ..
then
'&AutRecord[recordStatus]=' .. recordStatus ..
modifiedRecord = ''
'&AutRecord[encodingLevel]=' .. encodingLevel ..
end
'&AutRecord[punctuationPolicy]=' .. punctuationPolicy ..
local catalogingSource = controlField008:sub(40, 40)
'&AutRecord[directOrIndirectGeogSubdiv]=' .. directOrIndirectGeogSubdiv ..
if catalogingSource == ' '
'&AutRecord[romanizationScheme]=' .. romanizationScheme ..
then
'&AutRecord[languageOfCatalog]=' .. languageOfCatalog ..
catalogingSource = ''
'&AutRecord[kindOfRecord]=' .. kindOfRecord ..
end
'&AutRecord[descriptiveCatalogingRules]=' .. descriptiveCatalogingRules ..
-- query string maker (part 1), Predefinição AutRecord
'&AutRecord[subjectHeadingSystem]=' .. subjectHeadingSystem ..
queryString =
'&AutRecord[typeOfSeries]=' .. typeOfSeries ..
'&AutRecord[numberedOrUnnumberedSeriesdateEnteredOnFile]=' .. numberedOrUnnumberedSeriesdateEnteredOnFile ..
'&AutRecord[headingUseMainOrAddedEntryrecordStatus]=' .. headingUseMainOrAddedEntryrecordStatus ..
'&AutRecord[headingUseSubjectAddedEntryencodingLevel]=' .. headingUseSubjectAddedEntryencodingLevel ..
'&AutRecord[headingUseSeriesAddedEntrypunctuationPolicy]=' .. headingUseSeriesAddedEntrypunctuationPolicy ..
'&AutRecord[typeOfSubjectSubdivisiondirectOrIndirectGeogSubdiv]=' .. typeOfSubjectSubdivisiondirectOrIndirectGeogSubdiv ..
'&AutRecord[typeOfGovernmentAgencyromanizationScheme]=' .. typeOfGovernmentAgencyromanizationScheme ..
'&AutRecord[referenceEvaluationlanguageOfCatalog]=' .. referenceEvaluationlanguageOfCatalog ..
'&AutRecord[recordUpdateInProcesskindOfRecord]=' .. recordUpdateInProcesskindOfRecord ..
'&AutRecord[undifferentiatedPersonalNamedescriptiveCatalogingRules]=' .. undifferentiatedPersonalNamedescriptiveCatalogingRules ..
'&AutRecord[levelOfEstablishmentsubjectHeadingSystem]=' .. levelOfEstablishmentsubjectHeadingSystem ..
'&AutRecord[modifiedRecordtypeOfSeries]=' .. modifiedRecordtypeOfSeries ..
'&AutRecord[catalogingSourcenumberedOrUnnumberedSeries]=' .. catalogingSourcenumberedOrUnnumberedSeries ..
'&AutRecord[headingUseMainOrAddedEntry]=' .. headingUseMainOrAddedEntry ..
fieldQueryString
'&AutRecord[headingUseSubjectAddedEntry]=' .. headingUseSubjectAddedEntry ..
-- template string maker (part 1), Predefinição AutRecord
'&AutRecord[headingUseSeriesAddedEntry]=' .. headingUseSeriesAddedEntry ..
firstTemplate = '<pre>{{AutRecord\n' ..
'&AutRecord[typeOfSubjectSubdivision]=' .. typeOfSubjectSubdivision ..
'|dateEnteredOnFile=' .. dateEnteredOnFile .. '\n' ..
'&AutRecord[typeOfGovernmentAgency]=' .. typeOfGovernmentAgency ..
'|recordStatus=' .. recordStatus .. '\n' ..
'&AutRecord[referenceEvaluation]=' .. referenceEvaluation ..
'|encodingLevel=' .. encodingLevel .. '\n' ..
'&AutRecord[recordUpdateInProcess]=' .. recordUpdateInProcess ..
'|punctuationPolicy=' .. punctuationPolicy .. '\n' ..
'&AutRecord[undifferentiatedPersonalName]=' .. undifferentiatedPersonalName ..
'|directOrIndirectGeogSubdiv=' .. directOrIndirectGeogSubdiv .. '\n' ..
'&AutRecord[levelOfEstablishment]=' .. levelOfEstablishment ..
'|romanizationScheme=' .. romanizationScheme .. '\n' ..
'&AutRecord[modifiedRecord]=' .. modifiedRecord ..
'|languageOfCatalog=' .. languageOfCatalog .. '\n' ..
'&AutRecord[catalogingSource]=' .. catalogingSource ..
'|kindOfRecord=' .. kindOfRecord .. '\n' ..
fieldQueryString
'|descriptiveCatalogingRules=' .. descriptiveCatalogingRules .. '\n' ..
-- template string maker (part 1), Predefinição AutRecord
'|subjectHeadingSystem=' .. subjectHeadingSystem .. '\n' ..
firstTemplate = '<pre>{{AutRecord\n' ..
'|typeOfSeries=' .. typeOfSeries .. '\n' ..
'|numberedOrUnnumberedSeriesdateEnteredOnFile=' .. numberedOrUnnumberedSeriesdateEnteredOnFile .. '\n' ..
'|headingUseMainOrAddedEntryrecordStatus=' .. headingUseMainOrAddedEntryrecordStatus .. '\n' ..
'|headingUseSubjectAddedEntryencodingLevel=' .. headingUseSubjectAddedEntryencodingLevel .. '\n' ..
'|headingUseSeriesAddedEntrypunctuationPolicy=' .. headingUseSeriesAddedEntrypunctuationPolicy .. '\n' ..
'|typeOfSubjectSubdivisiondirectOrIndirectGeogSubdiv=' .. typeOfSubjectSubdivisiondirectOrIndirectGeogSubdiv .. '\n' ..
'|typeOfGovernmentAgencyromanizationScheme=' .. typeOfGovernmentAgencyromanizationScheme .. '\n' ..
'|referenceEvaluationlanguageOfCatalog=' .. referenceEvaluationlanguageOfCatalog .. '\n' ..
'|recordUpdateInProcesskindOfRecord=' .. recordUpdateInProcesskindOfRecord .. '\n' ..
'|undifferentiatedPersonalNamedescriptiveCatalogingRules=' .. undifferentiatedPersonalNamedescriptiveCatalogingRules .. '\n' ..
'|levelOfEstablishmentsubjectHeadingSystem=' .. levelOfEstablishmentsubjectHeadingSystem .. '\n' ..
'|modifiedRecordtypeOfSeries=' .. modifiedRecordtypeOfSeries .. '\n' ..
'|numberedOrUnnumberedSeries=' .. numberedOrUnnumberedSeries .. '\n' ..
'|catalogingSource=' .. catalogingSource ..
'|headingUseMainOrAddedEntry=' .. headingUseMainOrAddedEntry .. '\n' ..
'\n}}\n'
'|headingUseSubjectAddedEntry=' .. headingUseSubjectAddedEntry .. '\n' ..
-- cria o botão para a importação do registro
'|headingUseSeriesAddedEntry=' .. headingUseSeriesAddedEntry .. '\n' ..
formLink = frame:callParserFunction{ name = '#formlink',
'|typeOfSubjectSubdivision=' .. typeOfSubjectSubdivision .. '\n' ..
args = { 'form=AutRecord', 'link text=Importar registro',
'|typeOfGovernmentAgency=' .. typeOfGovernmentAgency .. '\n' ..
'link type=post button', 'query string=' .. queryString } }
'|referenceEvaluation=' .. referenceEvaluation .. '\n' ..
end
'|recordUpdateInProcess=' .. recordUpdateInProcess .. '\n' ..
-- retorna todos os valores para a predefinição {{MARCimporter}}
'|undifferentiatedPersonalName=' .. undifferentiatedPersonalName .. '\n' ..
return formLink, firstTemplate, fieldTemplates, lastTemplate
'|levelOfEstablishment=' .. levelOfEstablishment .. '\n' ..
'|modifiedRecord=' .. modifiedRecord .. '\n' ..
'|catalogingSource=' .. catalogingSource ..
'\n}}\n'
-- cria o botão para a importação do registro
formLink = frame:callParserFunction { name = '#formlink',
args = { 'form=AutRecord', 'link text=Importar registro',
'link type=post button', 'query string=' .. queryString } }
end
-- retorna todos os valores para a predefinição {{MARCimporter}}
return formLink, firstTemplate, fieldTemplates, lastTemplate
end
 
return p