Module:Hatnote inline: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(starting with fresh copy of code from Module:Hatnote) |
(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 -- |
||
-- implements the {{hatnote |
-- 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 |
|||
-- Hatnote |
|||
-- |
-- |
||
-- Produces standard hatnote text |
-- 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 |