Modul:TemplateData: Unterschied zwischen den Versionen
2017-05-12
wp>PerfektesChaos (2017-04-12) |
wp>PerfektesChaos (2017-05-12) |
||
Zeile 1: | Zeile 1: | ||
local TemplateData = { serial = "2017- | local TemplateData = { serial = "2017-05-12", | ||
suite = "TemplateData" } | suite = "TemplateData" } | ||
--[=[ | --[=[ | ||
Zeile 41: | Zeile 41: | ||
} | } | ||
local Permit = { | local Permit = { | ||
colors = { required | colors = { required = "EAF3FF", | ||
suggested | suggested = "FFFFFF", | ||
optional | optional = "EAECF0", | ||
deprecated = "FFCBCB" }, | deprecated = "FFCBCB", | ||
tableheadbg = "B3B7FF" }, | |||
params = { aliases = "table", | params = { aliases = "table", | ||
autovalue = "string", | autovalue = "string", | ||
Zeile 132: | Zeile 133: | ||
-- Returns number, or nil | -- Returns number, or nil | ||
local seek = string.format( Permit.search, | local seek = string.format( Permit.search, | ||
ask:gsub( "([%-()^$%[%] | ask:gsub( "%%", "%%%%" ) | ||
:gsub( "([%-.()+*?^$%[%]])", | |||
"%%%1" ) ) | |||
local i, k = Data.source:find( seek, at ) | local i, k = Data.source:find( seek, at ) | ||
local r, slice, source | local r, slice, source | ||
Zeile 656: | Zeile 659: | ||
local r | local r | ||
if Data.tree and Data.tree.params then | if Data.tree and Data.tree.params then | ||
local style = "#" .. Permit.colors.tableheadbg | |||
local tr = mw.html.create( "tr" ) | local tr = mw.html.create( "tr" ) | ||
feat() | feat() | ||
tr:node( mw.html.create( "th" ) | tr:node( mw.html.create( "th" ) | ||
:attr( "colspan", "2" ) | :attr( "colspan", "2" ) | ||
:css( "background-color", style ) | |||
:wikitext( factory( "doc-param-name" ) ) ) | :wikitext( factory( "doc-param-name" ) ) ) | ||
:node( mw.html.create( "th" ) | :node( mw.html.create( "th" ) | ||
:css( "background-color", style ) | |||
:wikitext( factory( "doc-param-desc" ) ) ) | :wikitext( factory( "doc-param-desc" ) ) ) | ||
:node( mw.html.create( "th" ) | :node( mw.html.create( "th" ) | ||
:css( "background-color", style ) | |||
:wikitext( factory( "doc-param-type" ) ) ) | :wikitext( factory( "doc-param-type" ) ) ) | ||
:node( mw.html.create( "th" ) | :node( mw.html.create( "th" ) | ||
:css( "background-color", style ) | |||
:wikitext( factory( "doc-param-status" ) ) ) | :wikitext( factory( "doc-param-status" ) ) ) | ||
r = mw.html.create( "table" ) | r = mw.html.create( "table" ) | ||
Zeile 1.010: | Zeile 1.018: | ||
-- arglist -- table, template parameters | -- arglist -- table, template parameters | ||
-- Returns string | -- Returns string | ||
local spy="" | |||
local source | local source | ||
for k, v in pairs( Config ) do | for k, v in pairs( Config ) do | ||
Zeile 1.029: | Zeile 1.038: | ||
if start == "<" then | if start == "<" then | ||
Data.strip = s | Data.strip = s | ||
if s:find( "[<|>]" ) then | |||
spy=string.format( "[[category:%s]]", Config.strange ) | |||
end | |||
elseif start == "{" then | elseif start == "{" then | ||
source = s | source = s | ||
Zeile 1.051: | Zeile 1.063: | ||
end | end | ||
TemplateData.getPlainJSON( source ) | TemplateData.getPlainJSON( source ) | ||
return finalize() | return spy .. finalize() | ||
end -- furnish() | end -- furnish() | ||