跳转到内容

Module:If vertical

維基文庫,自由的圖書館
文档图示 模块文档[创建]
require('strict')

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs

function p.main(frame)
	local args = getArgs(frame, {
		removeBlanks = false,
		parentFirst = true
	})
	return p._main(args)
end

-- the main function
function p._main(args)
	local page_title = mw.title.getCurrentTitle()
	local title_text = page_title.rootText
	local text = ''
	if page_title:inNamespace(104) or mw.ustring.match(title_text, '直排' ) then
		text = args[1]
	else
		text = args[2]
	end
	return text
end

return p