<?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%3Acollation</id>
	<title>Module:collation - 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%3Acollation"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:collation&amp;action=history"/>
	<updated>2026-05-23T03:52:30Z</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:collation&amp;diff=411708&amp;oldid=prev</id>
		<title>Sware at 15:59, 9 January 2025</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:collation&amp;diff=411708&amp;oldid=prev"/>
		<updated>2025-01-09T15:59:18Z</updated>

		<summary type="html">&lt;p&gt;&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&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 15:59, 9 January 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local get_plaintext = require(&amp;quot;Module:utilities&amp;quot;).get_plaintext&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local get_plaintext = require(&amp;quot;Module:utilities&amp;quot;).get_plaintext&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local match = string.match&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local match = string.match&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local memoize = require(&quot;Module:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;fun&lt;/del&gt;&quot;)&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.memoize&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local memoize = require(&quot;Module:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;memoize&lt;/ins&gt;&quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local remove = table.remove&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local remove = table.remove&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local sort = table.sort&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local sort = table.sort&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l91&quot;&gt;Line 91:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 91:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- begin with the bytes 240 to 244.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- begin with the bytes 240 to 244.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;do&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;do&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- Memoize match &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;because we&#039;ve set &lt;/del&gt;the `simple` flag, which means it&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- Memoize match &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;with &lt;/ins&gt;the `simple` flag, which means it &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;should only be used&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;should only be used &lt;/del&gt;with fixed additional arguments (in this case, the&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- with fixed additional arguments (in this case, the pattern).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	-- &lt;/del&gt;pattern).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sortkey_match &lt;/ins&gt;= memoize(match, true)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;match &lt;/del&gt;= memoize(match, true)&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	function export.string_sort(item1, item2)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	function export.string_sort(item1, item2)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		if &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;match&lt;/del&gt;(item1, &quot;^[^\240-\244]*$&quot;) and &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;match&lt;/del&gt;(item2, &quot;^[^\240-\244]*$&quot;) then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		if &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sortkey_match&lt;/ins&gt;(item1, &quot;^[^\240-\244]*$&quot;) and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sortkey_match&lt;/ins&gt;(item2, &quot;^[^\240-\244]*$&quot;) then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return item1 &amp;lt; item2&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;			return item1 &amp;lt; item2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;		end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l139&quot;&gt;Line 139:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 138:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local m_table = require(&amp;quot;Module:table&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local m_table = require(&amp;quot;Module:table&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local elems = m_table.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;shallowcopy&lt;/del&gt;(args)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local elems = m_table.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;shallowCopy&lt;/ins&gt;(args)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local m_languages = require(&amp;quot;Module:languages&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local m_languages = require(&amp;quot;Module:languages&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local lang&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local lang&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:collation&amp;diff=374534&amp;oldid=prev</id>
		<title>Sware at 18:22, 5 August 2024</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:collation&amp;diff=374534&amp;oldid=prev"/>
		<updated>2024-08-05T18:22:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://linguifex.com/w/index.php?title=Module:collation&amp;amp;diff=374534&amp;amp;oldid=231018&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:collation&amp;diff=231018&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local export = {}  -- Custom functions for generating a sortkey that will achieve the desired sort -- order. -- name of module and name of exported function local custom_sort_...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:collation&amp;diff=231018&amp;oldid=prev"/>
		<updated>2021-07-14T22:37:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local export = {}  -- Custom functions for generating a sortkey that will achieve the desired sort -- order. -- name of module and name of exported function local custom_sort_...&amp;quot;&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;
-- Custom functions for generating a sortkey that will achieve the desired sort&lt;br /&gt;
-- order.&lt;br /&gt;
-- name of module and name of exported function&lt;br /&gt;
local custom_sort_functions = {&lt;br /&gt;
	egy = { &amp;quot;egy-utilities&amp;quot;, &amp;quot;make_sortkey&amp;quot; },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function is_lang_object(lang)&lt;br /&gt;
	return type(lang) == &amp;quot;table&amp;quot; and type(lang.getCanonicalName) == &amp;quot;function&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function check_lang_object(funcName, argIdx, lang)&lt;br /&gt;
	if not is_lang_object(lang) then&lt;br /&gt;
		error(&amp;quot;bad argument #&amp;quot; .. argIdx .. &amp;quot; to &amp;quot; .. funcName&lt;br /&gt;
			.. &amp;quot;: expected language object, got &amp;quot; .. type(lang) .. &amp;quot;.&amp;quot;, 2)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function check_function(funcName, argIdx, func)&lt;br /&gt;
	if type(func) ~= &amp;quot;function&amp;quot; then&lt;br /&gt;
		error(&amp;quot;bad argument #&amp;quot; .. argIdx .. &amp;quot; to &amp;quot; .. funcName&lt;br /&gt;
			.. &amp;quot;: expected function object, got &amp;quot; .. type(func) .. &amp;quot;.&amp;quot;, 2)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- UTF-8-encoded characters that do not belong to the Basic Multilingual Plane&lt;br /&gt;
-- (that is, with code points greater than U+FFFF) have byte sequences that&lt;br /&gt;
-- begin with the bytes 240 to 244.&lt;br /&gt;
local function contains_non_BMP(str)&lt;br /&gt;
	return str:find &amp;#039;[\240-\244]&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
do&lt;br /&gt;
	local byte, min = string.byte, math.min&lt;br /&gt;
	function export.laborious_comp(item1, item2)&lt;br /&gt;
		local l1, l2 = #item1, #item2&lt;br /&gt;
		for i = 1, min(l1, l2) do&lt;br /&gt;
			local char1, char2 = byte(item1, i, i), byte(item2, i, i)&lt;br /&gt;
			if char1 ~= char2 then&lt;br /&gt;
				return char1 &amp;lt; char2&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return l1 &amp;lt; l2&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.make_sortkey_func(lang, keyfunc)&lt;br /&gt;
	check_lang_object(&amp;quot;make_sortkey_func&amp;quot;, 1, lang)&lt;br /&gt;
	keyfunc = keyfunc or function(elem) return elem end&lt;br /&gt;
	check_function(&amp;quot;make_sortkey_func&amp;quot;, 2, keyfunc)&lt;br /&gt;
	&lt;br /&gt;
	local cache = {}&lt;br /&gt;
	&lt;br /&gt;
	local custom_sort_function = custom_sort_functions[lang:getCode()]&lt;br /&gt;
	local makeSortKey =&lt;br /&gt;
		custom_sort_function and require(&amp;quot;Module:&amp;quot; .. custom_sort_function[1])[custom_sort_function[2]]&lt;br /&gt;
		or function(text)&lt;br /&gt;
			return lang:makeSortKey(text)&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
	local m_links = require(&amp;quot;Module:links&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	return function (element)&lt;br /&gt;
		element = keyfunc(element)&lt;br /&gt;
		local result = cache[element]&lt;br /&gt;
		&lt;br /&gt;
		if result then&lt;br /&gt;
			return result&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		result = m_links.remove_links(element)&lt;br /&gt;
		result = mw.ustring.gsub(result, &amp;quot;[%p ]&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
		result = makeSortKey(lang:makeEntryName(result))&lt;br /&gt;
		cache[element] = result&lt;br /&gt;
		&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.make_compare_func(lang, non_BMP, keyfunc)&lt;br /&gt;
	local make_sortkey = export.make_sortkey_func(lang, keyfunc)&lt;br /&gt;
	&lt;br /&gt;
	-- When comparing two elements with code points outside the BMP, the&lt;br /&gt;
	-- less-than operator does not work correctly because of a bug in glibc.&lt;br /&gt;
	-- See [[phab:T193096]].&lt;br /&gt;
	if non_BMP then&lt;br /&gt;
		return function (elem1, elem2)&lt;br /&gt;
			return export.laborious_comp(make_sortkey(elem1), make_sortkey(elem2))&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return function (elem1, elem2)&lt;br /&gt;
			return make_sortkey(elem1) &amp;lt; make_sortkey(elem2)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.sort(elems, lang, keyfunc)&lt;br /&gt;
	local non_BMP&lt;br /&gt;
	for _, elem in ipairs(elems) do&lt;br /&gt;
		if keyfunc then&lt;br /&gt;
			elem = keyfunc(elem)&lt;br /&gt;
		end&lt;br /&gt;
		if contains_non_BMP(elem) then&lt;br /&gt;
			non_BMP = true&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.sort(elems, is_lang_object(lang) and export.make_compare_func(lang, non_BMP, keyfunc) or nil)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function export.sort_template(frame)&lt;br /&gt;
	if not mw.isSubsting() then&lt;br /&gt;
		error(&amp;quot;This template must be substed.&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local args&lt;br /&gt;
	if frame.args.parent then&lt;br /&gt;
		args = frame:getParent().args&lt;br /&gt;
	else&lt;br /&gt;
		args = frame.args&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local elems = require(&amp;quot;Module:table&amp;quot;).shallowClone(args)&lt;br /&gt;
	local m_languages = require(&amp;quot;Module:languages&amp;quot;)&lt;br /&gt;
	local lang&lt;br /&gt;
	if args.lang then&lt;br /&gt;
		lang = m_languages.getByCode(args.lang) or m_languages.err(args.lang, &amp;#039;lang&amp;#039;)&lt;br /&gt;
	else&lt;br /&gt;
		local code = table.remove(elems, 1)&lt;br /&gt;
		code = code and mw.text.trim(code)&lt;br /&gt;
		lang = m_languages.getByCode(code) or m_languages.err(code, 1)&lt;br /&gt;
	end&lt;br /&gt;
	export.sort(elems, lang)&lt;br /&gt;
	return table.concat(elems, args.sep or &amp;quot;|&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>