Modul:Sort: Unterschied zwischen den Versionen

update
w>PerfektesChaos
(Setup)
 
w>PerfektesChaos
(update)
Zeile 1: Zeile 1:
--[=[ 2013-10-13
--[=[ 2013-10-21
Sort
Sort
]=]
]=]
Zeile 57: Zeile 57:
                     elseif c == min1 or c == min2 then    -- grouping
                     elseif c == min1 or c == min2 then    -- grouping
                     else
                     else
                         suffix = mw.ustring.sub( source, j )
                         i = j
                         break    -- for j
                         break    -- for j
                     end
                     end
                    i = n
                 end    -- for j
                 end    -- for j
                n    = 0
                 last = true
                 last = true
             elseif lead then
             elseif lead then
Zeile 79: Zeile 79:
             if i < n then
             if i < n then
                 suffix = mw.ustring.sub( source, i )
                 suffix = mw.ustring.sub( source, i )
                if c == 69  or  c == 101 then    -- E e
                    local s = suffix:match( "^[Ee](-?%d+)" )
                    if s then
                        j      = tonumber( s )
                        sub    = sub:sub( 2 )
                        suffix = suffix:sub( #s + 2 )
                        if j > 0 then
                            if j > #sub then
                                sub = sub .. string.rep( "0",  j - #sub )
                            end
                            r  = r .. sub:sub( 1, j )
                            sub = sub:sub( j + 1 )
                        elseif j < 0 then
                            j = - j
                            if j > #r then
                                r = string.rep( "0",  j - #r ) .. r
                            end
                            sub = r:sub( - j ) .. sub
                            r  = r:sub( 1,  #r - j )
                        end
                        sub = "." .. sub
                    end
                end
             end
             end
             break    -- for i
             break    -- for i
Zeile 123: Zeile 146:
local p = { }
local p = { }


p.Ta = function ( frame )
p.Tlatin = function ( frame )
     -- Template::alphanumerical
     -- Template::latin
     --    {{{1}}}
     --    {{{1}}}
     return "not yet ready"
     return "not yet ready"
end -- p.Ta
end -- p.Tlatin




Zeile 147: Zeile 170:
     --    z  -- number of leading zeros / maximum length; defaults to 15
     --    z  -- number of leading zeros / maximum length; defaults to 15
     --    m  -- negative figures by digits; default: by value
     --    m  -- negative figures by digits; default: by value
    local m = frame.args.m
    if m then
        m  =  mw.text.trim( m )
    end
     local lucky, r = pcall( Sort.num,
     local lucky, r = pcall( Sort.num,
                             frame:getParent().args[ 1 ] or "",
                             frame:getParent().args[ 1 ] or "",
Zeile 156: Zeile 175:
                             frame.args.t,
                             frame.args.t,
                             tonumber( frame.args.z ),
                             tonumber( frame.args.z ),
                             m == "1" )
                             frame.args.m == "1" )
     -- DEBUG:
     -- DEBUG:
     if not lucky then
     if not lucky then
         r = "<span class='error'>" .. r .. "</span>"
         r = "<span class=\"error\">" .. r .. "</span>"
     end
     end
     return r;
     return r;
Anonymer Benutzer