Jump to content

Module:zh-dial-syn/check-presence

Wiktionary වෙතින්



local export = {}
local find = mw.ustring.find
local gsub = mw.ustring.gsub
local m_list = require("Module:zh-dial-syn/check-presence/list").list

function export.make(frame)
	local result = { "The list of entries without a <code>{{[[Template:zh-dial|zh-dial]]}}</code> template but listed on various [[Module:zh/data/dial-syn]] pages:" }
	local i = 1
	local done = {}
	local break_all = false
	for _, item in ipairs(m_list) do
		for loc, terms in pairs(require("Module:zh/data/dial-syn/" .. item).list) do
			if type(terms) == "table" then
				for _, term in ipairs(terms) do
					term = term:match("([^:]+)")
					if term and not find(term, "[%[%]]") then
						if not done[term] and find(term, "[一-鿿㐀-䶿﨎﨏﨑﨓﨔﨟﨡﨣﨤﨧-﨩]") then
							local content = mw.title.new(term):getContent() or false
							if content and not content:find("{{zh-dial}}", 1, true) and not content:find("{{zh-dial|" .. item .. "}}", 1, true) then
								result[i] = "* <span class=\"Hani\">[[" .. term .. "]]</span> missing <code>{{[[Module:zh/data/dial-syn/" .. item .. "|zh-dial" ..
									(term == item and "" or "|" .. item) .. "]]}}</code>"
								i = i + 1
								if i >= 800 then
									break_all = true
									break
								end
							end
						end
						
						done[term] = true
					end
				end
			end
			if break_all then
				break
			end
		end
		if break_all then
			break
		end
	end
	return table.concat(result, "\n")
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:zh-dial-syn/check-presence&oldid=82044" වෙතින් සම්ප්‍රවේශනය කෙරිණි