Module:Citation/CS1 and Module:Citation/CS1/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
sync from sandbox; |
Add IPv6 address support to this; using that for a webserver isn't popular but is valid and usable. Found regex for IPv6 here: <ref>https://stackoverflow.com/questions/10975935/lua-function-check-if-ipv4-or-ipv6-or-string</ref> |
||
Line 1: | Line 1: | ||
--[[ |
|||
History of changes since last sync: 2024-08-17 |
|||
]] |
|||
require ('strict'); |
require ('strict'); |
||
Line 148: | Line 154: | ||
'%f[%w][%w][%w]%.%a%a+$', -- two character hostname and TLD |
'%f[%w][%w][%w]%.%a%a+$', -- two character hostname and TLD |
||
'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?', -- IPv4 address |
'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?', -- IPv4 address |
||
'[%a%d]+%:?' -- IPv6 address |
|||
} |
} |
||
Line 245: | Line 252: | ||
local function link_param_ok (value) |
local function link_param_ok (value) |
||
local scheme, domain; |
local scheme, domain; |
||
if value:find ('[<>%[%]|{}]') then |
if value:find ('[<>%[%]|{}]') then -- if any prohibited characters |
||
return false; |
return false; |
||
end |
end |