Module:Nav: Difference between revisions
From Guild of Archivists
mNo edit summary |
m (1 revision imported) |
Latest revision as of 07:26, 30 October 2015
Documentation for this module may be created at Module:Nav/doc
local p = {}
function core(list, page, r_position)
require('Module:list');
processList = getListOfChaptersFromText(list);
current = -1;
i=0;
for i=0, #processList do
if page == processList[i] then
current = i;
break;
end
end
if current == -1 then
result = page;
else
result = processList[current + r_position ];
end
return result;
end
function p.nav(frame)
list = frame:preprocess('{{:'..frame.args['list']..'}}');
page = frame.args['page'];
r_position = frame.args['relative-position'];
return core(list, page, r_position);
end
return p;