Module:Hatnote inline: Difference between revisions
changing to inline version with span
m>SMcCandlish (starting with fresh copy of code from Module:Hatnote) |
m>SMcCandlish (changing to inline version with span) |
||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- Module:Hatnote-inline -- | ||
-- -- | -- -- | ||
-- This module produces hatnote | -- This module produces inline hatnote (i.e. cross-reference) notes and links -- | ||
-- to related articles. It implements the {{hatnote-inline}} meta-templates, -- | |||
-- includes helper functions for other Lua hatnote modules | -- and includes helper functions for other Lua hatnote modules (for now) -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 166: | Line 166: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- HatnoteInline | ||
-- | -- | ||
-- Produces standard hatnote text. Implements the {{hatnote}} template. | -- Produces standard inline hatnote text. | ||
-- Implements the {{hatnote-inline}} template. | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
function p. | function p.hatnoteInline(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local s = args[1] | local s = args[1] | ||
Line 178: | Line 179: | ||
return p.makeWikitextError( | return p.makeWikitextError( | ||
'no text specified', | 'no text specified', | ||
'Template:Hatnote#Errors', | 'Template:Hatnote-inline#Errors', | ||
args.category | args.category | ||
) | ) | ||
Line 184: | Line 185: | ||
options.extraclasses = args.extraclasses | options.extraclasses = args.extraclasses | ||
options.selfref = args.selfref | options.selfref = args.selfref | ||
return p. | return p._hatnoteInline(s, options) | ||
end | end | ||
function p. | function p._hatnoteInline(s, options) | ||
checkType(' | checkType('_hatnoteInline', 1, s, 'string') | ||
checkType(' | checkType('_hatnoteInline', 2, options, 'table', true) | ||
local classes = {'hatnote'} | local classes = {'hatnote-inline'} | ||
local extraclasses = options.extraclasses | local extraclasses = options.extraclasses | ||
local selfref = options.selfref | local selfref = options.selfref | ||
Line 200: | Line 201: | ||
end | end | ||
return string.format( | return string.format( | ||
'< | '<span class="%s">%s</span>', | ||
table.concat(classes, ' '), | table.concat(classes, ' '), | ||
s | s |