Modul:TemplUtl: Unterschied zwischen den Versionen

658 Bytes hinzugefügt ,  27. Januar 2019
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 = "2017-11-11" };
                   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 == "1" then
         elseif r:find( "1", 1, true )  and
              r:match( "^[0%-]*1[01%-]*$") then
             r = true;
             r = true;
         elseif r == "0" then
         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, "&#160;", alert );
         top:wikitext( sign, "&#160;", 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


function p.failsafe()
p.failsafe = function ( frame )
     return TemplUtl.serial;
    -- 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()


Anonymer Benutzer