Modul:Citation: Unterschied zwischen den Versionen

K
173 Versionen von wikivoyage:Modul:Citation importiert
(pattern korrigiert)
K (173 Versionen von wikivoyage:Modul:Citation importiert)
 
(12 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 2: Zeile 2:
local citation = {
local citation = {
suite  = 'Citation',
suite  = 'Citation',
serial = '2022-08-15',
serial = '2022-10-21',
item  = 56159597
item  = 56159597
}
}


-- module import
-- module import
require( 'Module:No globals' )
-- require( 'strict' )
local cu = require( 'Module:Citation/utilities' )
local cu = require( 'Module:Citation/utilities' )
local cc = require( 'Module:Citation/COinS' )
local cc = require( 'Module:Citation/COinS' )
Zeile 77: Zeile 77:
if cu.isSet( args.title ) then
if cu.isSet( args.title ) then
args.title = args.title:gsub( '%s*%.+$', '' )
args.title = args.title:gsub( '%s*%.+$', '' )
end
-- convert book with chapter to collection
if args.type == 'book' and not cu.isSet( args.collection ) and cu.isSet( args.chapter ) then
args.type = 'bookitem'
args.collection, args.title, args.chapter = args.title, args.chapter, ''
args.siteUrl, args.url, args.chapterUrl = args.url, args.chapterUrl, ''
end
end


Zeile 204: Zeile 211:
end
end


local match, country
if cu.isSet( args.urn ) then
if cu.isSet( args.urn ) then
args.urn = args.urn:gsub( '^urn:', '' )
args.urn = args.urn:lower():gsub( '^urn:', '' )
if not ( args.urn:match( '^nbn:de:[%w%-:]+%d$' ) or args.urn:match( '^nbn:ch:[%w%-:]+%d$' ) ) then
match, country = args.urn:match( '^(nbn:(%l%l):[%d%l%-%.:/_]+)$' )
if not ( match and country and ci.nbnResolving[ country ] ) then
args.urn = ''
args.urn = ''
table.insert( wrong, 'urn' )
table.insert( wrong, 'urn' )
end
end
end
end
if cu.isSet( args.urn ) and args.urn:match( '^nbn:de:' ) and
if cu.isSet( args.urn ) and ci.nbnCheckDigit[ country ] and
not cu.checkUrnDe( 'urn:' .. args.urn ) then
not cu.check_UrnNbn( 'urn:' .. args.urn ) then
cu.addErrorMsg( ci.texts.wrongURN )
cu.addErrorMsg( ci.texts.wrongURN )
end
if cu.isSet( args.urn ) and not cu.isSet( args.url ) then
args.url = ci.params.urn.url:format( args.urn )
args.urn = ''
end
end


Zeile 229: Zeile 234:
args.hdl = ''
args.hdl = ''
table.insert( wrong, 'hdl' )
table.insert( wrong, 'hdl' )
end
if not cu.isSet( args.url ) then
for _, key in ipairs( ci.additionalTitleUrls ) do
if cu.isSet( args[ key ] ) then
args.url = ci.params[ key ].url:format( args[ key ] )
if key == 'urn' then
args.urn = ''
end
break
end
end
end
end


Zeile 544: Zeile 561:
cu.insertItem( result, args.series, ci.formatters.tiSeries )
cu.insertItem( result, args.series, ci.formatters.tiSeries )
makeIsbn( args, result )
makeIsbn( args, result )
if cu.isSet( args.chapter ) and cu.isSet( args.chapterUrl ) then
args.chapter = cu.makeLink( args.chapterUrl, args.chapter )
end
cu.insertItem( result, args.chapter, ci.formatters.tiChapter )
cu.insertItem( result, args.chapter, ci.formatters.tiChapter )
makePages( args, result )
makePages( args, result )
Zeile 706: Zeile 726:
if cu.isSet( args.access ) then
if cu.isSet( args.access ) then
citation = citation
citation = citation
.. '&nbsp;<span style="position:relative; top: -2px;">'
.. '&nbsp;<span class="voy-cite-access">'
.. ci.accessTypes[ args.access ].file .. '</span>'
.. ci.accessTypes[ args.access ].file .. '</span>'
end
end