<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AParticles</id>
	<title>Module:Particles - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AParticles"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Particles&amp;action=history"/>
	<updated>2026-06-07T12:42:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Particles&amp;diff=478919&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Particles&amp;diff=478919&amp;oldid=prev"/>
		<updated>2021-07-16T05:17:22Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Low-overhead version of {{Subatomic particle|...}} to avoid exceeding&lt;br /&gt;
-- template include size at [[List of baryons]].&lt;br /&gt;
&lt;br /&gt;
local particleTable, supsub&lt;br /&gt;
&lt;br /&gt;
local function stripToNil(text)&lt;br /&gt;
	-- If text is a string, return its trimmed content, or nil if empty.&lt;br /&gt;
	-- Otherwise return text (which may, for example, be nil).&lt;br /&gt;
	if type(text) == 'string' then&lt;br /&gt;
		text = text:match('(%S.-)%s*$')&lt;br /&gt;
	end&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local BREAK = &amp;quot;__BR__&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-- A group is a list of one or more particles with optional separating text.&lt;br /&gt;
-- Some items are defined with special meanings:&lt;br /&gt;
--   Parameter       Output&lt;br /&gt;
--    /               &amp;quot; / &amp;quot;&lt;br /&gt;
--    +               &amp;quot; + &amp;quot;&lt;br /&gt;
--    or              &amp;quot; or &amp;quot;&lt;br /&gt;
--    seen            &amp;quot; (seen) &amp;quot;&lt;br /&gt;
--    _word1_word2    &amp;quot; word1 word2&amp;quot; (wordN is any text)&lt;br /&gt;
--    (text)          &amp;quot;(text)&amp;quot; (text is any text)&lt;br /&gt;
--    br              &amp;quot;&amp;lt;br /&amp;gt;&amp;quot; (and separates the group into logical lines)&lt;br /&gt;
-- Each logical line in the final text is in a nowrap span.&lt;br /&gt;
local Group&lt;br /&gt;
Group = {&lt;br /&gt;
	add = function (self, item)&lt;br /&gt;
		if item ~= nil then&lt;br /&gt;
			if item == BREAK then&lt;br /&gt;
				self:purgeCurrent()&lt;br /&gt;
			else&lt;br /&gt;
				self.nrCurrent = self.nrCurrent + 1&lt;br /&gt;
				self.current[self.nrCurrent] = item&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end,&lt;br /&gt;
	new = function ()&lt;br /&gt;
		return setmetatable({&lt;br /&gt;
			nrCurrent = 0,&lt;br /&gt;
			current = {},&lt;br /&gt;
			nrLines = 0,&lt;br /&gt;
			lines = {},&lt;br /&gt;
		}, Group)&lt;br /&gt;
	end,&lt;br /&gt;
	purgeCurrent = function (self)&lt;br /&gt;
		if self.nrCurrent &amp;gt; 0 then&lt;br /&gt;
			self.nrLines = self.nrLines + 1&lt;br /&gt;
			self.lines[self.nrLines] =&lt;br /&gt;
				'&amp;lt;span style=&amp;quot;white-space:nowrap;&amp;quot;&amp;gt;' ..&lt;br /&gt;
				table.concat(self.current) ..&lt;br /&gt;
				'&amp;lt;/span&amp;gt;'&lt;br /&gt;
			self.nrCurrent = 0&lt;br /&gt;
			self.current = {}&lt;br /&gt;
		end&lt;br /&gt;
	end,&lt;br /&gt;
	text = function (self)&lt;br /&gt;
		self:purgeCurrent()&lt;br /&gt;
		return table.concat(self.lines, '&amp;lt;br /&amp;gt;')&lt;br /&gt;
	end,&lt;br /&gt;
}&lt;br /&gt;
Group.__index = Group&lt;br /&gt;
&lt;br /&gt;
local keyitems = {&lt;br /&gt;
	['/']    = &amp;quot; / &amp;quot;,&lt;br /&gt;
	['+']    = &amp;quot; + &amp;quot;,&lt;br /&gt;
	['or']   = &amp;quot; or &amp;quot;,&lt;br /&gt;
	['seen'] = &amp;quot; (seen) &amp;quot;,&lt;br /&gt;
	['br']   = BREAK,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function expand(item, wantLink)&lt;br /&gt;
	-- Return text after expanding given item.&lt;br /&gt;
	-- Throw an error if item is not recognized.&lt;br /&gt;
	local function quit(reason)&lt;br /&gt;
		reason = reason or 'has an invalid definition'&lt;br /&gt;
		error('Particle &amp;quot;' .. item .. '&amp;quot; ' .. reason, 0)&lt;br /&gt;
	end&lt;br /&gt;
	local function su(sup, sub, align)&lt;br /&gt;
		local options = {&lt;br /&gt;
			align = align,&lt;br /&gt;
			lineHeight = '1.0em',&lt;br /&gt;
		}&lt;br /&gt;
		return supsub(sup, sub, options)&lt;br /&gt;
	end&lt;br /&gt;
	local kw = keyitems[item]&lt;br /&gt;
	if kw then&lt;br /&gt;
		return kw&lt;br /&gt;
	end&lt;br /&gt;
	if item:sub(1, 1) == '_' then&lt;br /&gt;
		return item:gsub('_', ' ')&lt;br /&gt;
	end&lt;br /&gt;
	if item:sub(1, 1) == '(' and item:sub(-1) == ')' then&lt;br /&gt;
		return item  -- no space wanted&lt;br /&gt;
	end&lt;br /&gt;
	local particle = particleTable[item:lower()] or quit('is not defined')&lt;br /&gt;
	local prefix, suffix&lt;br /&gt;
	if wantLink then&lt;br /&gt;
		prefix = '[[' .. (particle.link or quit('has no link defined')) .. '|'&lt;br /&gt;
		suffix = ']]'&lt;br /&gt;
	else&lt;br /&gt;
		prefix = ''&lt;br /&gt;
		suffix = ''&lt;br /&gt;
	end&lt;br /&gt;
	local symbol = particle[1] or quit('has no symbol defined')&lt;br /&gt;
	if particle.anti then&lt;br /&gt;
		symbol = '&amp;lt;span style=&amp;quot;text-decoration:overline;&amp;quot;&amp;gt;' .. symbol .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	return&lt;br /&gt;
		prefix ..&lt;br /&gt;
		su(particle.TL, particle.BL, 'r') ..&lt;br /&gt;
		symbol ..&lt;br /&gt;
		su(particle.TR, particle.BR, 'l') ..&lt;br /&gt;
		suffix&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function main(frame, wantLink)&lt;br /&gt;
	-- Arguments are passed using #invoke in an article to avoid double-expansion.&lt;br /&gt;
	local sandbox = frame:getTitle():find('sandbox', 1, true) and '/sandbox' or ''&lt;br /&gt;
	particleTable = mw.loadData('Module:Particles/data' .. sandbox).particles&lt;br /&gt;
	supsub = require('Module:Su')._main&lt;br /&gt;
	local group = Group.new()&lt;br /&gt;
	for _, arg in ipairs(frame.args) do&lt;br /&gt;
		arg = stripToNil(arg)&lt;br /&gt;
		if arg then&lt;br /&gt;
			group:add(expand(arg, wantLink))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return group:text()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function link(frame)&lt;br /&gt;
	return main(frame, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function nolink(frame)&lt;br /&gt;
	return main(frame, false)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	link = link,&lt;br /&gt;
	nolink = nolink,&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>