Module:Hatnote: Difference between revisions
Jump to navigation
Jump to search
add Template:Details
>Mr. Stradivarius (make a start on a module for making hatnotes) |
>Mr. Stradivarius (add Template:Details) |
||
Line 124: | Line 124: | ||
p.rellink = makeInvokeFunction(f.rellink) | p.rellink = makeInvokeFunction(f.rellink) | ||
-------------------------------------------------------------------------------- | |||
-- Details | |||
-- | |||
-- Produces a "For more details on this topic" link. the first parameter is the | |||
-- page linked to, and if the second parameter is present it is used instead | |||
-- of the "this topic" text. | |||
-------------------------------------------------------------------------------- | |||
function p._details(page, topic) | |||
page = formatLink(page) | |||
topic = topic or 'this topic' | |||
local text = string.format('For more details on %s, see %s.', topic, page) | |||
local extraclasses = 'boilerplate seealso' | |||
return p._rellink(text, extraclasses) | |||
end | |||
function f.details(args) | |||
local page = args[1] | |||
local topic = args[2] | |||
if not page then | |||
return makeWikitextError('no page specified') | |||
end | |||
return p._details(page, topic) | |||
end | |||
p.details = makeInvokeFunction(f.details) | |||
return p | return p |