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

Änderungen

Zur Navigation springen Zur Suche springen
691 Bytes hinzugefügt ,  23:45, 20. Mai 2019
2019-05-19: c/p von https://de.wikipedia.beta.wmflabs.org/w/index.php?title=Modul:URLutil&oldid=24268 (Spezial:PermaLink/188779513#1× c&p bitte)
Zeile 1: Zeile 1:  
local URLutil = { suite  = "URLutil",
 
local URLutil = { suite  = "URLutil",
                   serial = "2019-03-01",
+
                   serial = "2019-05-19",
 
                   item  = 10859193 }
 
                   item  = 10859193 }
 
--[=[
 
--[=[
 
Utilities for URL etc. on www.
 
Utilities for URL etc. on www.
 +
* decode()
 
* encode()
 
* encode()
 
* getAuthority()
 
* getAuthority()
Zeile 49: Zeile 50:  
local decodeComponentProtect = { F = "\"#%<>[\]^`{|}",
 
local decodeComponentProtect = { F = "\"#%<>[\]^`{|}",
 
                                 P = "\"#%<>[\]^`{|}/?",
 
                                 P = "\"#%<>[\]^`{|}/?",
                                 Q = "\"#%<>[\]^`{|}&=+;",
+
                                 Q = "\"#%<>[\]^`{|}&=+;,",
                                 X = "\"#%<>[\]^`{|}&=+;/?" }
+
                                 X = "\"#%<>[\]^`{|}&=+;,/?" }
      Zeile 192: Zeile 193:  
     return r
 
     return r
 
end -- getHash()
 
end -- getHash()
 +
 +
 +
 +
URLutil.decode = function ( url, enctype )
 +
    local r, s
 +
    if type( enctype ) == "string" then
 +
        s = mw.text.trim( enctype )
 +
        if s == "" then
 +
            s = false
 +
        else
 +
            s = s:upper()
 +
        end
 +
    end
 +
    r = mw.text.encode( mw.uri.decode( url, s ) )
 +
    if r:find( "[%[|%]]" ) then
 +
        local k
 +
        r, k = r:gsub( "%[", "&#91;" )
 +
                :gsub( "|", "&#124;" )
 +
                :gsub( "%]", "&#93;" )
 +
    end
 +
    return r
 +
end -- URLutil.decode()
      Zeile 916: Zeile 939:  
URLutil.isWebURL = function ( url )
 
URLutil.isWebURL = function ( url )
 
     if URLutil.getScheme( url ) and URLutil.getAuthority( url ) then
 
     if URLutil.getScheme( url ) and URLutil.getAuthority( url ) then
         if not url:match( "%S%s+%S" ) then
+
         if not url:find( "%S%s+%S" )  and
 +
          not url:find( "''", 1, true ) then
 
             return true
 
             return true
 
         end
 
         end
Zeile 937: Zeile 961:       −
function URLutil.failsafe( assert )
+
function URLutil.failsafe( 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 false
 
     --                or false
 
     -- Postcondition:
 
     -- Postcondition:
 
     --    Returns  string with appropriate version, or false
 
     --    Returns  string with appropriate version, or false
     local since = assert
+
     local since = atleast
 
     local r
 
     local r
 
     if since == "wikidata" then
 
     if since == "wikidata" then
Zeile 978: Zeile 1.002:  
local p = {}
 
local p = {}
    +
function p.decode( frame )
 +
    return URLutil.decode( frame.args[ 1 ]  or  "",
 +
                          frame.args[ 2 ] )
 +
end
 
function p.encode( frame )
 
function p.encode( frame )
 
     return URLutil.encode( frame.args[ 1 ]  or  "",
 
     return URLutil.encode( frame.args[ 1 ]  or  "",
Cookies helfen uns bei der Bereitstellung von imedwiki. Durch die Nutzung von imedwiki erklärst du dich damit einverstanden, dass wir Cookies speichern.

Navigationsmenü