Modul:TemplUtl: Unterschied zwischen den Versionen

2019-06-06
(2019-02-20)
(2019-06-06)
Zeile 1: Zeile 1:
local TemplUtl = { suite  = "TemplUtl",
local TemplUtl = { suite  = "TemplUtl",
                   serial = "2019-02-20" };
                   serial = "2019-06-06" };




Zeile 168: Zeile 168:




TemplUtl.fake = function ( access, frame )
TemplUtl.fake = function ( access )
     -- Simulation of template transclusion
     -- Simulation of template transclusion
     -- Precondition:
     -- Precondition:
     --    access  -- string, or nil; page name (template)
     --    access  -- string; page name (template)
    --    frame  -- object, or nil
    local s;
     if type( access ) == "string" then
     if type( access ) == "string" then
         s = mw.text.trim( access );
         local s = mw.text.trim( access );
         if s == "" then
         if s ~= "" then
             s = false;
             local t = mw.title.new( s, 10 );
            if not mw.title.equals( mw.title.getCurrentTitle(), t )  and
              t.exists then
                t.getContent();
            end
         end
         end
    end
    if not s then
        local cnf, lucky;
        s = string.format( "Module:%s/self", TemplUtl.suite );
        lucky, cnf = pcall( mw.loadData, s );
        if type( cnf ) == "table"  and
          cnf.loop == true then
            s = mw.title.getCurrentTitle().text;
        else
            s = false;
        end
    end
    if s then
        local f = function ()
                      framing( frame ):expandTemplate{ title = s };
                  end
        pcall( f );
     end
     end
end -- TemplUtl.fake()
end -- TemplUtl.fake()
Anonymer Benutzer