Modul:Vorlage:Dokumentation: Unterschied zwischen den Versionen

K
4 Versionen importiert: Extension Graph
K (6 Versionen importiert: Lua)
K (4 Versionen importiert: Extension Graph)
 
(4 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 1: Zeile 1:
--[=[ 2018-04-24
--[=[ 2019-07-29
{{Dokumentation}}
{{Dokumentation}}
]=]
]=]
local Current = mw.title.getCurrentTitle()




Zeile 69: Zeile 73:




local function furnish( area )
local function furnish( area, frame )
     local i = area:find( "==", 1, true )
     local i = area:find( "==", 1, true )
     local r
     local r
Zeile 96: Zeile 100:
             r = "__NOTOC__\n" .. area
             r = "__NOTOC__\n" .. area
         elseif n == 2 then
         elseif n == 2 then
             local toc = mw.html.create( "div" )
            local src    = "TOC nonum/styles.css"
                              :newline()
             local toc   = mw.html.create( "div" )
                              :addClass( "nonumtoc" )
                                  :newline()
                              :wikitext( "__TOC__" )
                                  :addClass( "nonumtoc" )
                              :newline()
                                  :wikitext( "__TOC__" )
             toc = tostring( toc )
                                  :newline()
            local styles = frame:extensionTag( "templatestyles",
                                              nil,
                                              { src = src } )
             toc = styles .. tostring( toc )
             if init == 1 then
             if init == 1 then
                 r = toc .. area
                 r = toc .. area
Zeile 119: 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 128: Zeile 135:
         if not findeSchalter( r ) then
         if not findeSchalter( r ) then
             if not findeTemplateDataTOC( r ) then
             if not findeTemplateDataTOC( r ) then
                 r = furnish( r )
                 r = furnish( r, frame )
             end
             end
         end
         end
Zeile 147: 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 155: 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 182: Zeile 168:


local p = {}
local p = {}
function p.hastemplate( frame )
    -- OBSOLETING
    local 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.transcludes()
    local s = Current.text:gsub( "/Doku$", "" )
                          :gsub( " ", "_" )
                          :gsub( "\"", """ )
    local t = mw.title.new( "Suche", -1 )
    if Current.namespace ~= 10 then
        s = string.format( "%s:%s",
                          mw.site.namespaces[ Current.namespace ].name,
                          s )
    end
    s = string.format( "hastemplate:%s ", s )
    return t:fullUrl( { search = s } )
end -- p.transcludes()


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