
Testobjekte
Quickbar rechts (Standard)
{{#invoke:Quickbar/Test|qb_table
}}
Quickbar rechts, 100px
{{#invoke:Quickbar/Test|qb_table|width: 100px;
}}
Quickbar links
Sollte nicht genutzt werden und wird später aich nicht dokmentiert werden.
{{#invoke:Quickbar/Test|qb_table|pos=left}}
Quickbar mit Überschrift
Titel |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_header
}}
Überschrift |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_header|Überschrift
}}
Überschrift |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_header|text=Überschrift
}}
Quickbar mit Zeilen
1 Werte-Spalte | |
key | value |
---|
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_header|1 Werte-Spalte
{{#invoke:Quickbar/Test|qb_item|heading=key|value=value
}}
2 Werte-Spalten | ||
key | value | value2 |
---|
{{#invoke:Quickbar/Test|qb_table|
{{#invoke:Quickbar/Test|qb_header|2 Werte-Spalten|colspan=3
{{#invoke:Quickbar/Test|qb_item|heading=key|value=value|value2=value2
}}
3 Werte-Spalten | |||
key | value | value2 | value3 |
---|
{{#invoke:Quickbar/Test|qb_table|
{{#invoke:Quickbar/Test|qb_header|3 Werte-Spalten|colspan=4
{{#invoke:Quickbar/Test|qb_item|heading=key|value=value|value2=value2|value3=value3
}}
Quickbar mit Bild
Kein Bild angegeben … |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_image|heading=Kein Bild angegeben …
}}
… aber Wikidata hat ein Hauptbild | |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_image|heading=… aber Wikidata hat ein Hauptbild
}}
Bild angegeben | |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_image|heading=Bild angegeben|image=[[File:Inle Lake (49769256536).jpg|296px|Inle-See]]
}}
Flagge von Wikidata | |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_image|heading=Flagge von Wikidata|id=Q183|wikidataProperty=P41|wikidataFileParameter=150px{{!}}Flagge
}}
Quickbar mit Linie
Linie | |
key | value |
---|---|
key | value |
{{#invoke:Quickbar/Test|qb_table
{{#invoke:Quickbar/Test|qb_header|Linie
{{#invoke:Quickbar/Test|qb_item|heading=key|value=value
{{#invoke:Quickbar/Test|qb_line
{{#invoke:Quickbar/Test|qb_item|heading=key|value=value
}}
Quickbar mit CSS
Quickbar mit CSS | |
CSS | width: 200px |
---|
{{#invoke:Quickbar/Test|qb_table|with: 200px
{{#invoke:Quickbar/Test|qb_header|Quickbar mit CSS
{{#invoke:Quickbar/Test|qb_item|heading=CSS|value=width: 200px
}}
Quickbar ohne Überschrift
CSS | width: 200px |
---|
{{#invoke:Quickbar/Test|qb_table|with: 200px
{{#invoke:Quickbar/Test|qb_item|heading=CSS|value=width: 200px
}}
- Die obige Dokumentation wurde aus der Seite Modul:Quickbar/Test/Doku eingefügt. (bearbeiten | Versionsgeschichte) Die Kategorien für dieses Modul sollten in der Dokumentation eingetragen werden. Die Interwiki-Links sollten auf Wikidata eingepflegt werden.
- Liste der Unterseiten
local yesno = require( 'Module:Yesno' ) local images = require( 'Module:GetImage' ) local locMap = require( 'Module:Location map' ) -- returns nil, if both values are equal, otherwise the value -- similar to the SQL function nullif() local function nilIf ( value, equalValue ) if ( value == nil ) then return nil elseif ( tostring ( value ) == tostring ( equalValue ) ) then return nil else return value end end -- returns the first value that is not nil -- similar to the SQL function coalesce() local function coalesce ( value1, value2, value3 ) return value1 or value2 or value3 end -- lowering all parameters local function lowerArgs( templateFrame ) local templateArgs = {} for key,value in pairs ( templateFrame.args ) do templateArgs[string.lower(key)] = value end for key,value in pairs ( templateFrame:getParent().args ) do templateArgs[string.lower(key)] = value end return templateArgs end -- generiert Attibute für die Tabelle der Quickbar local function theadAttr ( class, style ) local tableAttr = 'cellspacing="0" class="' .. class ..'"' if coalesce ( style, '' ) ~= '' then tableAttr = tableAttr .. ' style="' .. style .. '"' end return tableAttr end local quickbar = {} -- erzeugt einen Überschrifteneintrag in der Quickbar function quickbar.theader ( colSpan, text, rowClass ) local class = rowClass or '' local tr = mw.html.create ( 'tr' ) tr:addClass( class ) tr:tag('td') :attr('colspan', colSpan ) :addClass('voy-qb-header' ) :wikitext(text) return tostring ( tr ) end -- creates a row with a key column and up to three value columns function quickbar.trItemTH ( className, text1, text2, text3, text4 ) local tr = mw.html.create ( 'tr' ) tr:addClass('voy-qb-item ' .. className ) :tag('th') :addClass('voy-qb-item-key') :wikitext(text1) if ( nilIf ( text2, '' ) ~= nil ) then tr:tag('td'):addClass('voy-qb-item-value1'):wikitext(text2) end if ( nilIf ( text3, '' ) ~= nil ) then tr:tag('td'):addClass('voy-qb-item-value2'):wikitext(text3) end if ( nilIf ( text4, '' ) ~= nil and nilIf ( text3, '' ) ~= nil ) then tr:tag('td'):addClass('voy-qb-item-value3'):wikitext(text4) end return tostring ( tr ) end -- creates a row with an image function quickbar.trImage ( className, imageFile, colSpan ) if coalesce ( imageFile, '' ) == '' then return '' end local tr = mw.html.create ( 'tr' ) tr:addClass('voy-qb-item ' .. className ) :tag('td') :attr('colspan', colSpan) :addClass('voy-qb-imagecell') :tag('div') :addClass('voy-qb-image') :wikitext(imageFile) return tostring ( tr ) end function quickbar.trTwoImages ( className, className1, className2, imageFile1, imageFile2, colSpan ) if ( not colSpan ) then colSpan = 2 end local td1 = mw.html.create ( 'td' ) td1:addClass( className1 ) :tag('div') :addClass('voy-qb-image') :wikitext(imageFile1) local td2 = mw.html.create ( 'td' ) td2:addClass( className2 ) :tag('div') :addClass('voy-qb-image') :wikitext(imageFile2) local tr = mw.html.create ( 'tr' ) tr:addClass('voy-qb-item ' .. className ) :tag('td') :attr('colspan', colSpan) :addClass('voy-qb-imagecell') :tag('table') :addClass('voy-qb-twoimages') :tag('tr') :node(td1) :node(td2) return tostring ( tr ) end function quickbar.locmap ( colSpan, map, rowClass ) local class = rowClass or '' local tr = mw.html.create ( 'tr' ) tr:addClass('voy-qb-locmap '..class) :tag('td') :attr('colspan', colSpan) :wikitext(locMap.locationMap(map)) return tostring ( tr ) end function quickbar.hr ( colSpan, rowClass ) local class = rowClass or '' local hr = mw.html.create ( 'tr' ) hr:addClass('voy-qb-line '..class) :tag('td') :attr('colspan', colSpan) :tag('hr') return tostring ( hr ) end -- Functions te be usen in Templates -- Creates the Attributes of a infobox table -- used in Vorlage:Quickbar table begin -- it creates the attributes only, because the templates creates just the opening tag function quickbar.qb_table ( frame ) local args = lowerArgs ( frame ) local pos = coalesce ( nilIf ( args.pos, '' ), 'right' ) local classes = 'voy-qb ' .. coalesce ( args.tableclass, '' ) if pos == 'right' then classes = classes .. ' voy-qb-right' end if pos == 'rechts' then classes = classes .. ' voy-qb-right' end if pos == 'left' then classes = classes .. ' voy-qb-left' end if pos == 'links' then classes = classes .. ' voy-qb-left' end if yesno ( coalesce ( args.topborder, 'no' ), false ) then classes = classes .. ' voy-qb-topborder' end return theadAttr ( classes, coalesce ( args["1"], '' ) ) end -- adds a header row to the infobox function quickbar.qb_header ( frame ) local args = lowerArgs ( frame ) return quickbar.theader ( coalesce ( args.colspan, '2' ), coalesce ( args["1"], args.text, 'Titel' ), coalesce ( args.rowclass, '' ) ) end -- adds a row to the info box containing a key column and up to three value columns function quickbar.qb_item ( frame ) local args = lowerArgs ( frame ) return quickbar.trItemTH ( coalesce ( args.rowclass, '' ), coalesce ( args.heading, '' ), coalesce ( args.value, '' ), coalesce ( args.value2, '' ), coalesce ( args.value3, '' ) ) end -- adds a row with an immage an image and an optoinal heading -- if no image is defined, Wikidata can optinally be used function quickbar.qb_image( frame ) local args = lowerArgs ( frame ) local display = '' local image = '' -- is a heading defined? if ( coalesce ( args.heading, '' ) ~= '' ) then display = quickbar.theader ( coalesce ( args.colspan, '2' ), coalesce ( args.heading, '' ), coalesce ( args.rowclass, '' ) ) end image = coalesce ( args.image, '' ) if image == '' then local wdImage = coalesce ( images.GetImage().getImage ( args.id, coalesce ( args.wikidataproperty, 'P18' ) ), '' ) if wdImage ~= '' then image = '[[File:' .. wdImage .. '|' .. coalesce ( args.wikidatafileparameter, '296px' ) .. ']]' end end if image ~= '' then return display .. quickbar.trImage ( coalesce ( args.rowclass, '' ), image, coalesce ( args.colspan, '2' ) ) else return display end end -- adds a horizonal line to separate entries visually function quickbar.qb_line ( frame ) local args = lowerArgs ( frame ) return quickbar.hr ( coalesce ( args.colspan, '2' ), coalesce ( args.rowclass, '' ) ) end return quickbar