Module:Hatnote

From Melvor Idle
Revision as of 21:10, 10 November 2024 by Auron956 (talk | contribs) (Use class for styling)
(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.args or 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 hatnote')

	return tostring(hatnote)
end

return p