Modul:Citation: Unterschied zwischen den Versionen

K
173 Versionen von wikivoyage:Modul:Citation importiert
(redundant: +arxiv, +bibcode)
K (173 Versionen von wikivoyage:Modul:Citation importiert)
 
(15 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 2: Zeile 2:
local citation = {
local citation = {
suite  = 'Citation',
suite  = 'Citation',
serial = '2022-08-14',
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:.+$' ) or args.urn:match( '^nbn:ch:.+$' ) ) 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 not cu.isSet( args.url ) then
if cu.isSet( args.urn ) and ci.nbnCheckDigit[ country ] and
args.url = ci.params.urn.url:format( args.urn )
not cu.check_UrnNbn( 'urn:' .. args.urn ) then
args.urn = ''
cu.addErrorMsg( ci.texts.wrongURN )
end
end


Zeile 225: 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 246: Zeile 267:
end
end
if cu.isSet( args.bibcode ) then
if cu.isSet( args.bibcode ) then
args.bibcode = args.bibcode:gsub( '%.', '#b#' ) -- save bibcode dots
args.bibcode = args.bibcode:gsub( '%.', '#b#' ) -- keep bibcode periods (full stops)
end
end


Zeile 271: Zeile 292:
end
end


if checkRedundantParams( args, { 'isbn', 'dnb', 'oclc', 'ol', 'asin' } ) or
if checkRedundantParams( args, { 'isbn', 'dnb', 'urn', 'oclc', 'ol', 'asin' } ) or
checkRedundantParams( args, { 'doi', 'hdl', 'jstor', 'arxiv', 'bibcode' } ) then
checkRedundantParams( args, { 'doi', 'hdl', 'jstor', 'arxiv', 'bibcode' } ) then
cu.addErrorMsg( ci.texts.redundantParams )
cu.addErrorMsg( ci.texts.redundantParams )
Zeile 540: 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 702: 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