<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://edubase.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AString2</id>
	<title>Module:String2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://edubase.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AString2"/>
	<link rel="alternate" type="text/html" href="https://edubase.wiki/index.php?title=Module:String2&amp;action=history"/>
	<updated>2026-05-10T14:20:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.7</generator>
	<entry>
		<id>https://edubase.wiki/index.php?title=Module:String2&amp;diff=27358&amp;oldid=prev</id>
		<title>Aron.hives@edubase.net: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://edubase.wiki/index.php?title=Module:String2&amp;diff=27358&amp;oldid=prev"/>
		<updated>2018-11-12T22:47:33Z</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&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 22:47, 12 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&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;!-- diff cache key wiki_public:diff:1.41:old-27357:rev-27358 --&gt;
&lt;/table&gt;</summary>
		<author><name>Aron.hives@edubase.net</name></author>
	</entry>
	<entry>
		<id>https://edubase.wiki/index.php?title=Module:String2&amp;diff=27357&amp;oldid=prev</id>
		<title>en&gt;Pppery: Prune code duplication in title function</title>
		<link rel="alternate" type="text/html" href="https://edubase.wiki/index.php?title=Module:String2&amp;diff=27357&amp;oldid=prev"/>
		<updated>2018-04-11T19:47:29Z</updated>

		<summary type="html">&lt;p&gt;Prune code duplication in title function&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
p.upper = function(frame)&lt;br /&gt;
	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	return string.upper(s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.lower = function(frame)&lt;br /&gt;
	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	return string.lower(s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.sentence = function (frame )&lt;br /&gt;
	frame.args[1] = string.lower(frame.args[1])&lt;br /&gt;
	return p.ucfirst(frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.ucfirst = function (frame )&lt;br /&gt;
	local s =  mw.text.trim( frame.args[1] or &amp;quot;&amp;quot; )&lt;br /&gt;
	local s1 = &amp;quot;&amp;quot;&lt;br /&gt;
	-- if it&amp;#039;s a list chop off and (store as s1) everything up to the first &amp;lt;li&amp;gt;&lt;br /&gt;
	local lipos = string.find(s, &amp;quot;&amp;lt;li&amp;gt;&amp;quot; )&lt;br /&gt;
	if lipos then&lt;br /&gt;
		s1 = string.sub(s, 1, lipos + 3)&lt;br /&gt;
		s = string.sub(s, lipos + 4)&lt;br /&gt;
	end&lt;br /&gt;
	-- s1 is either &amp;quot;&amp;quot; or the first part of the list markup, so we can continue&lt;br /&gt;
	-- and prepend s1 to the returned string&lt;br /&gt;
	if string.find(s, &amp;quot;^%[%[[^|]+|[^%]]+%]%]&amp;quot;) then&lt;br /&gt;
		-- this is a piped wikilink, so we capitalise the text, not the pipe&lt;br /&gt;
		local b, c = string.find(s, &amp;quot;|%A*%a&amp;quot;) -- find the first letter after the pipe&lt;br /&gt;
		return s1 .. string.sub(s, 1, c-1) .. string.upper(string.sub(s, c, c)) .. string.sub(s, c+1)&lt;br /&gt;
	end&lt;br /&gt;
	local letterpos = string.find(s, &amp;#039;%a&amp;#039;)&lt;br /&gt;
	if letterpos then&lt;br /&gt;
		local first = string.sub(s, 1, letterpos - 1)&lt;br /&gt;
		local letter = string.sub(s, letterpos, letterpos)&lt;br /&gt;
		local rest = string.sub(s, letterpos + 1)&lt;br /&gt;
		return s1 .. first .. string.upper(letter) .. rest&lt;br /&gt;
	else&lt;br /&gt;
		return s1 .. s&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.title = function (frame )&lt;br /&gt;
	-- http://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html&lt;br /&gt;
	-- recommended by The U.S. Government Printing Office Style Manual:&lt;br /&gt;
	-- &amp;quot;Capitalize all words in titles of publications and documents,&lt;br /&gt;
	-- except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.&amp;quot;&lt;br /&gt;
	local alwayslower = {[&amp;#039;a&amp;#039;] = 1, [&amp;#039;an&amp;#039;] = 1, [&amp;#039;the&amp;#039;] = 1, &lt;br /&gt;
		[&amp;#039;and&amp;#039;] = 1, [&amp;#039;but&amp;#039;] = 1, [&amp;#039;or&amp;#039;] = 1, [&amp;#039;for&amp;#039;] = 1,&lt;br /&gt;
		[&amp;#039;nor&amp;#039;] = 1, [&amp;#039;on&amp;#039;] = 1, [&amp;#039;in&amp;#039;] = 1, [&amp;#039;at&amp;#039;] = 1, [&amp;#039;to&amp;#039;] = 1,&lt;br /&gt;
		[&amp;#039;from&amp;#039;] = 1, [&amp;#039;by&amp;#039;] = 1, [&amp;#039;of&amp;#039;] = 1, [&amp;#039;up&amp;#039;] = 1 }&lt;br /&gt;
	local res = &amp;#039;&amp;#039;&lt;br /&gt;
	local s =  mw.text.trim( frame.args[1] or &amp;quot;&amp;quot; )&lt;br /&gt;
	local words = mw.text.split( s, &amp;quot; &amp;quot;)&lt;br /&gt;
	for i, s in ipairs(words) do&lt;br /&gt;
		s = string.lower( s )&lt;br /&gt;
		if( i &amp;gt; 1 and alwayslower[s] == 1) then&lt;br /&gt;
			-- leave in lowercase&lt;br /&gt;
		else&lt;br /&gt;
			s = mw.getContentLanguage():ucfirst(s)&lt;br /&gt;
		end&lt;br /&gt;
		words[i] = s&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(words, &amp;quot; &amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
-- Capitalizing only first letter for fetched Wikidata labels.&lt;br /&gt;
-- Wikidata English labels generally begin with a lowercase letter. [[:d:Help:Label#Capitalization]]&lt;br /&gt;
p.label = p.ucfirst&lt;br /&gt;
-- stripZeros finds the first number and strips leading zeros (apart from units)&lt;br /&gt;
-- e.g &amp;quot;0940&amp;quot; -&amp;gt; &amp;quot;940&amp;quot;; &amp;quot;Year: 0023&amp;quot; -&amp;gt; &amp;quot;Year: 23&amp;quot;; &amp;quot;00.12&amp;quot; -&amp;gt; &amp;quot;0.12&amp;quot;&lt;br /&gt;
p.stripZeros = function(frame)&lt;br /&gt;
	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	n = tonumber( string.match( s, &amp;quot;%d+&amp;quot; ) ) or &amp;quot;&amp;quot;&lt;br /&gt;
	s = string.gsub( s, &amp;quot;%d+&amp;quot;, n, 1 )&lt;br /&gt;
	return s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- nowiki ensures that a string of text is treated by the MediaWiki software as just a string&lt;br /&gt;
-- it takes an unnamed parameter and trims whitespace, then removes any wikicode&lt;br /&gt;
p.nowiki = function(frame)&lt;br /&gt;
	local str = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	return mw.text.nowiki(str)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>en&gt;Pppery</name></author>
	</entry>
</feed>