Jump to content

Module:Sandbox/Dat Hack3r: Difference between revisions

Dat Hack3r (talk | contribs)
Accounted for namespaces.
Dat Hack3r (talk | contribs)
Changed global variables to local variables.
Line 8: Line 8:
text_format = text_format or '%d'
text_format = text_format or '%d'
if title_format then
if title_format then
curr_num = string.match(title, string.gsub(title_format, "%%d", "(%%d+)"))
local curr_num = string.match(title, string.gsub(title_format, "%%d", "(%%d+)"))
else
else
curr_num = string.match(title, '%d+')
local curr_num = string.match(title, '%d+')
end
end


Line 26: Line 26:
end
end


templatestyles = mw.getCurrentFrame():extensionTag{
local templatestyles = mw.getCurrentFrame():extensionTag{
name = "templatestyles",
name = "templatestyles",
args = {src = 'Module:Series navigation/styles.css'}
args = {src = 'Module:Series navigation/styles.css'}
Line 34: Line 34:


function p.main(frame)
function p.main(frame)
s_start      = frame:getParent().args['start'] or 1
local s_start      = frame:getParent().args['start'] or 1
s_end        = frame:getParent().args['end']
local s_end        = frame:getParent().args['end']
increment    = frame:getParent().args['increment'] or 1
local increment    = frame:getParent().args['increment'] or 1
title        = mw.title.getCurrentTitle()
local title        = mw.title.getCurrentTitle()
title_format = frame:getParent().args['title_format']
local title_format = frame:getParent().args['title_format']
text_format  = frame:getParent().args['text_format']
local text_format  = frame:getParent().args['text_format']
return p._main(s_start, s_end, increment, title, title_format, text_format)
return p._main(s_start, s_end, increment, title, title_format, text_format)
end
end


return p
return p