Difference between revisions of "Module:Changes"

From Industrial-Craft-Wiki
Jump to navigation Jump to search
m (Maybe this adds the extra space)
m (Just a bit of rebuilding)
Line 1: Line 1:
local p = {}
local p = {}


-- Changes
-- Generate list
function p.changes( f )
function p.list( args )
   local groups = {}
   local groups = {}
   local s = nil
   local s = nil
   local n = 1
   local n = 1
 
   local back = "Arguments <br/><ul>"
   if f == mw.getCurrentFrame() then
      args = f:getParent().args
  end


   repeat s = args["change" .. n]
   repeat s = args["change" .. n]
       if s ~= nil then
       if s ~= nil then
         groups[n] = "<li>" .. s -- .. "</li>"
         --groups[n] = "<li>" .. s -- .. "</li>"
        back = back .. "<li>" .. s .. "</li>"
         n = n + 1
         n = n + 1
       end
       end
   until s == nil
   until s == nil


   local back = "Arguments <br/><ul>"
   --for key,value in pairs(groups) do  
  for key,value in pairs(groups) do  
  --  back = back .. value .. "<br/>"
      back = back .. value .. "<br/>"
  --end
  return back .. "</ul>"
end
 
function p.changes( f )
  if f == mw.getCurrentFrame() then
      args = f:getParent().args
   end
   end
   return back .. "</ul>"
   return p.link(args)
end
end


return p
return p

Revision as of 18:24, 10 February 2015

Template-info.png Documentation

Replacement Lua scripting to do what Template:Changes does/did, but in a more flexible way.

  • It supports the new structure of Version History.
  • It can have as many changes as needed, providing that they go up sequencially, and numbers are not missed out (change1, change2, change3 is ok, but change1, change3 isn't).
  • It should be faster.

Message me (Chocohead) either on the wiki (here) or on the Forum if you find any problems.

The above documentation is transcluded from Module:Changes/doc. (edit | history)


local p = {}

-- Generate list
function p.list( args )
   local groups = {}
   local s = nil
   local n = 1
   local back = "Arguments <br/><ul>"

   repeat s = args["change" .. n]
      if s ~= nil then
         --groups[n] = "<li>" .. s -- .. "</li>"
         back = back .. "<li>" .. s .. "</li>"
         n = n + 1
      end
   until s == nil

   --for key,value in pairs(groups) do 
   --   back = back .. value .. "<br/>"
   --end
   return back .. "</ul>"
end

function p.changes( f )
   if f == mw.getCurrentFrame() then
       args = f:getParent().args
   end
   return p.link(args)
end

return p