Module:Hatnote

Revision as of 12:38, 19 July 2024 by Ricewind (talk | contribs) (Created page with "local p = {} -- Produces standard hatnote text -- function p.hatnote(frame) local args = frame:getParent().args local s = args[1] if not s then return '<strong class="error">No text specified for hatnote</strong>' end return p._hatnote(s) end function p._hatnote(s) local hatnote = mw.html.create('div') hatnote:wikitext(s) :addClass('navigation-not-searchable') :css('margin', '0.5em 2em 1em 2em') :css(...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Generates hatnotes. Currently used within Template:Otheruses.


local p = {}

-- Produces standard hatnote text                                             --
function p.hatnote(frame)
	local args = frame:getParent().args
	local s = args[1]
	if not s then
		return '<strong class="error">No text specified for hatnote</strong>'
	end
	return p._hatnote(s)
end

function p._hatnote(s)
	local hatnote = mw.html.create('div')

	hatnote:wikitext(s)
		   :addClass('navigation-not-searchable')
		   :css('margin', '0.5em 2em 1em 2em')
		   :css('font-style', 'italic')

	return tostring(hatnote)
end

return p