Module:TestModule: Difference between revisions
AdamZachar (talk | contribs) No edit summary |
AdamZachar (talk | contribs) No edit summary |
||
| Line 34: | Line 34: | ||
end | end | ||
function funcRecurseLineageNumber(parentID) | |||
--Check for children of the parent topic | |||
local output = "" | |||
local topics, errors = mw.ext.externaldata.getExternalData { | |||
source = "CaseData", | |||
query = "childrenTopicsByID", | |||
data = "topicName=topic_name, topicID=topic_id", | |||
parameters = parentID | |||
} | |||
--If there are children topics, start a new layer of the list | |||
if topics ~= nil then | |||
output = output .. "<ul>" | |||
--For each child topic, add them as a list item, and check for their children | |||
for i, topic in ipairs(topics) do | |||
output = output .. " <li>" .. "[[" .. topic.topicName .. "]]" | |||
output = output .. funcRecurseLineage(topic.topicID) | |||
end | |||
output = output .. "</ul>" | |||
end | |||
return output | |||
end | |||
function p.recurseLineageNumber( frame ) | |||
return funcRecurseLineageNumber(frame.args.parentID) | |||
end | |||
return p | return p | ||