<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://youjo.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ALabels</id>
	<title>Module:Labels - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://youjo.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ALabels"/>
	<link rel="alternate" type="text/html" href="https://youjo.wiki/index.php?title=Module:Labels&amp;action=history"/>
	<updated>2026-10-17T17:54:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://youjo.wiki/index.php?title=Module:Labels&amp;diff=1414&amp;oldid=prev</id>
		<title>Chizu: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://youjo.wiki/index.php?title=Module:Labels&amp;diff=1414&amp;oldid=prev"/>
		<updated>2022-09-23T19:42:07Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:42, 23 September 2022&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key youjowiki:diff::1.12:old-1413:rev-1414 --&gt;
&lt;/table&gt;</summary>
		<author><name>Chizu</name></author>
	</entry>
	<entry>
		<id>https://youjo.wiki/index.php?title=Module:Labels&amp;diff=1413&amp;oldid=prev</id>
		<title>Wiktionary&gt;Surjection at 21:32, 23 January 2022</title>
		<link rel="alternate" type="text/html" href="https://youjo.wiki/index.php?title=Module:Labels&amp;diff=1413&amp;oldid=prev"/>
		<updated>2022-01-23T21:32:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local m_labeldata = mw.loadData(&amp;quot;Module:labels/data&amp;quot;)&lt;br /&gt;
