Modul:URLutil: Unterschied zwischen den Versionen

211 Bytes hinzugefügt ,  vor 11 Jahren
update
w>Patrick87
(+getURIScheme (Funktion um URI Schema aus beliebigen URLs auszulesen, also z.B. auch mailto:a@b.de Links))
w>PerfektesChaos
(update)
Zeile 1: Zeile 1:
--[=[ URLutil 2013-08-09
--[=[ URLutil 2014-05-01
Utilities for URL etc. on www.
Utilities for URL etc. on www.
* getURIScheme()
* getURIScheme()
Zeile 72: Zeile 72:
URLutil.getAuthority = function ( url )
URLutil.getAuthority = function ( url )
     if type( url ) == "string" then
     if type( url ) == "string" then
         local host, colon, port = mw.ustring.match( url .. "/", "^%s*%w*:?//([%w%.%%-]+)(:?)([%d]*)/" )
         local s, host, colon, port
        local pattern = "^%s*%w*:?//([%w%.%%-]+)(:?)([%d]*)/"
        local i = url:find( "#", 6, true )
        if i then
            s = url:sub( 1,  i - 1 )  ..  "/"
        else
            s = url .. "/"
        end
        host, colon, port = mw.ustring.match( s, pattern )
         if URLutil.isHost( host ) then
         if URLutil.isHost( host ) then
             host = mw.ustring.lower( host )
             host = mw.ustring.lower( host )
Anonymer Benutzer