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

Änderungen

Zur Navigation springen Zur Suche springen
504 Bytes hinzugefügt ,  23:34, 1. Feb. 2014
update
Zeile 1: Zeile 1: −
--[=[ 2014-01-29
+
--[=[ 2014-01-31
 
Date and time utilities
 
Date and time utilities
 
]=]
 
]=]
Zeile 14: Zeile 14:  
local Nbsp      = mw.ustring.char( 160 )
 
local Nbsp      = mw.ustring.char( 160 )
 
local Tab        = mw.ustring.char( 9 )
 
local Tab        = mw.ustring.char( 9 )
 +
World.era = { en = { "BC", "AD" } }
 
World.monthsAbbr = {  en = { n = 3 }  }
 
World.monthsAbbr = {  en = { n = 3 }  }
 
World.monthsLong.en = { "January",
 
World.monthsLong.en = { "January",
Zeile 186: Zeile 187:  
         end
 
         end
 
     elseif amount == 4 then
 
     elseif amount == 4 then
         local s, sep, sx = analyse:match( "^(%d+)([%-%.:/w]?)(.*)$" )
+
         local s, sep, sx = analyse:match( "^(%d+)([%-%.:w]?)(.*)$" )
 
         r.year = tonumber( s )
 
         r.year = tonumber( s )
 
         if sep == "-" then
 
         if sep == "-" then
Zeile 341: Zeile 342:  
                 r = false
 
                 r = false
 
             end
 
             end
        end
  −
    elseif adhere == "/" then
  −
        -- 23/12/2013
  −
        s, s2, sx = analyse:match( "^(%d%d?)/(%d%d%d%d) ?(.*)$" )
  −
        if s and s2 then
  −
            r = Parser.putDate( s2, s, ahead, assign )
  −
            if r and sx ~= "" then
  −
                r = Parser.time( sx, r )
  −
            end
  −
        else
  −
            r = false
   
         end
 
         end
 
     elseif adhere == " " then
 
     elseif adhere == " " then
Zeile 721: Zeile 711:  
     r, s = Parser.zone( s, r )
 
     r, s = Parser.zone( s, r )
 
     if r then
 
     if r then
         local start, sep, sx = s:match( "^(%d+)([ %-%.:/WwT]?)(.*)$" )
+
         local start, sep, sx = s:match( "^(%d+)([ %-%.:WwT]?)(.*)$" )
 
         if start then
 
         if start then
 
             -- begins with one or more digits (ASCII)
 
             -- begins with one or more digits (ASCII)
Zeile 1.020: Zeile 1.010:  
                 stamp = World.monthsLong.en[ self.month ]
 
                 stamp = World.monthsLong.en[ self.month ]
 
                 if self.year then
 
                 if self.year then
                     stamp = string.format( "%s %d", stamp, self.year )
+
                     stamp = string.format( "%s %04d", stamp, self.year )
 
                 end
 
                 end
 
                 if self.dom then
 
                 if self.dom then
Zeile 1.026: Zeile 1.016:  
                 end
 
                 end
 
             elseif self.year then
 
             elseif self.year then
                 stamp = tostring( self.year )
+
                 stamp = string.format( "%04d", self.year )
 
             end
 
             end
 
             if self.hour then
 
             if self.hour then
Zeile 1.054: Zeile 1.044:  
             end
 
             end
 
             r = babel:formatDate( show, stamp, locally )
 
             r = babel:formatDate( show, stamp, locally )
 +
            if self.year and self.year < 1000 then
 +
                r = r:gsub( string.format( "%04d", self.year ),
 +
                            tostring( self.year ) )
 +
            end
 
             if suffix then
 
             if suffix then
 
                 r = r .. suffix
 
                 r = r .. suffix
Zeile 1.090: Zeile 1.084:  
             if assigned.year then
 
             if assigned.year then
 
                 if not assigned.dom then
 
                 if not assigned.dom then
                     r1 = r1:gsub( "[ ./]?[jJ][ ./,]*", "" )
+
                     r1 = r1:gsub( "[ .]?[jJ][ .,%-]*", "" )
 
                           :gsub( "^&#160;", "" )
 
                           :gsub( "^&#160;", "" )
 
                     if not assigned.month then
 
                     if not assigned.month then
                         r1 = r1:gsub( "[ ./]?[fFmM][ ./]*", "" )
+
                         r1 = r1:gsub( "[ .%-]?[fFmM][ .%-]*", "" )
 
                     end
 
                     end
 
                 end
 
                 end
 
             else
 
             else
 
                 r1 = r1:gsub( " ?[yY] ?", "" )
 
                 r1 = r1:gsub( " ?[yY] ?", "" )
 +
                if not assigned.dom then
 +
                    r1 = r1:gsub( "[ .]?[jJ][ .,%-]*", "" )
 +
                            :gsub( "^&#160;", "" )
 +
                end
 
             end
 
             end
 
             if template.lift then
 
             if template.lift then
Zeile 1.131: Zeile 1.129:  
                     end
 
                     end
 
                 end
 
                 end
 +
            end
 +
            if type ( assigned.bc ) == "boolean" then
 +
                local eras = World.era[ alien ]  or  World.era.en
 +
                local i
 +
                if not r2 then
 +
                    r2 = ""
 +
                end
 +
                if assigned.bc then
 +
                    i = 1
 +
                else
 +
                    i = 2
 +
                end
 +
                r2 = string.format( "%s&#160;%s", r2, eras[ i ] )
 
             end
 
             end
 
         end
 
         end
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü