Prints the items in Module:links/data.


local m_str_utils = require("Module:string utilities")

local cp = m_str_utils.codepoint
local insert = table.insert
local is_whitespace = require("Module:Unicode data").is_whitespace
local sorted_pairs = require("Module:table").sortedPairs
local ugsub = m_str_utils.gsub
local ulen = m_str_utils.len

local export = {}

local function make_anchor(text, anchor)
	return '<span id="' .. (anchor or text) .. '">' .. text .. '</span>'
end

function export.show()
	local data		= mw.loadData "Module:links/data"
	local output	= {}
	
	local function process_link_text (link_text)
		-- The basic space character is stripped from link text if there are no
		-- characters surrounding it.
		if ulen(link_text) == 1 and is_whitespace(cp(link_text)) then
			return ("]%s["):format(link_text)
		else
			-- Convert all characters to hexadecimal character entities to
			-- prevent any transformations.
			-- This is pretty much only because HTML comment syntax would not be
			-- displayed otherwise. But who knows what else MediaWiki software
			-- might do.
			return ugsub(
				link_text,
				".",
				function (char)
					local codepoint = cp(char)
					if not is_whitespace(codepoint) then
						return ("&#x%X;"):format(codepoint)
					end
				end)
		end
	end
	
	local function link(term, title)
		local script = require "Module:scripts".findBestScriptWithoutLang(term):getCode()
		if script ~= "None" then
			return ('* <span class="%s">[[Unsupported titles/%s|%s]]</span>'):format(
				script,
				title,
				process_link_text(term))
		else
			return ("* [[Unsupported titles/%s|%s]]"):format(
				title,
				process_link_text(term))
		end
	end
	
	for term, title in sorted_pairs(data.unsupported_titles) do
		insert(output, link(term, title))
	end
	insert(output, 1, "; " .. make_anchor("Unsupported titles") .. ":")
	
	return table.concat(output, "\n")
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:links/print_data&oldid=166259" වෙතින් සම්ප්‍රවේශනය කෙරිණි