<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Acategory_tree%2Ftopic%2Futilities</id>
	<title>Module:category tree/topic/utilities - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Acategory_tree%2Ftopic%2Futilities"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:category_tree/topic/utilities&amp;action=history"/>
	<updated>2026-04-22T05:03:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:category_tree/topic/utilities&amp;diff=495453&amp;oldid=prev</id>
		<title>Sware: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:category_tree/topic/utilities&amp;diff=495453&amp;oldid=prev"/>
		<updated>2026-04-21T12:37:44Z</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;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:37, 21 April 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:category_tree/topic/utilities&amp;diff=495452&amp;oldid=prev</id>
		<title>wikt&gt;WingerBot: WingerBot moved page Module:category tree/topic cat/utilities to Module:category tree/topic/utilities: rename category tree subpage per Wiktionary:Grease_pit/2025/February#cleaning_up_and_renaming_the_category_tree_modules</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:category_tree/topic/utilities&amp;diff=495452&amp;oldid=prev"/>
		<updated>2025-04-28T05:02:49Z</updated>

		<summary type="html">&lt;p&gt;WingerBot moved page &lt;a href=&quot;/w/index.php?title=Module:category_tree/topic_cat/utilities&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:category tree/topic cat/utilities (page does not exist)&quot;&gt;Module:category tree/topic cat/utilities&lt;/a&gt; to &lt;a href=&quot;/wiki/Module:category_tree/topic/utilities&quot; title=&quot;Module:category tree/topic/utilities&quot;&gt;Module:category tree/topic/utilities&lt;/a&gt;: rename category tree subpage per &lt;a href=&quot;http://en.wiktionary.org/wiki/Grease_pit/2025/February#cleaning_up_and_renaming_the_category_tree_modules&quot; class=&quot;extiw&quot; title=&quot;wiktionary:Grease pit/2025/February&quot;&gt;Wiktionary:Grease_pit/2025/February#cleaning_up_and_renaming_the_category_tree_modules&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local export = {}&lt;br /&gt;
&lt;br /&gt;
local en_utilities_module = &amp;quot;Module:en-utilities&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local rsplit = mw.text.split&lt;br /&gt;
&lt;br /&gt;
-- Add links to `label`. It operates as follows:&lt;br /&gt;
-- 1. If the singular equivalent of the label (which will be the label itself if the label doesn&amp;#039;t end in -s) exists as&lt;br /&gt;
--    a term in Wiktionary and `no_singularize` isn&amp;#039;t specified, link the label to the singular equivalent.&lt;br /&gt;
-- 2. Otherwise link the label directly, if it exists (as a term in Wiktionary).&lt;br /&gt;
-- 3. Otherwise, if the label is multiword, split the label into words, singularize the last word (unless&lt;br /&gt;
--    `no_singularize` is specified), and attempt to link each word individually. This fails if any of the linked words&lt;br /&gt;
--    don&amp;#039;t exist in Wiktionary.&lt;br /&gt;
-- 4. Otherwise, if the label is multiword, split the label into words and link each word individually as-is, including&lt;br /&gt;
--    the last one. This fails if any of the linked words don&amp;#039;t exist in Wiktionary.&lt;br /&gt;
-- 5. Finally, return the label unchanged.&lt;br /&gt;
--&lt;br /&gt;
-- FIXME: This should probably check if an English term exists for each linked term rather than that the term exists at&lt;br /&gt;
-- all.&lt;br /&gt;
--&lt;br /&gt;
-- If `wikify` is given, just link the singular equivalent of the label to Wikipedia unless `no_singularize` is given,&lt;br /&gt;
-- in which case the label is linked as-is to Wikipedia.&lt;br /&gt;
--&lt;br /&gt;
-- The main use of `no_singularize` is with plural-form terms that also exist in the singular but have special meanings&lt;br /&gt;
-- in the plural that are different from the corresponding singular (e.g. [[acoustics]] is not the plural of&lt;br /&gt;
-- [[acoustic]], but will be incorrectly linked as [[acoustic]]s unless `no_singularize` is given).&lt;br /&gt;
function export.link_label(label, no_singularize, wikify)&lt;br /&gt;
	local function term_exists(term)&lt;br /&gt;
		local title = mw.title.new(term)&lt;br /&gt;
		return title and title.exists&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local singular_label&lt;br /&gt;
	if not no_singularize then&lt;br /&gt;
		singular_label = require(en_utilities_module).singularize(label)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if wikify then&lt;br /&gt;
		if singular_label then&lt;br /&gt;
			return &amp;quot;[[w:&amp;quot; .. singular_label .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;[[w:&amp;quot; .. label .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- First try to singularize the label as a whole, unless &amp;#039;no singularize&amp;#039; was given. If the result exists,&lt;br /&gt;
	-- return it.&lt;br /&gt;
	if singular_label and term_exists(singular_label) then&lt;br /&gt;
		return &amp;quot;[[&amp;quot; .. singular_label .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	elseif term_exists(label) then&lt;br /&gt;
		-- Then check if the original label as a whole exists, and return if so.&lt;br /&gt;
		return &amp;quot;[[&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		-- Otherwise, if the label is multiword, split into words and try the link each one, singularizing the last&lt;br /&gt;
		-- one unless &amp;#039;no singularize&amp;#039; was given.&lt;br /&gt;
		local split_label&lt;br /&gt;
		if label:find(&amp;quot; &amp;quot;) then&lt;br /&gt;
			if not no_singularize then&lt;br /&gt;
				split_label = rsplit(label, &amp;quot; &amp;quot;)&lt;br /&gt;
				for i, word in ipairs(split_label) do&lt;br /&gt;
					if i == #split_label then&lt;br /&gt;
						local singular_word = require(en_utilities_module).singularize(word)&lt;br /&gt;
						if term_exists(singular_word) then&lt;br /&gt;
							split_label[i] = &amp;quot;[[&amp;quot; .. singular_word .. &amp;quot;|&amp;quot; .. word .. &amp;quot;]]&amp;quot;&lt;br /&gt;
						else&lt;br /&gt;
							split_label = nil&lt;br /&gt;
							break&lt;br /&gt;
						end&lt;br /&gt;
					else&lt;br /&gt;
						if term_exists(word) then&lt;br /&gt;
							split_label[i] = &amp;quot;[[&amp;quot; .. word .. &amp;quot;]]&amp;quot;&lt;br /&gt;
						else&lt;br /&gt;
							split_label = nil&lt;br /&gt;
							break&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if split_label then&lt;br /&gt;
					split_label = table.concat(split_label, &amp;quot; &amp;quot;)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			-- If we weren&amp;#039;t able to link individual words with the last word singularized, link all words as-is.&lt;br /&gt;
			if not split_label then&lt;br /&gt;
				split_label = rsplit(label, &amp;quot; &amp;quot;)&lt;br /&gt;
				for i, word in ipairs(split_label) do&lt;br /&gt;
					if term_exists(word) then&lt;br /&gt;
						split_label[i] = &amp;quot;[[&amp;quot; .. word .. &amp;quot;]]&amp;quot;&lt;br /&gt;
					else&lt;br /&gt;
						split_label = nil&lt;br /&gt;
						break&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if split_label then&lt;br /&gt;
					split_label = table.concat(split_label, &amp;quot; &amp;quot;)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		return split_label or label&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>wikt&gt;WingerBot</name></author>
	</entry>
</feed>