Module:Lesson
Documentation for this module may be created at Module:Lesson/doc
function addSubPage(subPages, learningUnit, subPage)
subPages[subPage:lower()] = learningUnit.."/"..subPage
return subPages
end
function generateUrlsForSubPages(learningUnit)
subPages = {}
subPages = addSubPage(subPages, learningUnit, "Video")
subPages = addSubPage(subPages, learningUnit, "Script")
subPages = addSubPage(subPages, learningUnit, "Quiz")
subPages = addSubPage(subPages, learningUnit, "Further_Reading")
return subPages
end
local p = {}
function p.learningunit(frame)
-- can someone plese tell me how I can pass those arcitles as an argument? I am not able to do this
local learningUnits = {"Topic:Web_Science/Part1:_Foundations_of_the_web/Web_Architecture/Dynamic_Web_Content/Basics_of_server_side_web_programming","Topic:Web_Science/Part1:_Foundations_of_the_web/Web_Architecture/Dynamic_Web_Content/Forms_and_HTTP_Post_request", n=3}
title = mw.title.getCurrentTitle().prefixedText
title = mw.title.new(title)
page_text = title:getContent()
learningUnits = mw.text.split(page_text,"* ")
--output = output .. page_text
output = "<pre>" .. mw.title.getCurrentTitle().prefixedText .."\n"
for i,learningUnit in ipairs(learningUnits) do
local subPages = generateUrlsForSubPages(learningUnit)
output = output .. learningUnit .. "\n"
for key,subPage in pairs(subPages) do
output = output .. " " .. subPage .. "\n"
end
end
-- title = mw.title.new(mw.title.getCurrentTitle().prefixedText)
-- output = output .. mw.title:getContent()
return output .. "</pre>"
end
return p