Module:Hatnote: Difference between revisions
From Melvor Idle
No edit summary |
(Use class for styling) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
-- Produces standard hatnote text -- | -- Produces standard hatnote text -- | ||
function p.hatnote(frame) | function p.hatnote(frame) | ||
local args = frame:getParent().args | local args = frame.args or frame:getParent().args | ||
local s = args | local s = args[1] | ||
if not s then | if not s then | ||
return '<strong class="error">No text specified for hatnote</strong>' | return '<strong class="error">No text specified for hatnote</strong>' | ||
Line 15: | Line 15: | ||
hatnote:wikitext(s) | hatnote:wikitext(s) | ||
:addClass('navigation-not-searchable | :addClass('navigation-not-searchable hatnote') | ||
return tostring(hatnote) | return tostring(hatnote) |
Latest revision as of 21:10, 10 November 2024
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