--local m_links = require(&amp;quot;Module:links&amp;quot;) unused&lt;br /&gt;
&lt;br /&gt;
local m_utilities_format_categories = require(&amp;quot;Module:utilities/format_categories&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local export = {}&lt;br /&gt;
&lt;br /&gt;
-- for testing&lt;br /&gt;
local force_cat = false&lt;br /&gt;
&lt;br /&gt;
local function show_categories(data, lang, script, sort_key, script2, sort_key2, term_mode)&lt;br /&gt;
	local categories = {}&lt;br /&gt;
	local categories2 = {}&lt;br /&gt;
	&lt;br /&gt;
	local lang_code = lang:getCode()&lt;br /&gt;
	local canonical_name = lang:getCanonicalName()&lt;br /&gt;
	&lt;br /&gt;
	local topical_categories = data.topical_categories or {}&lt;br /&gt;
	local sense_categories = data.sense_categories or {}&lt;br /&gt;
	local pos_categories = data.pos_categories or {}&lt;br /&gt;
	local regional_categories = data.regional_categories or {}&lt;br /&gt;
	local plain_categories = data.plain_categories or {}&lt;br /&gt;
&lt;br /&gt;
	local function insert_cat(cat)&lt;br /&gt;
		table.insert(categories, cat)&lt;br /&gt;
		&lt;br /&gt;
		if script then&lt;br /&gt;
			table.insert(categories, cat .. &amp;quot; in &amp;quot; .. script .. &amp;quot; script&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if script2 then&lt;br /&gt;
			table.insert(categories2, cat .. &amp;quot; in &amp;quot; .. script2 .. &amp;quot; script&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for i, cat in ipairs(topical_categories) do&lt;br /&gt;
		insert_cat(lang_code .. &amp;quot;:&amp;quot; .. cat)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for i, cat in ipairs(sense_categories) do&lt;br /&gt;
		cat = (term_mode and cat .. &amp;quot; terms&amp;quot; ) or &amp;quot;terms with &amp;quot; .. cat .. &amp;quot; senses&amp;quot;&lt;br /&gt;
		insert_cat(canonical_name .. &amp;quot; &amp;quot; .. cat)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for i, cat in ipairs(pos_categories) do&lt;br /&gt;
		insert_cat(canonical_name .. &amp;quot; &amp;quot; .. cat)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for i, cat in ipairs(regional_categories) do&lt;br /&gt;
		insert_cat(cat .. &amp;quot; &amp;quot; .. canonical_name)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for i, cat in ipairs(plain_categories) do&lt;br /&gt;
		insert_cat(cat)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return	m_utilities_format_categories(categories, lang, sort_key, nil, force_cat) ..&lt;br /&gt;
			m_utilities_format_categories(categories2, lang, sort_key2, nil, force_cat)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.get_label_info(label, lang, already_seen, script, script2, sort_key, sort_key2, nocat, term_mode)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	local deprecated = false&lt;br /&gt;
	local categories = &amp;quot;&amp;quot;&lt;br /&gt;
	local alias&lt;br /&gt;
	local data = m_labeldata[label]&lt;br /&gt;
&lt;br /&gt;
	-- get language-specific labels from data module&lt;br /&gt;
	local langcode = lang:getCode()&lt;br /&gt;
	local langlabels_ok, langlabels = pcall(function() return mw.loadData(&amp;quot;Module:labels/data/lang/&amp;quot; .. langcode) end)&lt;br /&gt;
	if langlabels_ok then&lt;br /&gt;
		-- prefer per-language label in order to pick subvariety labels over regional ones&lt;br /&gt;
		data = langlabels[label] or data&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	data = data or {}&lt;br /&gt;
&lt;br /&gt;
	if data.deprecated then&lt;br /&gt;
		deprecated = true&lt;br /&gt;
	end&lt;br /&gt;
	if type(data) == &amp;quot;string&amp;quot; or data.alias_of then&lt;br /&gt;
		alias = label&lt;br /&gt;
		label = data.alias_of or data&lt;br /&gt;
		if langlabels_ok then&lt;br /&gt;
			data = langlabels[label] or m_labeldata[label]&lt;br /&gt;
		else&lt;br /&gt;
			data = m_labeldata[label]&lt;br /&gt;
		end&lt;br /&gt;
		data = data or {}&lt;br /&gt;
	end&lt;br /&gt;
	if data.deprecated then&lt;br /&gt;
		deprecated = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if data.track then&lt;br /&gt;
		require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;labels/label/&amp;quot; .. label)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if data.special_display then&lt;br /&gt;
		local function add_language_name(str)&lt;br /&gt;
			if str == &amp;quot;canonical_name&amp;quot; then&lt;br /&gt;
				return lang:getCanonicalName()&lt;br /&gt;
			else&lt;br /&gt;
				return &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		label = mw.ustring.gsub(data.special_display, &amp;quot;&amp;lt;([^&amp;gt;]+)&amp;gt;&amp;quot;, add_language_name)&lt;br /&gt;
	else&lt;br /&gt;
		--[[&lt;br /&gt;
			If data.glossary or data.Wikipedia are set to true, there is a glossary definition&lt;br /&gt;
			with an anchor identical to the label, or a Wikipedia article with a title&lt;br /&gt;
			identical to the label.&lt;br /&gt;
				For example, the code&lt;br /&gt;
					labels[&amp;quot;formal&amp;quot;] = {&lt;br /&gt;
						glossary = true,&lt;br /&gt;
					}&lt;br /&gt;
				indicates that there is a glossary entry for &amp;quot;formal&amp;quot;.&lt;br /&gt;
				&lt;br /&gt;
			&lt;br /&gt;
			Otherwise, data.glossary and data.Wikipedia specify the title or the anchor.&lt;br /&gt;
		]]&lt;br /&gt;
		if data.glossary then&lt;br /&gt;
			local glossary_entry = type(data.glossary) == &amp;quot;string&amp;quot; and data.glossary or label&lt;br /&gt;
			label = &amp;quot;[[Appendix:Glossary#&amp;quot; .. glossary_entry .. &amp;quot;|&amp;quot; .. ( data.display or label ) .. &amp;quot;]]&amp;quot;&lt;br /&gt;
		elseif data.Wikipedia then&lt;br /&gt;
			Wikipedia_entry = type(data.Wikipedia) == &amp;quot;string&amp;quot; and data.Wikipedia or label&lt;br /&gt;
			label = &amp;quot;[[w:&amp;quot; .. Wikipedia_entry .. &amp;quot;|&amp;quot; .. ( data.display or label ) .. &amp;quot;]]&amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			label = data.display or label&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if deprecated then&lt;br /&gt;
		label = &amp;#039;&amp;lt;span class=&amp;quot;deprecated-label&amp;quot;&amp;gt;&amp;#039; .. label .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		if not nocat then&lt;br /&gt;
			categories = categories .. m_utilities_format_categories({ &amp;quot;Entries with deprecated labels&amp;quot; }, lang, sort_key, nil, force_cat)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local label_for_already_seen =&lt;br /&gt;
		(data.topical_categories or data.regional_categories&lt;br /&gt;
		or data.plain_categories or data.pos_categories&lt;br /&gt;
		or data.sense_categories) and label&lt;br /&gt;
		or nil&lt;br /&gt;
	&lt;br /&gt;
	-- Track label text. If label text was previously used, don&amp;#039;t show it,&lt;br /&gt;
	-- but include the categories.&lt;br /&gt;
	-- For an example, see [[hypocretin]].&lt;br /&gt;
	if already_seen[label_for_already_seen] then&lt;br /&gt;
		ret.label = &amp;quot;&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		ret.label = label&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if nocat then&lt;br /&gt;
		ret.categories = &amp;quot;&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		ret.categories = categories .. show_categories(data, lang, script, sort_key, script2, sort_key2, term_mode)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	ret.data = data&lt;br /&gt;
&lt;br /&gt;
	if label_for_already_seen then&lt;br /&gt;
		already_seen[label_for_already_seen] = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
function export.show_labels(labels, lang, script, script2, sort_key, sort_key2, nocat, term_mode)&lt;br /&gt;
	if not labels[1] then&lt;br /&gt;
		if mw.title.getCurrentTitle().nsText == &amp;quot;Template&amp;quot; then&lt;br /&gt;
			labels = {&amp;quot;example&amp;quot;}&lt;br /&gt;
		else&lt;br /&gt;
			error(&amp;quot;You must specify at least one label.&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Show the labels&lt;br /&gt;
	local omit_preComma = false&lt;br /&gt;
	local omit_postComma = true&lt;br /&gt;
	local omit_preSpace = false&lt;br /&gt;
	local omit_postSpace = true&lt;br /&gt;
	&lt;br /&gt;
	local already_seen = {}&lt;br /&gt;
	&lt;br /&gt;
	for i, label in ipairs(labels) do&lt;br /&gt;
		omit_preComma = omit_postComma&lt;br /&gt;
		omit_postComma = false&lt;br /&gt;
		omit_preSpace = omit_postSpace&lt;br /&gt;
		omit_postSpace = false&lt;br /&gt;
&lt;br /&gt;
		local ret = export.get_label_info(label, lang, already_seen, script, script2, sort_key, sort_key2, nocat, term_mode)&lt;br /&gt;
		&lt;br /&gt;
		local omit_comma = omit_preComma or ret.data.omit_preComma&lt;br /&gt;
		omit_postComma = ret.data.omit_postComma&lt;br /&gt;
		local omit_space = omit_preSpace or ret.data.omit_preSpace&lt;br /&gt;
		omit_postSpace = ret.data.omit_postSpace&lt;br /&gt;
		&lt;br /&gt;
		if ret.label == &amp;quot;&amp;quot; then&lt;br /&gt;
			label = &amp;quot;&amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			label = (omit_comma and &amp;quot;&amp;quot; or &amp;#039;&amp;lt;span class=&amp;quot;ib-comma&amp;quot;&amp;gt;,&amp;lt;/span&amp;gt;&amp;#039;) ..&lt;br /&gt;
					(omit_space and &amp;quot;&amp;quot; or &amp;quot;&amp;amp;#32;&amp;quot;) ..&lt;br /&gt;
					ret.label&lt;br /&gt;
		end&lt;br /&gt;
		labels[i] = label .. ret.categories&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
		&amp;quot;&amp;lt;span class=\&amp;quot;ib-brac\&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=\&amp;quot;ib-content\&amp;quot;&amp;gt;&amp;quot; ..&lt;br /&gt;
		table.concat(labels, &amp;quot;&amp;quot;) ..&lt;br /&gt;
		&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=\&amp;quot;ib-brac\&amp;quot;&amp;gt;)&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Wiktionary&gt;Surjection</name></author>
	</entry>
</feed>