Modul:Citation: Unterschied zwischen den Versionen

K
Kleinigkeiten
K (handling of newspapers not defined)
K (Kleinigkeiten)
Zeile 15: Zeile 15:


-- global variables
-- global variables
-- list of possible type values
local refTypes = {
local refTypes = {
book      = { 'book', 'Buch' },
book      = { 'book', 'Buch' },
Zeile 23: Zeile 24:
}
}


-- list of possible parameter
-- no index: possible parameter names
-- no index: possible parameter names
-- types: reference types for which parameter is valid
-- types: reference types for which parameter is valid
Zeile 66: Zeile 68:
}
}


-- list of formatter strings
local formatters = {
local formatters = {
-- author
auAuthor = '%s: ',
auAuthor = '%s: ',
auAuthorEditor = '%s ; %s',
auEditor = '%s (Hrsg.)',
auEditor = '%s (Hrsg.)',
auAuthorEditor = '%s ; %s',
-- title
tiAll = "%s. ",
tiAll = "%s. ",
tiChapter = "Kapitel ''%s''",
tiIn = 'In: ',
tiScale = 'Maßstab: %s. ',
tiSeries = '(%s)',
tiTitle = "''%s''",
tiTitle = "''%s''",
tiVolume = "''%s''; Bd. %s",
tiVolume = "''%s''; Bd. %s",
tiScale = 'Maßstab: %s. ',
-- publisher
tiIn = 'In: ',
tiChapter = "Kapitel ''%s''",
puAll = '%s.',
puAll = '%s.',
puDateEdition = '%s (%d. Auflage)',
puPlaceDate = '%s, %s',
puPlaceDate = '%s, %s',
puPlacePub = '%s: %s',
puPlacePub = '%s: %s',
puDateEdition = '%s (%d. Auflage)',
-- additions
addSeries = '(%s)',
addPages = 'S. %s',
addColumns = 'Sp. %s',
addColumns = 'Sp. %s',
addComment = ' %s',
addDelimiter1 = ', ',
addDelimiter1 = ', ',
addDelimiter2 = '; ',
addDelimiter2 = '; ',
addDoi = '[[w:Digital Object Identifier|doi]]:%s',
addExtent = '%s Seiten',
addLanguage = ' (%s)',
addLanguage = ' (%s)',
addComment = ' %s',
addPages = 'S. %s',
-- periodical
prAbbr = ' (%s)',
prIssue = 'Nr. %s',
prPlace = ' <%s>',
prPlace = ' <%s>',
prAbbr = ' (%s)',
prVolume = 'Bd. %s',
prVolume = 'Bd. %s',
prIssue = 'Nr. %s',
prVolIssue = '%s,%s',
prVolIssue = '%s,%s',
prVolYear = '%s (%s)',
prVolYear = '%s (%s)',
-- newspaper
nsVolume = 'Jg. %s',
nsVolume = 'Jg. %s',
nsNrOfDay = '%s vom %s',
nsNrOfDay = '%s vom %s',
exPages = '%s Seiten',
-- database ids
dbDnb = '[[w:Deutsche Nationalbibliothek|DNB]] [http://d-nb.info/%s %s]',
dbDnb = '[[w:Deutsche Nationalbibliothek|DNB]] [http://d-nb.info/%s %s]',
dbDoi = '[[w:Digital Object Identifier|doi]]:%s',
dbOclc = '[[w:Online Computer Library Center|OCLC]] [https://worldcat.org/oclc/%s %s]',
dbOclc = '[[w:Online Computer Library Center|OCLC]] [https://worldcat.org/oclc/%s %s]',
dbIssn = '[[w:Internationale Standardnummer für fortlaufende Sammelwerke|ISSN]] [http://zdb-katalog.de/list.xhtml?t=iss%3D%22xx1xx%22&key=cql xx1xx]',
dbIssn = '[[w:Internationale Standardnummer für fortlaufende Sammelwerke|ISSN]] [http://zdb-katalog.de/list.xhtml?t=iss%3D%22xx1xx%22&key=cql xx1xx]',
dbJstor = '[[w:JSTOR|JSTOR]] [https://www.jstor.org/stable/%s %s]',
dbJstor = '[[w:JSTOR|JSTOR]] [https://www.jstor.org/stable/%s %s]',
-- web
wbAccess = 'Internetabruf am %s',
wbAccess = 'Internetabruf am %s',
wbKBytes = 'Dateigröße: %s KByte',
wbKBytes = 'Dateigröße: %s KByte',
Zeile 106: Zeile 117:
}
}


-- error categories and hints
local texts = {
local texts = {
decimalPoint  = ',',
decimalPoint  = ',',
Zeile 120: Zeile 132:
}
}


-- table of error messages
local errorMsgs = {}
local errorMsgs = {}
-- detcted date format y, y-m, y-m-d
local dateFormat = ''
local dateFormat = ''


Zeile 128: Zeile 142:
end
end


-- math function round
local function round( num, decimalPlaces )
local function round( num, decimalPlaces )
   local mult = 10^( decimalPlaces or 0 )
   local mult = 10^( decimalPlaces or 0 )
Zeile 133: Zeile 148:
end
end


-- adds error message to array
local function addErrorMsg( msg )
local function addErrorMsg( msg )
table.insert( errorMsgs, msg )
table.insert( errorMsgs, msg )
end
end


-- make complete message from message array
local function getErrorMsgs()
local function getErrorMsgs()
local i, j, result
local i, j, result
Zeile 156: Zeile 173:
end
end


-- get first item of a delimiter-separated list
local function getFirst( s, delimiter )
local function getFirst( s, delimiter )
local at = s:find( delimiter )
local at = s:find( delimiter )
Zeile 268: Zeile 286:
end
end


-- remove illegal chars from page paramters
local function getPageNumbers( pages )
local function getPageNumbers( pages )
if not isSet( pages ) then
if not isSet( pages ) then
Zeile 276: Zeile 295:
end
end


-- check parameter values
local function checkValues( args )
local function checkValues( args )
local i, key, value
local i, key, value
Zeile 341: Zeile 361:
end
end


-- make author part
local function makeAuthor( author, editor )
local function makeAuthor( author, editor )
if isSet( editor ) then
if isSet( editor ) then
Zeile 447: Zeile 468:
for key, value in ipairs( { 'series', 'series2', 'series3' } ) do
for key, value in ipairs( { 'series', 'series2', 'series3' } ) do
if isSet( args[ value ] ) then
if isSet( args[ value ] ) then
table.insert( tab, mw.ustring.format( formatters.addSeries, args[ value ] ) )
table.insert( tab, mw.ustring.format( formatters.tiSeries, args[ value ] ) )
end
end
end
end
Zeile 480: Zeile 501:
if isSet( args.extent ) then
if isSet( args.extent ) then
if args.extent:match( '^%d+$' ) then
if args.extent:match( '^%d+$' ) then
args.extent = mw.ustring.format( formatters.exPages, args.extent )
args.extent = mw.ustring.format( formatters.addExtent, args.extent )
end
end
table.insert( tab, args.extent )
table.insert( tab, args.extent )
Zeile 486: Zeile 507:
if isSet( args.doi ) then
if isSet( args.doi ) then
table.insert( tab,
table.insert( tab,
mw.ustring.format( formatters.addDoi, makeDoiLink( args.doi ) ) )
mw.ustring.format( formatters.dbDoi, makeDoiLink( args.doi ) ) )
end
end
if isSet( args.jstor ) then
if isSet( args.jstor ) then
Anonymer Benutzer