Module:Correct typos in one click navigation
AboutEdit
This is the module of {{Correct typos in one click navigation}}, and should only be called from its template.
local p = {}
function p.nav(frame)
local wt_subp = '{| class="wikitable plainrowheaders" style="text-align: center;"\n|-\n'..
'! scope="row" | Subpage:'
local wt_typos = '! scope="row" | Typos:'
local h2_regex = '[\r\n]==%s*%[%[[^\r\n]+%]%]%s*=='
local i, sum = 0, 0
while i < 20 do
i = i + 1
local ele
local ele_grey = '<span style="color:#888">'..i..'</span>'
local subpi = 'Wikipedia:Correct typos in one click/'..i
local subpi_content = mw.title.new(subpi, 4):getContent() --project space
local dummy, n = mw.ustring.gsub(subpi_content, h2_regex, '%0')
if n > 0 then
sum = sum + n
ele = '[['..subpi..'|'..i..']]'
n = '[['..subpi..'#footer|'..n..']]'
else
ele = ele_grey
n = ''
end
wt_subp = wt_subp..'\n| '..ele
wt_typos = wt_typos..'\n| '..n
end
wt_subp = wt_subp..'\n| '..'Sum'
wt_typos = wt_typos..'\n| '..sum
return wt_subp..'\n|-\n'..wt_typos..'\n|}'
end
return p