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

Änderungen

Zur Navigation springen Zur Suche springen
1.297 Bytes hinzugefügt ,  15:40, 20. Feb. 2015
neue Version von PerfektesChaos
Zeile 1: Zeile 1: −
--[=[ TemplatePar 2015-02-09
+
--[=[ TemplatePar 2015-02-14
 
Template parameter utility
 
Template parameter utility
 
* assert
 
* assert
Zeile 552: Zeile 552:  
             if type( s ) == "string"  and
 
             if type( s ) == "string"  and
 
                 s ~= ""  and  s ~= "0"  and  s ~= "-" then
 
                 s ~= ""  and  s ~= "0"  and  s ~= "-" then
                 lazy = false
+
                 if lazy then
 +
                    show = ""
 +
                    lazy = false
 +
                end
 
                 if not frame then
 
                 if not frame then
 
                     frame = mw.getCurrentFrame()
 
                     frame = mw.getCurrentFrame()
 
                 end
 
                 end
 
                 if frame:preprocess( "{{REVISIONID}}" ) == "" then
 
                 if frame:preprocess( "{{REVISIONID}}" ) == "" then
                     if s ~= "1" then
+
                     if s == "1" then
 +
                        show = "*"
 +
                    else
 
                         show = s
 
                         show = s
 
                     end
 
                     end
Zeile 591: Zeile 596:  
         s = opt.cat
 
         s = opt.cat
 
         if type( s ) == "string" then
 
         if type( s ) == "string" then
             if not r then
+
             if opt.errNS then
              r = ""
+
                local ns = mw.title.getCurrentTitle().namespace
 +
                local st = type( opt.errNS )
 +
                if st == "string" then
 +
                    local space  = string.format( ".*%%s%d%%s.*", ns )
 +
                    local spaces = string.format( " %s ", opt.errNS )
 +
                    if spaces:match( space ) then
 +
                        opt.errNS = false
 +
                    end
 +
                elseif st == "table" then
 +
                    for i = 1, #opt.errNS do
 +
                        if opt.errNS[ i ] == ns then
 +
                            opt.errNS = false
 +
                            break    -- for i
 +
                        end
 +
                    end -- for i
 +
                end
 
             end
 
             end
             if s:find( "@@@" ) then
+
             if opt.errNS then
                 if type( opt.template ) == "string" then
+
                 r = ""
                    s = s:gsub( "@@@", opt.template )
+
            else
 +
                if not r then
 +
                  r = ""
 
                 end
 
                 end
 +
                if s:find( "@@@" ) then
 +
                    if type( opt.template ) == "string" then
 +
                        s = s:gsub( "@@@", opt.template )
 +
                    end
 +
                end
 +
                local i
 +
                local cats = mw.text.split( s, "%s*#%s*" )
 +
                for i = 1, #cats do
 +
                    s = mw.text.trim( cats[ i ] )
 +
                    if #s > 0 then
 +
                        r = string.format( "%s[[Category:%s]]", r, s )
 +
                    end
 +
                end -- for i
 
             end
 
             end
            local i
  −
            local cats = mw.text.split( s, "%s*#%s*" )
  −
            for i = 1, #cats do
  −
                s = mw.text.trim( cats[ i ] )
  −
                if #s > 0 then
  −
                    r = string.format( "%s[[Category:%s]]", r, s )
  −
                end
  −
            end -- for i
   
         end
 
         end
 
     end
 
     end
Zeile 916: Zeile 943:  
                       optional  = { "2",
 
                       optional  = { "2",
 
                                     "cat",
 
                                     "cat",
 +
                                    "errNS",
 
                                     "low",
 
                                     "low",
 
                                     "max",
 
                                     "max",
Zeile 930: Zeile 958:  
         local s
 
         local s
 
         options = { cat      = frame.args.cat,
 
         options = { cat      = frame.args.cat,
 +
                    errNS    = frame.args.errNS,
 
                     low      = frame.args.low,
 
                     low      = frame.args.low,
 
                     format  = frame.args.format,
 
                     format  = frame.args.format,
Zeile 1.166: Zeile 1.195:  
                                     "opt",
 
                                     "opt",
 
                                     "cat",
 
                                     "cat",
 +
                                    "errNS",
 
                                     "low",
 
                                     "low",
 
                                     "format",
 
                                     "format",
Zeile 1.177: Zeile 1.207:  
                     optional  = fill( frame.args.opt ),
 
                     optional  = fill( frame.args.opt ),
 
                     cat      = frame.args.cat,
 
                     cat      = frame.args.cat,
 +
                    errNS    = frame.args.errNS,
 
                     low      = frame.args.low,
 
                     low      = frame.args.low,
 
                     format    = frame.args.format,
 
                     format    = frame.args.format,
Zeile 1.227: Zeile 1.258:  
     local r = false
 
     local r = false
 
     local options = { cat      = frame.args.cat,
 
     local options = { cat      = frame.args.cat,
 +
                      errNS    = frame.args.errNS,
 
                       low      = frame.args.low,
 
                       low      = frame.args.low,
 
                       format  = frame.args.format,
 
                       format  = frame.args.format,
Anonymer Benutzer
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü