Difference between revisions of "Module:Navbox"

From Taskman Wiki
Jump to navigation Jump to search
m
m
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
function p.navbox(frame)
 
function p.navbox(frame)
 
   local args = frame:getParent().args
 
   local args = frame:getParent().args
   local table = '<table class="navbox mw-collapsible'
+
   local table = '<table class="tw-navbox mw-collapsible'
 
   if args.sub then
 
   if args.sub then
     table = table .. "mw-collapsed"
+
     table = table .. " mw-collapsed"
 
   end
 
   end
 
   table = table .. '"><tr>'
 
   table = table .. '"><tr>'
   table = table .. '<th colspan="2" class="navbox-header">' .. args.title .. '</th></tr>'
+
   table = table .. '<th colspan="2" class="tw-navbox-header">' .. args.title .. '</th></tr>'
 
   for i = 1,20 do
 
   for i = 1,20 do
 
     local j = tostring(i)
 
     local j = tostring(i)
Line 14: Line 14:
 
       table = table .. "<tr>"
 
       table = table .. "<tr>"
 
       if args["title"..j] then
 
       if args["title"..j] then
         table = table .. '<td class="navbox-group-title"><p>' .. args["title"..j] .. '</p></td>'
+
         table = table .. '<td class="tw-navbox-group-title"><p>' .. args["title"..j] .. '</p></td>'
         table = table .. '<td class="navbox-group"><p>' .. args["group"..j] .. '</p></td></tr>'
+
         table = table .. '<td class="tw-navbox-group"><p>' .. args["group"..j] .. '</p></td></tr>'
 
       else
 
       else
         table = table .. '<td class="navbox-group" colspan="2"><p>' .. args["group"..j] .. '</p></td></tr>'
+
         table = table .. '<td class="tw-navbox-group" colspan="2"><p>' .. args["group"..j] .. '</p></td></tr>'
 
       end
 
       end
 
     end
 
     end

Latest revision as of 06:16, 20 May 2020

Documentation for this module may be created at Module:Navbox/doc

local p = {};

function p.navbox(frame)
  local args = frame:getParent().args
  local table = '<table class="tw-navbox mw-collapsible'
  if args.sub then
    table = table .. " mw-collapsed"
  end
  table = table .. '"><tr>'
  table = table .. '<th colspan="2" class="tw-navbox-header">' .. args.title .. '</th></tr>'
  for i = 1,20 do
    local j = tostring(i)
    if args["group"..j] then
      table = table .. "<tr>"
      if args["title"..j] then
        table = table .. '<td class="tw-navbox-group-title"><p>' .. args["title"..j] .. '</p></td>'
        table = table .. '<td class="tw-navbox-group"><p>' .. args["group"..j] .. '</p></td></tr>'
      else
        table = table .. '<td class="tw-navbox-group" colspan="2"><p>' .. args["group"..j] .. '</p></td></tr>'
      end
    end
  end
  table = table .. "</table>"
  return table
end

return p