Bearbeiten von „Modul:DateTime

Warnung: Du bist nicht angemeldet. Deine IP-Adresse wird bei Bearbeitungen öffentlich sichtbar. Melde dich an oder erstelle ein Benutzerkonto, damit Bearbeitungen deinem Benutzernamen zugeordnet werden. Ein eigenes Benutzerkonto hat eine ganze Reihe von Vorteilen.

Die Bearbeitung kann rückgängig gemacht werden. Bitte prüfe den Vergleich unten, um sicherzustellen, dass du dies tun möchtest, und veröffentliche dann unten deine Änderungen, um die Bearbeitung rückgängig zu machen.

Aktuelle Version Dein Text
Zeile 1: Zeile 1:
local DateTime  = { serial = "2020-04-08",
local DateTime  = { serial = "2019-07-01",
                     suite  = "DateTime",
                     suite  = "DateTime",
                     item  = 20652535 }
                     item  = 20652535 }
-- Date and time objects
-- Date and time objects
local Failsafe  = DateTime
local Failsafe  = DateTime
local GlobalMod  = DateTime
local Calc      = { }
local Calc      = { }
local Meta      = { }
local Meta      = { }
Zeile 107: Zeile 106:
     HST  = -1000    -- Hawaiian Standard Time
     HST  = -1000    -- Hawaiian Standard Time
}
}
local foreignModule = function ( access, advanced, append, alt, alert )
    -- Fetch global module
    -- Precondition:
    --    access    -- string, with name of base module
    --    advanced  -- true, for require(); else mw.loadData()
    --    append    -- string, with subpage part, if any; or false
    --    alt      -- number, of wikidata item of root; or false
    --    alert    -- true, for throwing error on data problem
    -- Postcondition:
    --    Returns whatever, probably table
    -- 2019-10-20
    local storage = access
    local fun, lucky, r
    if advanced then
        fun = require
    else
        fun = mw.loadData
    end
    if append then
        storage = string.format( "%s/%s", storage, append )
    end
    lucky, r = pcall( fun,  "Module:" .. storage )
    if not lucky then
        local suited
        GlobalMod.globalModules = GlobalMod.globalModules or { }
        suited = GlobalMod.globalModules[ access ]
        if not suited  and
          type( alt ) == "number"  and
          alt > 0 then
            suited = string.format( "Q%d", alt )
            suited = mw.wikibase.getSitelink( suited )
            GlobalMod.globalModules[ access ] = suited or true
        end
        if type( suited ) == "string" then
            storage = suited
            if append then
                storage = string.format( "%s/%s", storage, append )
            end
            lucky, r = pcall( fun, storage )
        end
        if not lucky and alert then
            error( "Missing or invalid page: " .. storage, 0 )
        end
    end
    return r
end -- foreignModule()




Zeile 526: Zeile 476:
         if amount <= 4 then
         if amount <= 4 then
             r.year = tonumber( analyse )
             r.year = tonumber( analyse )
         elseif amount == 14 then
         elseif n == 14 then
             -- timestamp
             -- timestamp
             r.year  = tonumber( analyse:sub(  1, 4 ) )
             r.year  = tonumber( analyse:sub(  1, 4 ) )
             r.month  = tonumber( analyse:sub(  5, 6 ) )
             r.month  = tonumber( analyse:sub(  5, 2 ) )
             r.dom    = tonumber( analyse:sub(  7, 8 ) )
             r.dom    = tonumber( analyse:sub(  7, 2 ) )
             r.hour  = tonumber( analyse:sub(  9, 10 ) )
             r.hour  = tonumber( analyse:sub(  9, 2 ) )
             r.min    = tonumber( analyse:sub( 11, 12 ) )
             r.min    = tonumber( analyse:sub( 11, 2 ) )
             r.sec    = tonumber( analyse:sub( 13, 14 ) )
             r.sec    = tonumber( analyse:sub( 13, 2 ) )
         else
         else
             r = false
             r = false
Zeile 1.265: Zeile 1.215:
             r = { }
             r = { }
         else
         else
             local slang = ( alien or "" )
             local slang = ( alien or "" )
            local parser = { en  = "GermanEnglish",
                            de  = "GermanEnglish",
                            frr = "GermanEnglish",
                            nds = "GermanEnglish" }
            local suitable
             if slang == "" then
             if slang == "" then
                 slang = "en"
                 slang = "en"
Zeile 1.279: Zeile 1.224:
                 end
                 end
             end
             end
             slang   = slang:lower()
             slang = slang:lower()
             suitable = parser[ slang ]
             if slang == "en" or slang == "de" then
            if suitable then
                 local l
                 local l
                 l, r = pcall( Parser[ suitable ], r )
                 l, r = pcall( Parser.GermanEnglish, r )
                 if l and r then
                 if l and r then
                     if not Prototypes.fair( r ) then
                     if not Prototypes.fair( r ) then
