<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://odden.us:443/thadar/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AScripts%2FfindBestScript</id>
	<title>Module:Scripts/findBestScript - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://odden.us:443/thadar/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AScripts%2FfindBestScript"/>
	<link rel="alternate" type="text/html" href="https://odden.us:443/thadar/wiki/index.php?title=Module:Scripts/findBestScript&amp;action=history"/>
	<updated>2026-04-12T15:05:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://odden.us:443/thadar/wiki/index.php?title=Module:Scripts/findBestScript&amp;diff=1160&amp;oldid=prev</id>
		<title>Oa10712: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://odden.us:443/thadar/wiki/index.php?title=Module:Scripts/findBestScript&amp;diff=1160&amp;oldid=prev"/>
		<updated>2022-09-06T03:28:29Z</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 22:28, 5 September 2022&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>Oa10712</name></author>
	</entry>
	<entry>
		<id>https://odden.us:443/thadar/wiki/index.php?title=Module:Scripts/findBestScript&amp;diff=1159&amp;oldid=prev</id>
		<title>en&gt;Surjection at 13:48, 26 January 2022</title>
		<link rel="alternate" type="text/html" href="https://odden.us:443/thadar/wiki/index.php?title=Module:Scripts/findBestScript&amp;diff=1159&amp;oldid=prev"/>
		<updated>2022-01-26T13:48:38Z</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;return function (export, text, lang, scripts, forceDetect)&lt;br /&gt;
	--[=[&lt;br /&gt;
		Remove any HTML entities; catfix function in [[Module:utilities]]&lt;br /&gt;
		adds tagging to a no-break space (&amp;amp;nbsp;), which contains Latin characters;&lt;br /&gt;
		hence Latin was returned as the script if &amp;quot;Latn&amp;quot; is one of the language&amp;#039;s scripts.&lt;br /&gt;
	]=]&lt;br /&gt;
	text = string.gsub(text, &amp;quot;&amp;amp;[a-zA-Z0-9]+;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	-- Try to match every script against the text,&lt;br /&gt;
	-- and return the one with the most matching characters.&lt;br /&gt;
	local bestcount = 0&lt;br /&gt;
	local bestscript = nil&lt;br /&gt;
	&lt;br /&gt;
	-- Get length of text minus any spacing or punctuation characters.&lt;br /&gt;
	-- Counting instances of UTF-8 character pattern is faster than mw.ustring.len.&lt;br /&gt;
	local _, length = string.gsub(mw.ustring.gsub(text, &amp;quot;[%s%p]+&amp;quot;, &amp;quot;&amp;quot;), &amp;quot;[\1-\127\194-\244][\128-\191]*&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	if length == 0 then&lt;br /&gt;
		return export.getByCode(&amp;quot;None&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for i, script in ipairs(scripts) do&lt;br /&gt;
		local count = script:countCharacters(text)&lt;br /&gt;
		&lt;br /&gt;
		if count &amp;gt;= length then&lt;br /&gt;
			return script&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if count &amp;gt; bestcount then&lt;br /&gt;
			bestcount = count&lt;br /&gt;
			bestscript = script&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if bestscript then&lt;br /&gt;
		return bestscript&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- No matching script was found. Return &amp;quot;None&amp;quot;.&lt;br /&gt;
	return export.getByCode(&amp;quot;None&amp;quot;)&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>en&gt;Surjection</name></author>
	</entry>
</feed>