Module:User:Wyang/compare

This is a private module sandbox of Wyang, for their own experimentation. Items in this module may be added and removed at Wyang's discretion; do not rely on this module's stability.


local export = {}

function export.make(frame)
	local args = frame:getParent().args
	local word, translit = args[1], args[2]
	if not mw.ustring.match(word, "[%[%]]") and mw.title.new(word).exists then
		content = mw.title.new(word):getContent()
		_, count = mw.ustring.gsub(content, "{{th%-pron[}%|]", "")
		if count == 1 then
			return ""
		end
	end
	return "|tr=" .. translit
end

function export.make2(frame)
	local m_ko_translit = require("Module:ko-translit").tr
	local args = frame:getParent().args
	local word, translit = args[1], args[2]
	return m_ko_translit(word) == translit and "" or "|tr=" .. translit
end

return export