Modul:DateTime: Unterschied zwischen den Versionen

360 Bytes hinzugefügt ,  5. Februar 2014
update
(update)
(update)
Zeile 1: Zeile 1:
--[=[ 2014-01-31
--[=[ 2014-02-01
Date and time utilities
Date and time utilities
]=]
]=]
Zeile 759: Zeile 759:
     else
     else
         local stamp = ( assign or "now" )
         local stamp = ( assign or "now" )
        if stamp == "now" then
            stamp = mw.getCurrentFrame():callParserFunction( "#timel",
                                                            "c" )
        end
         l, r = pcall( Prototypes.fetch, stamp, slang )
         l, r = pcall( Prototypes.fetch, stamp, slang )
     end
     end
Zeile 932: Zeile 936:
                     :gsub( "  +", " " )
                     :gsub( "  +", " " )
         r = mw.text.trim( r )
         r = mw.text.trim( r )
         if r == ""  or slang == "now" then
         if r == "" then
             r = { }
             r = { }
         else
         else
Zeile 1.242: Zeile 1.246:


function p.format( frame )
function p.format( frame )
     local r = ( frame.args[ 1 ] or "" )
     local r = ( frame.args[ 1 ] or "now" )
    if r == "now" then
        r = frame:callParserFunction( "#timel", "c" )
    end
     local l, o = pcall( DateTime, r, "de" )
     local l, o = pcall( DateTime, r, "de" )
     if l then
     if l then
        local spec  = frame.args[ 2 ]
        local slang = frame.args[ 3 ]
        if spec then
            spec = trim( spec )
        end
        if slang then
            slang = trim( slang )
        end
         if type( o ) == "table" then
         if type( o ) == "table" then
             l, r = pcall( o,
             l, r = pcall( o, format, spec, slang )
                          format,
                          frame.args[ 2 ],
                          frame.args[ 3 ] )
         else
         else
             l = ( frame.args.noerror or "0" )
             l = ( frame.args.noerror or "0" )
Anonymer Benutzer