Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
NewsWikiTestbed
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:TestModule
Module
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
Refresh
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function funcRecurseLineage(parentTopic) --Check for children of the parent topic local output = "" local topics, errors = mw.ext.externaldata.getExternalData { source = "CaseData", query = "childrenTopics", data = "topicName=topic_name", parameters = parentTopic } --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.topicName) end output = output .. "</ul>" end return output end function p.recurseLineage( frame ) return funcRecurseLineage(frame.args.parentTopic) 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 .. funcRecurseLineageNumber(topic.topicID) end output = output .. "</ul>" end return output end function p.recurseLineageByID( frame ) local topics, errors = mw.ext.externaldata.getExternalData { source = "CaseData", query = "childrenTopicsByID", data = "topicName=topic_name, topicID=topic_id", parameters = frame.args.parentID } if topics == nil then return "N/A" end return funcRecurseLineageNumber(frame.args.parentID) end function p.topicIDByName( frame ) local topics, errors = mw.ext.externaldata.getExternalData { source = "CaseData", query = "oneTopic", data = "topicID=topic_id", parameters = frame.args.topicName } if topics == nil then return 0 end return topics.topicID end return p
Summary:
Please note that all contributions to NewsWikiTestbed may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
NewsWikiTestbed:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:TestModule/doc
(
edit
)