Modul:Citation: Unterschied zwischen den Versionen

format -> prefix, doi; formatIdentifier
(OL)
(format -> prefix, doi; formatIdentifier)
Zeile 2: Zeile 2:
local citation = {
local citation = {
suite  = 'Citation',
suite  = 'Citation',
serial = '2022-08-12',
serial = '2022-08-14',
item  = 56159597
item  = 56159597
}
}
Zeile 249: Zeile 249:
end
end


local function makeIssnLink( issn, ignoreError )
local function formatIdentifier( tab, key, urlPart, text, add )
local text = ''
if cu.isSet( url ) and cu.isSet( text ) then
if ignoreError ~= 'true' then
text = ci.params[ key ].prefix ..
text = ci.texts.wrongIssn
cu.makeLink( ci.params[ key ].url:gsub( '%%s', urlPart ), text ) ..
( add or '' )
teble.insert( tab, text )
end
end
 
local function addIssn( tab, issn, ignoreError )
if cu.isSet( issn ) then
local add = ignoreError ~= 'true' and ci.texts.wrongIssn or ''
add = cx.check_issn( { args = { [ 1 ] = issn, error = add } } )
formatIdentifier( tab, 'issn', issn, issn, add )
end
end
return ci.params.issn.format:gsub( 'xx1xx', issn )
.. cx.check_issn( { args = { [ 1 ] = issn, error = text } } )
end
end


Zeile 343: Zeile 351:
li._linkISBNSet( { isbn = args.isbn, ignoreError = args.ignoreError } ) )
li._linkISBNSet( { isbn = args.isbn, ignoreError = args.ignoreError } ) )
elseif cu.isSet( args.dnb ) then
elseif cu.isSet( args.dnb ) then
cu.insertItem2( tab, args.dnb, args.dnb, ci.params.dnb.format )
formatIdentifier( tab, 'dnb', args.dnb, args.dnb )
elseif cu.isSet( args.oclc ) then
elseif cu.isSet( args.oclc ) then
cu.insertItem2( tab, args.oclc, args.oclc, ci.params.oclc.format )
formatIdentifier( tab, 'oclc', args.oclc, args.oclc )
elseif cu.isSet( args.ol ) then
elseif cu.isSet( args.ol ) then
local prefix = {
local prefix = {
Zeile 352: Zeile 360:
W = 'works/OL'
W = 'works/OL'
};
};
cu.insertItem2( tab, prefix[ args.ol:sub( -1 ) ] .. args.ol, args.ol, ci.params.ol.format )
formatIdentifier( tab, 'ol', prefix[ args.ol:sub( -1 ) ] .. args.ol, args.ol )
elseif cu.isSet( args.asin ) then
elseif cu.isSet( args.asin ) then
cu.insertItem2( tab, args.asin, args.asin, ci.params.asin.format )
formatIdentifier( tab, 'asin', args.asin, args.asin )
end
if cu.isSet( args.issn ) then
table.insert( tab, makeIssnLink( args.issn, args.ignoreError ) )
end
if cu.isSet( args.eissn ) then
table.insert( tab, makeIssnLink( args.eissn, args.ignoreError ) )
end
end
addIssn( tab, args.issn, args.ignoreError )
addIssn( tab, args.eissn, args.ignoreError )
end
end


Zeile 381: Zeile 385:
end
end
if cu.isSet( args.doi ) then
if cu.isSet( args.doi ) then
cu.insertItem2( tab, cu.encodeHandle( args.doi ), args.doi, ci.params.doi.format )
formatIdentifier( tab, 'doi', cu.encodeHandle( args.doi ), args.doi )
elseif cu.isSet( args.hdl ) then
elseif cu.isSet( args.hdl ) then
cu.insertItem2( tab, cu.encodeHandle( args.hdl ), args.hdl, ci.params.hdl.format )
formatIdentifier( tab, 'hdl', cu.encodeHandle( args.hdl ), args.hdl )
else
else
-- JSTOR = doi:10.2307
-- JSTOR = doi:10.2307
cu.insertItem2( tab, args.jstor, args.jstor, ci.params.jstor.format )
formatIdentifier( tab, 'jstor', args.jstor, args.jstor )
end
end
cu.insertItem2( tab, args.pmid, args.pmid, ci.params.pmid.format )
formatIdentifier( tab, 'pmid', args.pmid, args.pmid )
end
end


Anonymer Benutzer