Modul:TemplUtl: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
2019-01-01
K (1 Version importiert: Bei Wikipedia von Löschung bedroht) |
(2019-01-01) |
||
Zeile 1: | Zeile 1: | ||
local TemplUtl = { suite = "TemplUtl", | local TemplUtl = { suite = "TemplUtl", | ||
serial = " | serial = "2019-01-01" }; | ||
Zeile 54: | Zeile 54: | ||
if r == "" then | if r == "" then | ||
r = TemplUtl.faculty( another, nil ); | r = TemplUtl.faculty( another, nil ); | ||
elseif r | elseif r:find( "1", 1, true ) and | ||
r:match( "^[0%-]*1[01%-]*$") then | |||
r = true; | r = true; | ||
elseif r | elseif r:match( "^[0%-]+$") then | ||
r = false; | r = false; | ||
else | else | ||
Zeile 106: | Zeile 107: | ||
return r; | return r; | ||
end -- TemplUtl.faculty() | end -- TemplUtl.faculty() | ||
TemplUtl.failsafe = function ( assert ) | |||
local r | |||
if not assert or assert <= TemplUtl.serial then | |||
r = TemplUtl.serial | |||
else | |||
r = false | |||
end | |||
return r | |||
end -- TemplUtl.failsafe() | |||
Zeile 141: | Zeile 154: | ||
sign = string.format( "[[#%s|%s]]", sign, tostring( btn ) ); | sign = string.format( "[[#%s|%s]]", sign, tostring( btn ) ); | ||
top:wikitext( sign, " ", alert ); | top:wikitext( sign, " ", alert ); | ||
mw.addWarning( tostring( top ) ); | mw.addWarning( tostring( top:attr( "role", "alert" ) ) ); | ||
elseif not always then | elseif not always then | ||
err:css( { ["display"] = "none" } ); | err:css( { ["display"] = "none" } ); | ||
Zeile 592: | Zeile 605: | ||
end -- p.isRedirect | end -- p.isRedirect | ||
p.failsafe = function ( frame ) | |||
return TemplUtl. | -- Versioning interface | ||
local s = type( frame ) | |||
local since | |||
if s == "table" then | |||
since = frame.args[ 1 ] | |||
elseif s == "string" then | |||
since = frame | |||
end | |||
if since then | |||
since = mw.text.trim( since ) | |||
if since == "" then | |||
since = false | |||
end | |||
end | |||
return TemplUtl.failsafe( since ) or "" | |||
end -- p.failsafe() | end -- p.failsafe() | ||