Module:Numbered subpages and Module:Numbered subpages/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
No edit summary |
Dreamy Jazz (talk | contribs) test |
||
Line 2: | Line 2: | ||
local getArgs = require('Module:Arguments').getArgs |
local getArgs = require('Module:Arguments').getArgs |
||
local yesno = require('Module:Yesno') |
|||
p = {} |
p = {} |
||
Line 18: | Line 17: | ||
local root = '' |
local root = '' |
||
local missing = args.missing or (args.max and 'transclude' or 'skip') |
local missing = args.missing or (args.max and 'transclude' or 'skip') |
||
local |
local res = '' |
||
local headertemplate = args.headertemplate or '' |
local headertemplate = args.headertemplate or '' |
||
local subpageTemplate = 'Portal subpage' |
|||
if yesno(args.inline) then |
|||
subpageTemplate = 'Portal subpage inline' |
|||
end |
|||
if missing ~= 'transclude' then |
if missing ~= 'transclude' then |
||
root = frame:preprocess('{{FULLPAGENAME}}') |
root = frame:preprocess('{{FULLPAGENAME}}') |
||
end |
end |
||
⚫ | |||
-- Uncomment the following line if we need to limit the total number of subpages |
|||
⚫ | |||
local SPAN = args.SPAN or '' |
|||
local preload = args.preload or '' |
|||
for i=mink,maxk do |
for i=mink,maxk do |
||
if missing == 'transclude' then |
if missing == 'transclude' then |
||
if |
if headertemplateno == '' then |
||
res = res .. frame:expandTemplate{title = 'subpage', args = { i } } |
|||
else |
else |
||
res = res .. frame:expandTemplate{title = 'subpage', args = { i, headertemplate=headertemplate } } |
|||
end |
end |
||
else |
else |
||
if ifexist(root .. '/' .. i) then |
|||
if |
if headertemplateno == '' then |
||
⚫ | |||
if headertemplate == '' then |
|||
⚫ | |||
else |
else |
||
res = res .. frame:expandTemplate{title = 'subpage', args = { i, headertemplate=headertemplate } } |
|||
end |
end |
||
else |
else |
||
if missing == 'link' then |
if missing == 'link' then |
||
⚫ | |||
if preload then |
|||
ret[#ret + 1] = '* ' .. frame:expandTemplate{title = 'edit', args = { subpagename, 'Create ' .. subpagename, preload=preload } } |
|||
else |
|||
⚫ | |||
end |
|||
elseif missing == 'stop' then |
elseif missing == 'stop' then |
||
i = maxk + 1 |
i = maxk + 1 |
||
Line 61: | Line 48: | ||
end |
end |
||
return |
return res |
||
end |
end |
||