Module:IPblock and Module:IPblock/sandbox: Difference between pages
(Difference between pages)
imported>Sapphaline mNo edit summary |
imported>Johnuniq announce new release |
||
| Line 657: | Line 657: | ||
end | end | ||
address = table.concat(parts, ':') .. wildcard | address = table.concat(parts, ':') .. wildcard | ||
local url = '[https://en.wikipedia.org/wiki/Special:Contributions/%s?ucstart=%s | local url = '[https://en.wikipedia.org/wiki/Special:Contributions/%s?ucstart=%s c]' | ||
-- %s = IPv6 prefix address in uppercase with '*' wildcard at end | -- %s = IPv6 prefix address in uppercase with '*' wildcard at end | ||
-- %s = Start date formatted 'yyyymmdd000000' | -- %s = Start date formatted 'yyyymmdd000000' | ||
| Line 664: | Line 664: | ||
return '' -- no contributions link available | return '' -- no contributions link available | ||
end | end | ||
local url = '[https://tools.wmflabs.org/xtools/rangecontribs/?project=en.wikipedia.org&namespace=all&limit=50&text=%s&begin=%s | local url = '[https://tools.wmflabs.org/xtools/rangecontribs/?project=en.wikipedia.org&namespace=all&limit=50&text=%s&begin=%s c]' | ||
-- %s = IPv4 CIDR range with '/' changed to '%2F' | -- %s = IPv4 CIDR range with '/' changed to '%2F' | ||
-- %s = Start date formatted 'yyyy-mm-dd' | -- %s = Start date formatted 'yyyy-mm-dd' | ||
return string.format(url, encoded, start_date('y-m-d', strings.months)) | return string.format(url, encoded, start_date('y-m-d', strings.months)) | ||
end | end | ||
return '[[Special:Contributions/' .. address .. '| | return '[[Special:Contributions/' .. address .. '|c]]' | ||
end | end | ||
| Line 712: | Line 712: | ||
sumfirst = [=[ | sumfirst = [=[ | ||
|- style="vertical-align: top | |- style="background: darkgray; height: 6px;" | ||
|colspan="5" | | |||
|- style="vertical-align: top;" | |||
|rowspan="%s" |%s ||%s ||%d ||%s ||%s]=], | |rowspan="%s" |%s ||%s ||%d ||%s ||%s]=], | ||
-- %s = string of number of ranges in summary (number of rows) | -- %s = string of number of ranges in summary (number of rows) | ||
| Line 811: | Line 813: | ||
lines:add('') | lines:add('') | ||
end | end | ||
lines:add('') -- this blank line is replaced with a heading | |||
local heading_line = lines.n | |||
local duplicates = Collection.new() | local duplicates = Collection.new() | ||
local previous | local previous | ||
| Line 836: | Line 835: | ||
end | end | ||
end | end | ||
local heading_text = string.format(' | local heading_text = string.format('Sorted %d %s address%s', | ||
iplist.n, | iplist.n, | ||
iplist.ipname, | iplist.ipname, | ||
iplist.n == 1 and '' or 'es' | iplist.n == 1 and '' or 'es' | ||
) | ) | ||
lines[heading_line] = heading_text .. duplicate_text .. ':' | |||
local strings = iplist.want_plain and plaintext or wikitable | local strings = iplist.want_plain and plaintext or wikitable | ||
strings.notes = nil -- needed when module is kept loaded for multiple tests | strings.notes = nil -- needed when module is kept loaded for multiple tests | ||
| Line 967: | Line 964: | ||
local comment = options.comment | local comment = options.comment | ||
if not (comment and line:sub(1, #comment) == comment) then | if not (comment and line:sub(1, #comment) == comment) then | ||
-- Replace accepted delimiters with a space. | |||
line = line:gsub('[!"#&\'()+,%-;<=>?[%]_{|}]', ' ') | |||
extract_ipv4(v4list, v4omitted, line) | extract_ipv4(v4list, v4omitted, line) | ||
extract_ipv6(v6list, v6omitted, line) | extract_ipv6(v6list, v6omitted, line) | ||
| Line 987: | Line 980: | ||
-- 1: Commented out April 2016 as expired. | -- 1: Commented out April 2016 as expired. | ||
-- 1: lines:add("'''Please see [[Template talk:Blockcalc#Version February 2016|this announcement]].'''") | -- 1: lines:add("'''Please see [[Template talk:Blockcalc#Version February 2016|this announcement]].'''") | ||
lines:add("'''By default, links now use [[Special:Contributions]] per [[Template talk:IP range calculator#Version November 2017|this announcement]].'''") | |||
end | end | ||
process_ips(lines, v4list, v4omitted) | process_ips(lines, v4list, v4omitted) | ||
| Line 1,006: | Line 998: | ||
end | end | ||
return { IPblock = IPblock, _IPblock = _IPblock } | |||
return { | |||
} | |||