Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.

Änderungen

Zur Navigation springen Zur Suche springen
621 Bytes hinzugefügt ,  10:12, 10. Apr. 2017
2017-04-10
Zeile 1: Zeile 1: −
local TemplateData = { serial = "2017-04-09",
+
local TemplateData = { serial = "2017-04-10",
 
                       suite  = "TemplateData" }
 
                       suite  = "TemplateData" }
 
--[=[
 
--[=[
Zeile 26: Zeile 26:  
     less    = false,    -- main description missing
 
     less    = false,    -- main description missing
 
     lasting = false,    -- old syntax encountered
 
     lasting = false,    -- old syntax encountered
 +
    lazy    = false,    -- doc mode; do not generate effective <templatedata>
 +
    leading = false,    -- show TOC
 
--  low    = false,    -- 1= mode
 
--  low    = false,    -- 1= mode
 
     order  = false,    -- parameter sequence
 
     order  = false,    -- parameter sequence
Zeile 149: Zeile 151:  
     return r
 
     return r
 
end -- facet()
 
end -- facet()
  −
  −
  −
local function facility( about, asked )
  −
    -- Create description head
  −
    -- Parameter:
  −
    --    about  -- table, supposed to contain description
  −
    --    asked  -- true, if mandatory description
  −
    -- Returns <block>, with head, or nil
  −
    local para = mw.html.create( "p" )
  −
    local plus, r
  −
    if about and about.description then
  −
        if type( about.description ) == "string" then
  −
            para:wikitext( about.description )
  −
        else
  −
            para:wikitext( about.description[ 1 ] )
  −
            plus = mw.html.create( "ul" )
  −
                          :addClass( "templatedata-maintain" )
  −
                          :css( "display", "none" )
  −
            for k, v in pairs( about.description[ 2 ] ) do
  −
                plus:node( mw.html.create( "li" )
  −
                                  :node( mw.html.create( "code" )
  −
                                                :wikitext( k ) )
  −
                                  :node( "br" )
  −
                                  :wikitext( fair( v ) ) )
  −
            end -- for k, v
  −
        end
  −
    elseif Config.solo and asked then
  −
        para:addClass( "error" )
  −
            :wikitext( Config.solo )
  −
        Data.less = true
  −
    else
  −
        para = false
  −
    end
  −
    if para then
  −
        if plus then
  −
            r = mw.html.create( "div" )
  −
                      :wikitext( para, plus )
  −
        else
  −
            r = para
  −
        end
  −
    end
  −
    return r
  −
end -- facility()
        Zeile 424: Zeile 382:  
     end
 
     end
 
end -- fathers()
 
end -- fathers()
 +
 +
 +
 +
local function feasible( about, asked )
 +
    -- Create description head
 +
    -- Parameter:
 +
    --    about  -- table, supposed to contain description
 +
    --    asked  -- true, if mandatory description
 +
    -- Returns <block>, with head, or nil
 +
    local para = mw.html.create( "p" )
 +
    local plus, r
 +
    if about and about.description then
 +
        if type( about.description ) == "string" then
 +
            para:wikitext( about.description )
 +
        else
 +
            para:wikitext( about.description[ 1 ] )
 +
            plus = mw.html.create( "ul" )
 +
                          :addClass( "templatedata-maintain" )
 +
                          :css( "display", "none" )
 +
            for k, v in pairs( about.description[ 2 ] ) do
 +
                plus:node( mw.html.create( "li" )
 +
                                  :node( mw.html.create( "code" )
 +
                                                :wikitext( k ) )
 +
                                  :node( "br" )
 +
                                  :wikitext( fair( v ) ) )
 +
            end -- for k, v
 +
        end
 +
    elseif Config.solo and asked then
 +
        para:addClass( "error" )
 +
            :wikitext( Config.solo )
 +
        Data.less = true
 +
    else
 +
        para = false
 +
    end
 +
    if para then
 +
        if plus then
 +
            r = mw.html.create( "div" )
 +
                      :node( para )
 +
                      :node( plus )
 +
        else
 +
            r = para
 +
        end
 +
    end
 +
    return r
 +
end -- feasible()
      Zeile 551: Zeile 554:     
     -- description etc.
 
     -- description etc.
     s = facility( param )
+
     s = feasible( param )
 
     if s then
 
     if s then
 
         desc:node( s )
 
         desc:node( s )
Zeile 911: Zeile 914:  
     -- Returns <div>
 
     -- Returns <div>
 
     local r = mw.html.create( "div" )
 
     local r = mw.html.create( "div" )
     local s = facility( Data.tree, true )
+
     local s = feasible( Data.tree, true )
 
     if s then
 
     if s then
 
         r:node( s )
 
         r:node( s )
 +
    end
 +
    if Data.leading then
 +
        r:newline()
 +
        :wikitext( "__TOC__" )
 +
        :newline()
 
     end
 
     end
 
     s = features()
 
     s = features()
 
     if s then
 
     if s then
 +
        if Data.leading then
 +
            r:node( mw.html.create( "h2" )
 +
                      :wikitext( factory( "doc-params" ) ) )
 +
            :newline()
 +
        end
 
         r:node( s )
 
         r:node( s )
 
     end
 
     end
Zeile 961: Zeile 974:  
     end
 
     end
 
     Data.div:node( format() )
 
     Data.div:node( format() )
     Data.slim = flush()
+
     if not Data.lazy then
    if TemplateData.frame then
+
        Data.slim = flush()
        local div  = mw.html.create( "div" )
+
        if TemplateData.frame then
        local tdata = { [ 1 ] = "templatedata",
+
            local div  = mw.html.create( "div" )
                        [ 2 ] = Data.slim }
+
            local tdata = { [ 1 ] = "templatedata",
        Data.strip = TemplateData.frame:callParserFunction( "#tag",
+
                            [ 2 ] = Data.slim }
                                                            tdata )
+
            Data.strip = TemplateData.frame:callParserFunction( "#tag",
        div:wikitext( Data.strip )
+
                                                                tdata )
        if Config.loudly then
+
            div:wikitext( Data.strip )
            Data.div:node( mw.html.create( "hr" ) )
+
            if Config.loudly then
        else
+
                Data.div:node( mw.html.create( "hr" ) )
            div:css( "display", "none" )
+
            else
 +
                div:css( "display", "none" )
 +
            end
 +
            Data.div:node( div )
 
         end
 
         end
        Data.div:node( div )
   
     end
 
     end
 
end -- full()
 
end -- full()
Zeile 996: Zeile 1.011:  
     Config.loudly  = true
 
     Config.loudly  = true
 
end
 
end
 +
    Data.lazy    = faculty( arglist.lazy )  and  not Config.loudly
 +
    Data.leading  = faculty( arglist.TOC )
 
     if arglist.JSON then
 
     if arglist.JSON then
 
         source = arglist.JSON
 
         source = arglist.JSON
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü