Line 7: |
Line 7: |
| local remiLib = require("Module:RemiLib") | | local remiLib = require("Module:RemiLib") |
| | | |
− | function p.renderBranchingTable(graph) | + | function p.renderBranchingTable(graph, collapsed) |
| local body = mw.html.create("table") | | local body = mw.html.create("table") |
− | body:addClass("wikitable") | + | body |
| + | :addClass("wikitable") |
| + | :addClass("mw-collapsible") |
| + | :css("width","300px") |
| + | if collapsed then |
| + | body:addClass("mw-collapsed") |
| + | end |
| + | |
| local titleRow = mw.html.create("tr") | | local titleRow = mw.html.create("tr") |
| local th = mw.html.create("th") | | local th = mw.html.create("th") |
| th | | th |
| :attr("colspan",3) -- "from" node, "to" node, requirement text | | :attr("colspan",3) -- "from" node, "to" node, requirement text |
− | :wikitext("Branching Rules for Maps") | + | :wikitext("Branching Rules") |
| :css("font-weight","bold") | | :css("font-weight","bold") |
| :css("text-align","center") | | :css("text-align","center") |
Line 93: |
Line 100: |
| -- implementing graph as an adjacency list | | -- implementing graph as an adjacency list |
| local mapGraph = {} | | local mapGraph = {} |
| + | local collapsed = true |
| + | if frame.args["collapsed"] ~= nil and string.lower(frame.args["collapsed"]) == "false" then |
| + | collapsed = false |
| + | end |
| | | |
| for param,value in pairs(frame.args) do | | for param,value in pairs(frame.args) do |
Line 110: |
Line 121: |
| end | | end |
| end | | end |
− | local html = p.renderBranchingTable(mapGraph) | + | local html = p.renderBranchingTable(mapGraph,collapsed) |
| | | |
| return html | | return html |