Modul:Citation: Unterschied zwischen den Versionen
code check
(+access) |
(code check) |
||
| Zeile 2: | Zeile 2: | ||
local citation = { | local citation = { | ||
suite = 'Citation', | suite = 'Citation', | ||
serial = '2020- | serial = '2020-05-16', | ||
} | } | ||
| Zeile 19: | Zeile 19: | ||
-- check for valid arguments against params table | -- check for valid arguments against params table | ||
local function getValidArgs( frameArgs ) | local function getValidArgs( frameArgs ) | ||
local args = {} | local args = {} | ||
local complete = {} | local complete = {} | ||
local wrongParams = {} | local wrongParams = {} | ||
| Zeile 56: | Zeile 56: | ||
-- check parameter values | -- check parameter values | ||
local function checkValues( args ) | local function checkValues( args ) | ||
local wrong = {} | local wrong = {} | ||
local aType = args.type | local aType = args.type | ||
local i | |||
if aType == 'web' and not cu.isSet( args.title ) and not cu.isSet( args.url ) then | if aType == 'web' and not cu.isSet( args.title ) and not cu.isSet( args.url ) then | ||
| Zeile 302: | Zeile 302: | ||
local function makeWebInfo( args, tab ) | local function makeWebInfo( args, tab ) | ||
local kb | local kb | ||
if cu.isSet( args.url ) or cu.isSet( args.originalUrl ) or cu.isSet( args.archiveUrl ) then | if cu.isSet( args.url ) or cu.isSet( args.originalUrl ) or cu.isSet( args.archiveUrl ) then | ||
if cu.isSet( args.accessDate ) then | if cu.isSet( args.accessDate ) then | ||
| Zeile 375: | Zeile 375: | ||
local function makeLanguageComment( args, result ) | local function makeLanguageComment( args, result ) | ||
local ok = true | local ok = true | ||
if cu.isSet( args.language ) then | if cu.isSet( args.language ) then | ||
parts = mw.text.split( args.language, ' ' ) | local parts = mw.text.split( args.language, ' ' ) | ||
for i = 1, #parts, 1 do | for i = 1, #parts, 1 do | ||
parts[ i ] = mw.text.trim( parts[ i ]:gsub( ',', '' ) ) | parts[ i ] = mw.text.trim( parts[ i ]:gsub( ',', '' ) ) | ||
| Zeile 408: | Zeile 408: | ||
local function makePublished( args ) | local function makePublished( args ) | ||
result = {} | local result = {} | ||
makePublisher( args, result ) | makePublisher( args, result ) | ||
cu.insertItem( result, args.series, ci.formatters.tiSeries ) | cu.insertItem( result, args.series, ci.formatters.tiSeries ) | ||
| Zeile 439: | Zeile 439: | ||
local function makeCollection( args ) | local function makeCollection( args ) | ||
local | local author = makeAuthor( args.author, '' ) | ||
local title = makeTitle( args.title, '', '', args.url, '' ) | |||
local editor = makeAuthor( '', args.editor ) | |||
title = makeTitle( args.title, '', '', args.url, '' ) | local collection = makeTitle( args.collection, args.volume, args.titleAddition, args.siteUrl, '' ) | ||
editor = makeAuthor( '', args.editor ) | |||
collection = makeTitle( args.collection, args.volume, args.titleAddition, args.siteUrl, '' ) | |||
return author .. title .. ci.formatters.tiIn .. editor .. collection | return author .. title .. ci.formatters.tiIn .. editor .. collection | ||
| Zeile 546: | Zeile 544: | ||
local function makeCitation( frameArgs ) | local function makeCitation( frameArgs ) | ||
local | local args = getValidArgs( frameArgs ) | ||
checkValues( args ) | checkValues( args ) | ||
local citation | |||
if args.type == 'map' or args.type == 'book' then | if args.type == 'map' or args.type == 'book' then | ||
citation = makeBook( args ) | citation = makeBook( args ) | ||