Diese Dokumentation wird von Modul:Guide/doc aus übernommen. Änderungen können auf der Diskussionsseite vorgeschlagen werden.
Function list |
---|
L 11 — addAuthor L 19 — addGuideType L 39 — addTopic L 47 — addWebsite L 63 — addOther L 69 — p.infobox |
Dieses Modul setzt die Vorlage:Guide um. Anweisungen zur Verwendung findest du auf der Vorlagenseite.
local p = {}
local args = require( 'Module:Arguments' )
local infobox = require( 'Module:Infobox' )
local common = require( 'Module:Common' )
local infoBox
local categories = {}
local function addAuthor()
if args.author then
infoBox:addRow( 'Autor', '[https://robertsspaceindustries.com/citizens/' .. args.author .. ' ' .. args.author .. ']' )
else
table.insert( categories, '[[Kategorie:Guide mit fehlendem Autor]]' )
end
end
local function addGuideType()
if args.guide_type then
local string
if mw.ustring.lower( args.guide_type ) == 'star citizen' then
string = 'Star Citizen'
table.insert( categories, '[[Kategorie:Guide (' .. string .. ')]]' )
elseif mw.ustring.lower( args.guide_type ) == 'squadron 42' then
string = 'Squadron 42'
table.insert( categories, '[[Kategorie:Guide (' .. string .. ')]]' )
else
string = args.guide_type
end
infoBox:addRow( 'Guide für', string )
else
table.insert( categories, '[[Kategorie:Guide mit fehlendem Typen]]' )
end
end
local function addTopic()
if args.topic then
infoBox:addRow( 'Thematik', args.topic )
else
table.insert( categories, '[[Kategorie:Guide mit fehlendem Thema]]' )
end
end
local function addWebsite()
if args.website then
if string.match( args.website, 'http' ) == nil then
error( 'Webseite scheint kein valider Link zu sein', 0 )
return nil
end
infoBox:addRow( 'Webseite', args.website )
mw.smw.set({
Webseite = args.website,
})
end
end
local function addOther()
if args.other then
infoBox:addRow( 'Sonstiges', args.other )
end
end
function p.infobox( frame )
args = args.getArgs( frame )
infoBox = infobox.create( {
--title = 'Übersicht',
bodyClass = 'floatright',
} )
infoBox:addTitle( 'Übersicht' )
addAuthor()
addGuideType()
addTopic()
addWebsite()
addOther()
infoBox:addRowsFromArgs( args, '!' )
common.setDisplayTitle( frame, 'Guide: ' .. mw.title.getCurrentTitle().subpageText )
return tostring( infoBox ) .. table.concat( categories )
end
return p