<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.webxr.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ATable_row_counter</id>
	<title>Module:Table row counter - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.webxr.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ATable_row_counter"/>
	<link rel="alternate" type="text/html" href="https://www.webxr.wiki/index.php?title=Module:Table_row_counter&amp;action=history"/>
	<updated>2026-05-02T01:26:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.1</generator>
	<entry>
		<id>https://www.webxr.wiki/index.php?title=Module:Table_row_counter&amp;diff=431&amp;oldid=prev</id>
		<title>Msub2: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.webxr.wiki/index.php?title=Module:Table_row_counter&amp;diff=431&amp;oldid=prev"/>
		<updated>2023-03-04T04:14:04Z</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 04:14, 4 March 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key mediawiki_db:diff::1.12:old-430:rev-431 --&gt;
&lt;/table&gt;</summary>
		<author><name>Msub2</name></author>
	</entry>
	<entry>
		<id>https://www.webxr.wiki/index.php?title=Module:Table_row_counter&amp;diff=430&amp;oldid=prev</id>
		<title>en&gt;Guarapiranga: if 'ignore' is empty, subtract header rows</title>
		<link rel="alternate" type="text/html" href="https://www.webxr.wiki/index.php?title=Module:Table_row_counter&amp;diff=430&amp;oldid=prev"/>
		<updated>2019-11-13T22:11:54Z</updated>

		<summary type="html">&lt;p&gt;if &amp;#039;ignore&amp;#039; is empty, subtract header rows&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module counts table rows in wikitext.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
local getArgs&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	if not getArgs then&lt;br /&gt;
		getArgs = require('Module:Arguments').getArgs&lt;br /&gt;
	end&lt;br /&gt;
	return p._main(getArgs(frame, {wrappers = 'Template:Table row counter'}))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	-- Get the title object.&lt;br /&gt;
	local titleObj&lt;br /&gt;
	do&lt;br /&gt;
		local success&lt;br /&gt;
		success, titleObj = pcall(mw.title.new, args.page)&lt;br /&gt;
		if not success or not titleObj then&lt;br /&gt;
			titleObj = mw.title.getCurrentTitle()&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Get the page content.&lt;br /&gt;
	local content = titleObj:getContent()&lt;br /&gt;
	if not content then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Find the wikitables on that page.&lt;br /&gt;
	local wikitables = {}&lt;br /&gt;
	do&lt;br /&gt;
		local iWikitable = 0&lt;br /&gt;
		local s1 = content:match('^({|.-\n|})')&lt;br /&gt;
		if s1 then&lt;br /&gt;
			iWikitable = iWikitable + 1&lt;br /&gt;
			wikitables[iWikitable] = s1&lt;br /&gt;
		end&lt;br /&gt;
		for s in content:gmatch('\n({|.-\n|})') do&lt;br /&gt;
			iWikitable = iWikitable + 1&lt;br /&gt;
			wikitables[iWikitable] = s&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Find the wikitable to work on.&lt;br /&gt;
	local wikitable&lt;br /&gt;
	if args.id then&lt;br /&gt;
		for i, s in ipairs(wikitables) do&lt;br /&gt;
			if s:match('^{|[^\n]*id *= *&amp;quot; *(%w+) *&amp;quot;') == args.id then&lt;br /&gt;
				wikitable = s&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		wikitable = wikitables[tonumber(args.tableno) or 1]&lt;br /&gt;
	end&lt;br /&gt;
	if not wikitable then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Count the number of rows.&lt;br /&gt;
	local count&lt;br /&gt;
	do&lt;br /&gt;
		local temp&lt;br /&gt;
		temp, count = wikitable:gsub('\n|%-', '\n|-')&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Control for missing row markers at the start.&lt;br /&gt;
	if not wikitable:find('^{|[^\n]*%s*\n|%-') then&lt;br /&gt;
		count = count + 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Control for extra row markers at the end.&lt;br /&gt;
	if wikitable:find('\n|%-[^\n]-%s*\n|}$') then&lt;br /&gt;
		count = count - 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Subtract the number of rows to ignore, or the number of header&lt;br /&gt;
	--  rows if it's empty, and make sure the result isn't below zero.&lt;br /&gt;
	local headers&lt;br /&gt;
	do&lt;br /&gt;
		local temp&lt;br /&gt;
		temp, headers = wikitable:gsub('\n|%-\n!', '\n|-\n!')&lt;br /&gt;
	end&lt;br /&gt;
	if not wikitable:find('^{|[^\n]*%s*\n|%-\n!') then&lt;br /&gt;
		headers = headers + 1&lt;br /&gt;
	end&lt;br /&gt;
	count = count - (tonumber(args.ignore) or headers)&lt;br /&gt;
	if count &amp;lt; 0 then&lt;br /&gt;
		count = 0&lt;br /&gt;
	end&lt;br /&gt;
	return count&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>en&gt;Guarapiranga</name></author>
	</entry>
</feed>