Feed The Beast Wiki

Follow the Feed The Beast Wiki on Discord or Mastodon!

READ MORE

Feed The Beast Wiki
(Use Scribunto's builtin html library (fixed))
mNo edit summary
(One intermediate revision by the same user not shown)
Line 16: Line 16:
 
entry = args[1] .. ":" .. args[2]
 
entry = args[1] .. ":" .. args[2]
 
args[1] = entry
 
args[1] = entry
table.remove(args, 2)
+
if not args.stack then
  +
table.remove(args, 2)
  +
end
 
else
 
else
 
entry = args[1]
 
entry = args[1]
 
end
 
end
 
 
  +
if args.stack then
  +
args[2] = args.stack
  +
end
   
 
-- if no entry was provided, return a blank cell
 
-- if no entry was provided, return a blank cell

Revision as of 02:44, 1 December 2020

Template-info Documentation

This module implements {{G/O}}

Dependencies

Categories

This module adds Category:Pages using the 2nd oredict parameter as stack size to the page if it uses the second parameter as the quantity of items.


local p = {}

p.entries = function(f)
	local args = f.args or f
	
	if f == mw.getCurrentFrame() and args[1] == nil then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	
	args = require([[Module:ProcessArgs]]).norm(args)
	local noAnim = args["no-anim"] -- copy of the "no-anim" arg, as we will erase it later
	local entry
	if args[2] then
		entry = args[1] .. ":" .. args[2]
		args[1] = entry
		if not args.stack then
			table.remove(args, 2)
		end
	else
		entry = args[1]
	end
	
	if args.stack then
		args[2] = args.stack
	end

	-- if no entry was provided, return a blank cell
	if not entry then
		return require([[Module:Grid]]).cell({})
	end
	args["no-anim"] = nil
	
	args["dis"] = "false" -- Disables disambiguation
	
	if args.shuffle then
		args.shuffle = "1"
	end
	
	args.tag = "1"
	
	local output = f:callParserFunction("#dict", args)

	-- wrap the output in span tags if we should be animated
	-- animation is disabled by either the parameter or a variable passed by [[Template:N]]
	if not noAnim and f:callParserFunction("#var", "n-animated") == "" then
		output = tostring(mw.html.create('span')
			:addClass('animated')
			:addClass('random')
			:wikitext(output))
	end

	return output
end

return p