Modul:TemplUtl: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
2019-02-01
(2019-01-01) |
(2019-02-01) |
||
Zeile 1: | Zeile 1: | ||
local TemplUtl = { suite = "TemplUtl", | local TemplUtl = { suite = "TemplUtl", | ||
serial = "2019- | serial = "2019-02-01" }; | ||
Zeile 39: | Zeile 39: | ||
end | end | ||
end | end | ||
return TemplUtl.frame; | |||
end -- framing() | end -- framing() | ||
Zeile 132: | Zeile 133: | ||
:addClass( "error" ) | :addClass( "error" ) | ||
:wikitext( alert ); | :wikitext( alert ); | ||
local live | local live = ( framing( frame ):preprocess( "{{REVISIONID}}" ) | ||
== "" ); | |||
if type( addClass ) == "string" then | if type( addClass ) == "string" then | ||
err:addClass( addClass ) | err:addClass( addClass ) | ||
Zeile 165: | Zeile 165: | ||
return tostring( err ); | return tostring( err ); | ||
end -- TemplUtl.failure() | end -- TemplUtl.failure() | ||
TemplUtl.fake = function ( access, frame ) | |||
-- Simulation of template transclusion | |||
-- Precondition: | |||
-- access -- string, or nil; page name (template) | |||
-- frame -- object, or nil | |||
local f = function ( a ) | |||
framing( frame ):expandTemplate{ title = a }; | |||
end | |||
local s; | |||
if type( access ) == "string" then | |||
s = mw.text.trim( access ); | |||
if s == "" then | |||
s = false; | |||
end | |||
end | |||
if not s then | |||
s = mw.title.getCurrentTitle().text; | |||
end | |||
pcall( f, s ); | |||
end -- TemplUtl.fake() | |||
Zeile 600: | Zeile 623: | ||
return TemplUtl.failure( scream, loud, select, frame ); | return TemplUtl.failure( scream, loud, select, frame ); | ||
end -- p.failure | end -- p.failure | ||
function p.fake( frame ) | |||
TemplUtl.fake( frame.args[ 1 ] or "", frame ); | |||
return ""; | |||
end -- p.fake | |||
function p.isRedirect() | function p.isRedirect() |