Zeile 1.294: Zeile 1.238:
                 end
                 end
             else
             else
                 r = "unknown language: " .. slang
                 r = "unknown language"
             end
             end
         end
         end
Zeile 1.360: Zeile 1.304:
     -- Retrieve localization submodule
     -- Retrieve localization submodule
     if not Meta.localized then
     if not Meta.localized then
         local d = foreignModule( DateTime.suite,
         local l, d = pcall( mw.loadData, "Module:DateTime/local" )
                                false,
         if l then
                                "local",
                                DateTime.item )
         if type( d ) == "table" then
             local wk
             local wk
             if d.slang then
             if d.slang then
Zeile 1.376: Zeile 1.317:
                     for subk, subv in pairs( v ) do
                     for subk, subv in pairs( v ) do
                         wk[ subk ] = subv
                         wk[ subk ] = subv
                     end -- for k, v
                     end -- for k, v%s %s
                 else
                 else
                     World[ k ] = v
                     World[ k ] = v
Zeile 1.478: Zeile 1.419:
                                                                 item ) )
                                                                 item ) )
             if type( entity ) == "table" then
             if type( entity ) == "table" then
                local seek = Failsafe.serialProperty or "P348"
                 local vsn = entity:formatPropertyValues( "P348" )
                 local vsn = entity:formatPropertyValues( seek )
                 if type( vsn ) == "table"  and
                 if type( vsn ) == "table"  and
                   type( vsn.value ) == "string"  and
                   type( vsn.value ) == "string"  and
                   vsn.value ~= "" then
                   vsn.value ~= "" then
                     if last   and
                     if last and vsn.value == Meta.serial then
                      vsn.value == ( Meta.serial or DateTime.serial ) then
                         r = false
                         r = false
                     else
                     else
Zeile 1.812: Zeile 1.751:
     local r = false
     local r = false
     if type( self ) == "table" then
     if type( self ) == "table" then
        local slang = self.lang or "en"
         local opts  = { lang = self.lang }
         local opts  = { lang = slang }
         local babel, slang
         local babel
         if type( adapt ) == "table" then
         if type( adapt ) == "table" then
             if type( adapt.lang ) == "string" then
             if type( adapt.lang ) == "string" then
Zeile 1.828: Zeile 1.766:
             opts.lonely = adapt.lonely
             opts.lonely = adapt.lonely
         end
         end
         babel = mw.language.new( opts.lang:lower() )
         babel = mw.language.new( opts.lang )
         if babel then
         if babel then
             local shift, show, stamp, suffix, limit4, locally
             local shift, show, stamp, suffix, limit4, locally
Zeile 1.839: Zeile 1.777:
                     stamp = string.format( "%d %s", self.dom, stamp )
                     stamp = string.format( "%d %s", self.dom, stamp )
                 end
                 end
                 if ask and ask:find( "Mon4", 1, true ) then
                 if ask and ask:find( "Mon4" ) then
                     local mon4 = World.months4[ opts.lang:lower() ]
                     local mon4 = World.months4[ opts.lang ]
                     if mon4 and  mon4[ self.month ] then
                     if mon4 then
                        limit4 = true
                        if mon4[ self.month ] then
                            limit4 = true
                        end
                     end
                     end
                 end
                 end
Zeile 1.849: Zeile 1.789:
             end
             end
             if self.hour then
             if self.hour then
                if stamp then
                 stamp = string.format( "%s %02d:", stamp, self.hour )
                    stamp = stamp .. " "
                else
                    stamp = ""
                end
                 stamp = string.format( "%s%02d:", stamp, self.hour )
                 if self.min then
                 if self.min then
                     stamp = string.format( "%s%02d", stamp, self.min )
                     stamp = string.format( "%s%02d", stamp, self.min )
Zeile 1.894: Zeile 1.829:
             if self.month then
             if self.month then
                 local bucket, m, suite, x
                 local bucket, m, suite, x
                 if show:find( "F", 1, true ) then
                 if show:find( "F" ) then
                     suite = "monthsLong"
                     suite = "monthsLong"
                 elseif show:find( "M", 1, true ) then
                 elseif show:find( "M" ) then
                     suite = "monthsAbbr"
                     suite = "monthsAbbr"
                 end
                 end
                 bucket = World[ suite ]
                 bucket = World[ suite ]
                 if bucket then
                 if bucket then
                     m = bucket[ opts.lang:lower() ]
                     m = bucket[ opts.lang ]
                     if slang then
                     if slang then
                         x = bucket[ slang:lower() ]
                         x = bucket[ slang ]
                     end
                     end
                     if m then
                     if m then
Zeile 2.016: Zeile 1.951:
     -- Returns:
     -- Returns:
     --    string
     --    string
     local dels = { false, "", "-", "-", "", "", ":", ":", ".", "" }
     local dels = { false, "", "-", "-", "", ":", ":", ".", "", "" }
     local wids = { false, 4,  2,  2,  2,  2, 2,  2,  3,  3  }
     local wids = { false, 4,  2,  2,  2,  2,   2,  2,  3,  3  }
     local s    = ""
     local s    = ""
     local n, r, spec
     local n, r, spec
