Jump to content

Module:Hatnote inline/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Izno (talk | contribs) at 21:50, 12 July 2021 (borrow some code from the frame version in module:hatnote to clean this up a bit). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
--------------------------------------------------------------------------------
--                              Module:Hatnote-inline                         --
--                                                                            --
-- This module produces hatnote-style links, and links to related articles,	  --
-- but inside a <span>, instead of the <div> used by Module:Hatnote.  It      --
-- implements the {{hatnote-inline}} meta-template.                           --
--------------------------------------------------------------------------------

local mHatnote = require('Module:Hatnote')
local mArguments = require('Module:Arguments')
local yesno = require('Module:Yesno')
local p = {}

function p.hatnoteInline (frame)
	local args = mArguments.getArgs(frame)
	local s = args[1]
	if not s then
		return p.makeWikitextError(
			'no text specified',
			'Template:Hatnote#Errors',
			args.category
		)
	end
	local options = {
		extraclasses = args.extraclasses,
		selfref = args.selfref,
		inline = 0
	}
	
	if args.inline == nil or yesno(args.inline, true) then
		options.inline = 1
	end
	
	return mHatnote._hatnote(s, options)
end

p.hatnote = p.hatnoteInline --alias

return p