跳转到内容

模組:HumorDistinguish

维基百科,自由的百科全书
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local ifmobile = require('Module:If mobile')
local mTableTools --initialize lazily
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}

function p.distinguish(frame)
	mArguments = require('Module:Arguments')
	mTableTools = require('Module:TableTools')
	local args = mArguments.getArgs(frame)
	local selfref = args.selfref
	local text = args.text
	args = mTableTools.compressSparseArray(args)
	return p._distinguish(args, text, selfref)
end

function p._distinguish(args, text, selfref)
	checkType("_distinguish", 1, args, 'table')
	if #args == 0 and not text then return '' end
	local image = '[[File:Confusion humor.svg|24px|link=|alt=]]'
	local mobview = ifmobile._main({nil, '  '})
	local text = string.format(
		"'''餵雞溫馨提示''':各位幽默感缺失的編者,此處有對應的正常版本「''%s''」以供食用。",
		text or mHatlist.orList(args, true, true)
	)
	text = image .. mobview .. text
	hnOptions = {selfref = selfref}
	return mHatnote._hatnote(text, hnOptions)
end

function p.manylink(frame)
	mArguments = require('Module:Arguments')
	mTableTools = require('Module:TableTools')
	local args = mArguments.getArgs(frame)
	local selfref = args.selfref
	local text = args.text
	args = mTableTools.compressSparseArray(args)
	return p._manylink(args, text, selfref)
end

function p._manylink(args, text, selfref)
	checkType("_distinguish", 1, args, 'table')
	if #args == 0 and not text then return '' end
	local image = '[[File:Confusion humor.svg|24px|link=|alt=]]'
	local mobview = ifmobile._main({nil, '  '})
	local text = string.format(
		"'''[[維基百科|餵雞]][[溫馨]][[提示]]'''[[:]][[各位]][[Wikipedia:坏笑话和删除的胡话|幽默]][[感]][[缺]][[失的]][[編者]][[,]][[此處]][[有對應]][[的]][[正]][[常]][[版本]][[「]]''%s''[[」]][[以]][[供食用]][[。]]",
		text or mHatlist.orList(args, true, true)
	)
	text = image .. mobview .. text
	hnOptions = {selfref = selfref}
	return mHatnote._hatnote(text, hnOptions)
end

function p.humor2(frame)
	mArguments = require('Module:Arguments')
	mTableTools = require('Module:TableTools')
	local args = mArguments.getArgs(frame)
	local selfref = args.selfref
	local text = args.text
	args = mTableTools.compressSparseArray(args)
	return p._humor2(args, text, selfref)
end

function p._humor2(args, text, selfref)
	checkType("_distinguish", 1, args, 'table')
	if #args == 0 and not text then return '' end
	local image = '[[File:Confusion humor.svg|24px|link=|alt=]]'
	local mobview = ifmobile._main({nil, '  '})
	local text = string.format(
		"'''餵雞溫馨提示''':各位幽默感缺失的編者,本"..mw.getCurrentFrame():expandTemplate{title = "NS1",}.."的主题不是''%s''。",
		text or mHatlist.orList(args, true, true)
	)
	text = image .. mobview .. text
	hnOptions = {selfref = selfref}
	return mHatnote._hatnote(text, hnOptions)
end

function p.rest(frame)
	mArguments = require('Module:Arguments')
	mTableTools = require('Module:TableTools')
	local args = mArguments.getArgs(frame)
	local selfref = args.selfref
	local text = args.text
	args = mTableTools.compressSparseArray(args)
	return p._rest(args, text, selfref)
end

function p._rest(args, text, selfref)
	checkType("_distinguish", 1, args, 'table')
	if #args == 0 and not text then return '' end
	local image = '[[File:Confusion humor.svg|24px|link=|alt=]]'
	local mobview = ifmobile._main({nil, '  '})
	local text = string.format(
		"'''餵雞溫馨提示''':各位幽默感缺失的編者,本"..mw.getCurrentFrame():expandTemplate{title = "NS1",}.."的主题不是"..mw.getCurrentFrame():expandTemplate{title = "kidding", args = {"''%s''"}}.."。",
		text or mHatlist.orList(args, true, true)
	)
	text = image .. mobview .. text
	hnOptions = {selfref = selfref}
	return mHatnote._hatnote(text, hnOptions)
end

return p