Zeile 2.045: Zeile 1.980:
         end
         end
     end
     end
    r = r:gsub( "%.$", "" )
     return r
     return r
end -- Prototypes.tostring()
end -- Prototypes.tostring()
Zeile 2.115: Zeile 2.049:
     if not ask  or  ask == "" then
     if not ask  or  ask == "" then
         r1 = "c"
         r1 = "c"
    elseif ask == "*" then
        if World.present then
            if assigned.hour then
                if assigned.dom or assigned.month or assigned.year then
                    if World.present.both and
                      World.present.date and
                      World.present.time then
                        r1 = World.present.both
                                    :gsub( "$date", World.present.date )
                                    :gsub( "$time", World.present.time )
                    else
                        r1 = World.present.date
                    end
                end
                r1 = r1 or World.present.time
            else
                r1 = World.present.date
            end
        end
        r1 = r1 or "c"
     else
     else
         local template = World.templates[ ask ]
         local template = World.templates[ ask ]
Zeile 2.143: Zeile 2.057:
             if tmp then
             if tmp then
                 template = tmp[ ask ]
                 template = tmp[ ask ]
            end
            if not template then
                local i = slang:find( "-", 3, true )
                if i then
                    slang = slang:sub( 1,  i - 1 ):lower()
                    tmp  = World.templates[ slang ]
                    if tmp then
                        template = tmp[ ask ]
                    end
                end
             end
             end
         end
         end
Zeile 2.174: Zeile 2.078:
             end
             end
             if template.lift and
             if template.lift and
               ( assigned.dom or
               (assigned.dom or
                not ( assigned.month or assigned.year or assigned.bc )
                not (assigned.month or assigned.year or assigned.bc)
               ) then
               ) then
                 local stamp = false
                 local stamp = false
Zeile 2.198: Zeile 2.102:
                     end
                     end
                 end
                 end
                 if low or ask:find( "hh:mm:ss", 1, true ) then
                 if low or ask:find( "hh:mm:ss" ) then
                     if stamp then
                     if stamp then
                         r1 = string.format( "%s %s", r1, stamp )
                         r1 = string.format( "%s %s", r1, stamp )
Zeile 2.254: Zeile 2.158:
             if #s == 1 then
             if #s == 1 then
                 -- "YXWVUTSRQPONZABCDEFGHIKLM"
                 -- "YXWVUTSRQPONZABCDEFGHIKLM"
                 move = World.zones[ "!" ]:find( s, 1, true )
                 move = World.zones[ "!" ]:find( s )
                 if move then
                 if move then
                     move          = ( move - 13 ) * 100
                     move          = ( move - 13 ) * 100
Zeile 2.331: Zeile 2.235:


function p.test( args, alien )
function p.test( args, alien )
     local slang = args.lang or alien
     local slang = args.lang
     local obj  = Meta.fiat( args[ 1 ], false, args.shift )
     local obj  = Meta.fiat( args[ 1 ], false, args.shift )
     local r
     local r

Bitte beachte, dass alle Beiträge im Regiowiki von anderen Mitwirkenden bearbeitet, geändert oder gelöscht werden können. Reiche hier keine Texte ein, falls Du nicht willst, dass diese ohne Einschränkung geändert werden können.

Mit dem Speichern dieser Seite stimmst Du den Nutzungsbedingungen zu und versicherst, dass Du den Beitrag selbst verfasst hast bzw. dass er keine fremden Rechte verletzt, und willigst ein, ihn unter der Creative Commons Attribution/Share-Alike Lizenz 3.0 zu veröffentlichen. Übertrage ohne Genehmigung keine urheberrechtlich geschützten Inhalte!

Du stimmst einer Autorennennung mindestens durch URL oder Verweis auf den Artikel zu. Wenn Du nicht möchtest, dass Dein Text weiterbearbeitet und weiterverbreitet wird bzw. den Nutzungsbedingungen nicht zustimmst, dann speichere ihn nicht.

Abbrechen Bearbeitungshilfe (wird in einem neuen Fenster geöffnet)

[] [[]] | {{}} {{{}}} “” ‘’ «» ‹› „“ ‚‘ · × ° § ~~~~ <s></s> <small></small> <sup></sup> <sub></sub> <tt></tt> <code></code> <pre></pre> &nbsp; [[Kategorie:]] [[Datei:]] [[Media:]] {{DEFAULTSORT:}} {{NAMESPACE}} {{PAGENAME}} #REDIRECT[[]] <gallery></gallery> <!-- --> <nowiki></nowiki> <code><nowiki></nowiki></code> <includeonly></includeonly> <noinclude></noinclude> <onlyinclude></onlyinclude> <translate></translate> <tvar|></> <languages/>

Folgende Vorlagen werden auf dieser Seite verwendet: