Burocratas, emailconfirmed, Administradores da interface, Administradores (Semantic MediaWiki), Curadores (Semantic MediaWiki), Editores (Semantic MediaWiki), Supressores, Administradores
1 051
edições
m (uma edição) |
Sem resumo de edição |
||
local p = {}
function p.makeDirectory ( frame )
if not mw.smw then
return "mw.smw module not found"
end
local fieldLengths = frame:preprocess(
[=[{{#ask: [[-Has subobject::{{{1|{{#urldecode:{{#urlget:fullpagename|{{FULLPAGENAME}}}}}}}}}]]
[[Control field data::+]]
|?Control field data
|format=plainlist
|link=none
|order=asc
|headers=hide
|outro=,|propsep=,|valuesep=&&&&|sep=,|template=ISO2709/ControlFieldDirectoryBuilder
}}{{#ask: [[-Has subobject::{{{1|{{#urldecode:{{#urlget:fullpagename|{{FULLPAGENAME}}}}}}}}}]]
[[Field data::+]]
|?Field data
|format=plainlist
|limit=100
|link=none
|order=asc
|headers=hide
|propsep=,|valuesep=&&&&|sep=,|template=ISO2709/DataFieldDirectoryBuilder
}}]=]):gsub( '%[%[SMW::...?%]%]', '' ) or '0'
local sum = 0
local directory = ''
for index, tagAndLenght in ipairs(
mw.text.split (
) do
-- frame.args[1] captura o primeiro e único argumento da chamada
-- armazenados na variável 'sum'.
end
local baseAddressOfData = string.format("%05d", #directory + 25)
--
-- "Field length" + "Base address of data" + 1 caractere de "Record terminator"
local recordLength = string.format("%05d", sum + baseAddressOfData + 1)
local dataStore = {
'Directory=' .. directory,
'Base address of data=' .. baseAddressOfData,
'Record length=' .. recordLength
}
local result = mw.smw.subobject( dataStore, '000' )
if result == true then
-- everything ok
else
return 'An error occurred during the subobject storage process. Message reads ' .. result.error
end
end
return p
|