From [N8]
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Module:Tooltip/doc. [edit] [purge]
Module:Tooltip's function div is invoked by Template:Tooltip text.
Module:Tooltip's function span is invoked by Template:Tooltip.
Module:Tooltip requires Module:Paramtest.
Module:Tooltip requires Module:Yesno.
Module:Tooltip is required by Module:DependencyList.
Module:Tooltip is required by Module:Helper module.

Place {{No documentation}} at the top of the documentation page.

This template should be used when there is no documentation for a Module. The template will attempt to auto detect and link the require()/mw.loadData() depedency list. If you want to supress the auto generated dependency list, use {{No documentation|DependencyList=no}}

local p = {}

local yn = require('Module:Yesno')
local hc = require('Module:Paramtest').has_content

-- module access point for div
p._div = function(args)
	local name =
	if not hc(name) then
		error('Name is required!')
	local content = args.content
	local hasarrow = yn(args.arrow or 'yes', true)
	local arrowsize = tonumber(args.arrowsize) or 10
	local limitwidthbool = yn(args.limitwidth or 'yes', true)
	local style =
	local div = mw.html.create('div')
	local arrow = 'no'
	if hasarrow then
		arrow = 'yes'
	local limitwidth = 'no'
	if limitwidthbool then
		limitwidth = 'yes'
	local attrs = {
		['data-tooltip-for'] = name,
		['data-tooltip-arrow'] = arrow,
		['data-tooltip-arrow-size'] = arrowsize,
		['data-tooltip-limit-width'] = limitwidth,
	if hc(style) then
		attrs['data-tooltip-style'] = style
	div	:addClass('hidden js-tooltip-wrapper')
		:css('display', 'none')
	return div

p._span = function(args)
	local name = or args[1] or nil
	if not hc(name) then
		error('Name is required!')
	local alt = args.alt or args[2] or '?'
	local span = mw.html.create('span')
	span:addClass('hidden js-tooltip-click')
		:css('display', 'none')
		:attr('data-tooltip-name', name)
	return span

-- template access points
p.div = function(frame)
	return p._div(frame:getParent().args)
p.span = function(frame)
	return p._span(frame:getParent().args)

return p