Mô đun:Hatnote inline

Từ Từ điển tri thức Hội Thánh của Đức Chúa Trời
Bước tới điều hướng Bước tới tìm kiếm

Có thể viết tài liệu về mô đun này tại Mô đun:Hatnote inline/tài liệu.

--------------------------------------------------------------------------------
--                              Mô đun:Hatnote-inline                         --
--                                                                            --
-- This module produces hatnote-style links and links to related articles,    --
-- but inside a <span>, instead of the <div> used by Mô đun:Hatnote.  It      --
-- implements the {{hatnote-inline}} meta-template.                           --
--------------------------------------------------------------------------------

local mHatnote = require('Mô đun:Hatnote')
local mArguments = require('Mô đun:Arguments')
local yesno = require('Mô đun:Yesno')
local p = {}

function p.hatnoteInline (frame)
	local args = mArguments.getArgs(frame)
	local hatnote = mHatnote.hatnote(frame)
	if args.inline == nil or yesno(args.inline, true) then
		local subs = {
			['^<div'] = '<span',
			['</div>$'] = '</span>'
		}
		for k, v in pairs(subs) do hatnote = string.gsub(hatnote, k, v) end
	end
	return hatnote
end

p.hatnote = p.hatnoteInline --alias

return p