Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.
Änderungen
Zur Navigation springen
Zur Suche springen
Zeile 1:
Zeile 1:
− +
+
Zeile 49:
Zeile 50:
− +
− +
Zeile 192:
Zeile 193:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 916:
Zeile 939:
− +
+
Zeile 937:
Zeile 961:
− +
− +
− +
Zeile 978:
Zeile 1.002:
+
+
+
+
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)
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()
local decodeComponentProtect = { F = "\"#%<>[\]^`{|}",
local decodeComponentProtect = { F = "\"#%<>[\]^`{|}",
P = "\"#%<>[\]^`{|}/?",
P = "\"#%<>[\]^`{|}/?",
Q = "\"#%<>[\]^`{|}&=+;",
Q = "\"#%<>[\]^`{|}&=+;,",
X = "\"#%<>[\]^`{|}&=+;/?" }
X = "\"#%<>[\]^`{|}&=+;,/?" }
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( "%[", "[" )
:gsub( "|", "|" )
:gsub( "%]", "]" )
end
return r
end -- URLutil.decode()
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
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
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 "",