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

Änderungen

Zur Navigation springen Zur Suche springen
448 Bytes hinzugefügt ,  15:48, 1. Sep. 2019
2019-08-07
Zeile 1: Zeile 1:  
local URIutil = { suite  = "URIutil",
 
local URIutil = { suite  = "URIutil",
                   serial = "2019-02-22",
+
                   serial = "2019-08-07",
 
                   item  = 19644443 };
 
                   item  = 19644443 };
 
--[=[
 
--[=[
Zeile 40: Zeile 40:  
loadData: URIutil/config URIutil/isbn URIutil/urn
 
loadData: URIutil/config URIutil/isbn URIutil/urn
 
]=]
 
]=]
 +
local Failsafe = URIutil
 
local CurrentPageName
 
local CurrentPageName
   Zeile 1.457: Zeile 1.458:  
     if URIutil.mayURN( attempt ) then
 
     if URIutil.mayURN( attempt ) then
 
         local e = mw.html.create( "span" )
 
         local e = mw.html.create( "span" )
                         :addClass( "invalid-URN" )
+
                         :addClass( "invalid-URN" );
                        :wikitext( attempt );
+
        local serial  = attempt;
         local s = flop( alert );
+
         local suffix  = flop( alert );
 +
        if serial:sub( 1, 4 ):lower() == "urn:" then
 +
            serial = serial:sub( 5 );
 +
        end
 +
        e:wikitext( serial );
 
         r = tostring( e ) .. fault( "(?!?!)" );
 
         r = tostring( e ) .. fault( "(?!?!)" );
         if s then
+
         if suffix then
             r = r .. s;
+
             r = r .. suffix;
 
         end
 
         end
 
     else
 
     else
Zeile 1.871: Zeile 1.876:       −
URIutil.failsafe = function ( assert )
+
Failsafe.failsafe = function ( atleast )
 
     -- Retrieve versioning and check for compliance
 
     -- Retrieve versioning and check for compliance
 
     -- Precondition:
 
     -- Precondition:
     --    assert -- string, with required version or "wikidata",
+
     --    atleast -- string, with required version or "wikidata" or "~"
     --               or false
+
     --                 or false
 
     -- Postcondition:
 
     -- Postcondition:
     --    Returns  string with appropriate version, or false
+
     --    Returns  string -- with queried version, also if problem
     local since = assert;
+
    --              false   -- if appropriate
     local r;
+
    local last  = ( atleast == "~" )
     if since == "wikidata" then
+
     local since = atleast
         local item = URIutil.item;
+
     local r
         since = false;
+
     if last  or  since == "wikidata" then
 +
         local item = Failsafe.item
 +
         since = false
 
         if type( item ) == "number"  and  item > 0 then
 
         if type( item ) == "number"  and  item > 0 then
             local ent = mw.wikibase.getEntity( string.format( "Q%d",
+
             local entity = mw.wikibase.getEntity( string.format( "Q%d",
                                                              item ) );
+
                                                                item ) )
             if type( ent ) == "table" then
+
             if type( entity ) == "table" then
                 local vsn = ent:formatPropertyValues( "P348" );
+
                 local vsn = entity:formatPropertyValues( "P348" )
 
                 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
                     r = vsn.value;
+
                     if last  and  vsn.value == Failsafe.serial then
 +
                        r = false
 +
                    else
 +
                        r = vsn.value
 +
                    end
 
                 end
 
                 end
 
             end
 
             end
 
         end
 
         end
 
     end
 
     end
     if not r then
+
     if type( r ) == "nil" then
         if not since  or  since <= URIutil.serial then
+
         if not since  or  since <= Failsafe.serial then
             r = URIutil.serial;
+
             r = Failsafe.serial
 
         else
 
         else
             r = false;
+
             r = false
 
         end
 
         end
 
     end
 
     end
     return r;
+
     return r
end -- URIutil.failsafe()
+
end -- Failsafe.failsafe()
      Zeile 2.053: Zeile 2.064:  
         end
 
         end
 
     end
 
     end
     return URIutil.failsafe( since )  or  "";
+
     return Failsafe.failsafe( since )  or  "";
 
end -- p.failsafe()
 
end -- p.failsafe()
 
function p.URIutil( arg )
 
function p.URIutil( arg )
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü