Modul:TemplateData: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
2017-05-25
wp>PerfektesChaos (2017-05-24) |
wp>PerfektesChaos (2017-05-25) |
||
Zeile 1: | Zeile 1: | ||
local TemplateData = { serial = "2017-05- | local TemplateData = { serial = "2017-05-25", | ||
suite = "TemplateData" } | suite = "TemplateData" } | ||
--[=[ | --[=[ | ||
Zeile 10: | Zeile 10: | ||
-- multiple #invoke option names mapped into unique internal fields | -- multiple #invoke option names mapped into unique internal fields | ||
cat = "strange", | cat = "strange", | ||
-- classParams = "classTable", | |||
cssParams = "stylesTable", | cssParams = "stylesTable", | ||
cssParWrap = "stylesTabWrap", | |||
debug = false, | debug = false, | ||
docpageCreate = "suffix", | docpageCreate = "suffix", | ||
docpageDetect = "subpage", | docpageDetect = "subpage", | ||
msgDescMiss = "solo", | msgDescMiss = "solo", | ||
-- classTable = false, -- class for params table | |||
loudly = false, -- show exported element, etc. | loudly = false, -- show exported element, etc. | ||
solo = false, -- complaint on missing description | solo = false, -- complaint on missing description | ||
strange = false, -- title of maintenance category | strange = false, -- title of maintenance category | ||
stylesTable = false, -- styles for params table | stylesTable = false, -- styles for params table | ||
stylesTabWrap = false, -- styles for params table wrapper | |||
subpage = false, -- pattern to identify subpage | subpage = false, -- pattern to identify subpage | ||
suffix = false -- subpage creation scheme | suffix = false -- subpage creation scheme | ||
Zeile 664: | Zeile 668: | ||
if Data.tree and Data.tree.params then | if Data.tree and Data.tree.params then | ||
local style = "#" .. Permit.colors.tableheadbg | local style = "#" .. Permit.colors.tableheadbg | ||
local tr = mw.html.create( "tr" ) | local tbl = mw.html.create( "table" ) | ||
:addClass( "wikitable" ) | |||
local tr = mw.html.create( "tr" ) | |||
feat() | feat() | ||
if Data.order and #Data.order > 1 then | |||
tbl:addClass( "sortable" ) | |||
end | |||
-- if Config.classTable then | |||
-- tbl:addClass( Config.classTable ) | |||
-- end | |||
if Config.stylesTable then | |||
tbl:cssText( Config.stylesTable ) | |||
end | |||
tr:node( mw.html.create( "th" ) | tr:node( mw.html.create( "th" ) | ||
:attr( "colspan", "2" ) | :attr( "colspan", "2" ) | ||
Zeile 679: | Zeile 694: | ||
:css( "background-color", style ) | :css( "background-color", style ) | ||
:wikitext( factory( "doc-param-status" ) ) ) | :wikitext( factory( "doc-param-status" ) ) ) | ||
tbl:newline() | |||
-- :node( mw.html.create( "thead" ) | |||
:node( tr ) | |||
-- | |||
-- ) | -- ) | ||
:newline() | |||
if Data.order then | if Data.order then | ||
for i = 1, #Data.order do | for i = 1, #Data.order do | ||
tbl:node( feature( Data.order[ i ] ) ) | |||
end -- for i = 1, #Data.order | end -- for i = 1, #Data.order | ||
end | |||
if Config.stylesTabWrap then | |||
r = mw.html.create( "div" ) | |||
:cssText( Config.stylesTabWrap ) | |||
:node( tbl ) | |||
else | |||
r = tbl | |||
end | end | ||
end | end | ||
Zeile 1.025: | Zeile 1.039: | ||
-- arglist -- table, template parameters | -- arglist -- table, template parameters | ||
-- Returns string | -- Returns string | ||
local spy="" | --local spy="" | ||
local source | local source | ||
for k, v in pairs( Config ) do | for k, v in pairs( Config ) do | ||
Zeile 1.033: | Zeile 1.047: | ||
end -- for k, v | end -- for k, v | ||
Config.loudly = faculty( arglist.debug or adapt.debug ) | Config.loudly = faculty( arglist.debug or adapt.debug ) | ||
if mw.site.server:find( "//de.wikipedia.beta.wmflabs.org", 1, true ) then | --if mw.site.server:find( "//de.wikipedia.beta.wmflabs.org", 1, true ) then | ||
-- Config.loudly = true | |||
end | --end | ||
Data.lazy = faculty( arglist.lazy ) and not Config.loudly | Data.lazy = faculty( arglist.lazy ) and not Config.loudly | ||
Data.leading = faculty( arglist.TOC ) | Data.leading = faculty( arglist.TOC ) | ||
Zeile 1.079: | Zeile 1.093: | ||
end | end | ||
TemplateData.getPlainJSON( source ) | TemplateData.getPlainJSON( source ) | ||
return spy .. | return finalize() | ||
--return spy .. finalize() | |||
end -- furnish() | end -- furnish() | ||