Zum Inhalt springen

Modul:URLutil: Unterschied zwischen den Versionen

+ wikiEscapeURL
w>PerfektesChaos
(+ getTLD() getTop2domain() + Gerrit:63406 +kl. Verbesserungen)
w>PerfektesChaos
(+ wikiEscapeURL)
Zeile 1: Zeile 1:
--[=[ URLutil 2013-05-19
--[=[ URLutil 2013-05-22
Utilities for URL etc. on www.
Utilities for URL etc. on www.
* getAuthority()
* getAuthority()
Zeile 21: Zeile 21:
* isUnescapedURL()
* isUnescapedURL()
* isWebURL()
* isWebURL()
* wikiEscapeURL()
Only [[dotted decimal]] notation for IPv4 supported.
Only [[dotted decimal]] notation for IPv4 supported.
Does not support dotted hexadecimal, dotted octal, or single-number formats.
Does not support dotted hexadecimal, dotted octal, or single-number formats.
Zeile 295: Zeile 296:
             return true
             return true
         end
         end
         -- TODO  zero width character
         -- TODO  zero width character ??
         return false
         return false
     end
     end
Zeile 324: Zeile 325:
     return false
     return false
end -- URLutil.isWebURL()
end -- URLutil.isWebURL()
URLutil.wikiEscapeURL = function ( url )
    if url:find( "[%[|%]]" ) then
        local n
        url, n = url:gsub( "%[", "[" )
                    :gsub( "|", "|" )
                    :gsub( "%]", "]" )
    end
    return url
end -- URLutil.wikiEscapeURL()




Zeile 390: Zeile 403:
function p.isWebURL( frame )
function p.isWebURL( frame )
     return URLutil.isWebURL( frame.args[ 1 ] ) and "1" or ""
     return URLutil.isWebURL( frame.args[ 1 ] ) and "1" or ""
end
function p.wikiEscapeURL( frame )
    return URLutil.wikiEscapeURL( frame.args[ 1 ] )
end
end
function p.URLutil()
function p.URLutil()
Anonymer Benutzer