Modul:Vorlage:Dokumentation: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
(2018-09-10)
(2019-05-16)
Zeile 1: Zeile 1:
--[=[ 2018-09-10
--[=[ 2019-05-16
{{Dokumentation}}
{{Dokumentation}}
]=]
]=]
local Current = mw.title.getCurrentTitle()




Zeile 123: Zeile 127:
local function f( frame )
local function f( frame )
     local bottom  = { }
     local bottom  = { }
    local current = mw.title.getCurrentTitle()
     local doku    = mw.title.makeTitle( Current.namespace,
     local doku    = mw.title.makeTitle( current.namespace,
                                         Current.text .. "/Doku" )
                                         current.text .. "/Doku" )
     local sub    = Current.prefixedText .. "/Doku"
     local sub    = current.prefixedText .. "/Doku"
     local r
     local r
     if doku.exists then
     if doku.exists then
Zeile 151: Zeile 154:
         if mw.site.server:match( "%.beta%.wmflabs%.org$" ) then
         if mw.site.server:match( "%.beta%.wmflabs%.org$" ) then
             r = r .. fake( frame, sub )
             r = r .. fake( frame, sub )
         elseif current.namespace == 10 then
         elseif Current.namespace == 10 then
             r = string.format( "%s[[Kategorie:%s]]",
             r = string.format( "%s[[Kategorie:%s]]",
                               r,
                               r,
Zeile 159: Zeile 162:
     r = r .. frame:expandTemplate{ title = "Dokumentation/footer",
     r = r .. frame:expandTemplate{ title = "Dokumentation/footer",
                                   args  = bottom }
                                   args  = bottom }
    if current.namespace == 10 then
        local cats
        sub  = current.text .. "/Meta"
        cats = mw.title.makeTitle( 10, sub )
        if cats.exists then
          local s  = string.format( "[[%s|/Meta]]",
                                    cats.prefixedText )
          local wl = mw.html.create( "code" )
                            :wikitext( s )
          local e  = mw.html.create( "div" )
                            :addClass( "error" )
                            :css( { background = "#FFFF00",
                                    border    = "#FF0000 2px solid",
                                    margin    = "1em",
                                    padding    = "5px" } )
            r = r .. tostring( e:wikitext( "Unterseite " )
                                :node( wl )
                                :wikitext( " nicht mehr unterstützt" ) )
                  .. fatal()
        end
    end
     return r
     return r
end -- f()
end -- f()
Zeile 186: Zeile 168:


local p = {}
local p = {}
function p.hastemplate( frame )
    r = Current.text:gsub( "/Doku$", "" )
                    :gsub( " ", "_" )
                    :gsub( "\"", """ )
    if Current.namespace ~= 10 then
        r = string.format( "%s:%s",
                          mw.site.namespaces[ Current.namespace ].name,
                          r )
    end
    return string.format( "hastemplate:%s+", r )
end -- p.hastemplate()


function p.f( frame )
function p.f( frame )