Mô đun:Hatnote inline

Từ Từ điển tri thức Hội Thánh của Đức Chúa Trời
Phiên bản vào lúc 02:43, ngày 23 tháng 6 năm 2023 của Pyc1948 (thảo luận | đóng góp) (Tạo trang mới với nội dung “-------------------------------------------------------------------------------- -- 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-tem…”)
(khác) ← Phiên bản cũ | Phiên bản mới nhất (khác) | Phiên bản mới → (khác)
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