Module:Listing: Difference between revisions

Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
add Listbox class to be inherited by Navbox and Galbox
(replaced mw.text.gsplit with a much more performant implementation so things are snappy now)
(add Listbox class to be inherited by Navbox and Galbox)
Line 1: Line 1:
local p = {}
local Args = require( 'Module:Args' )
local Box = require( 'Module:Box' ).Box


-- got this from http://lua-users.org/wiki/SplitJoin
-- got this from http://lua-users.org/wiki/SplitJoin
Line 22: Line 23:
   end
   end
end
end
local Listbox = Box.new()
Listbox.__index = Listbox
setmetatable( Listbox, Box )
function Listbox.new( args )
  local subject = args[1] .. ' ' .. args[2]
  args.class = 'navbox'
  args.title = '[[' .. subject .. ']]'
  args.edit = subject
  args.hide = args.hide or 'show'
  local obj = Box.new( 'light', args )
  obj.subject = subject
  obj.categories = { args[1], subject, args[2] }
  return setmetatable( obj, Listbox )
end
local p = {}
p.Listbox = Listbox


function p._parseListing( pageName, pageContent )
function p._parseListing( pageName, pageContent )

Navigation menu