<?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%3AStationlist_row</id>
	<title>Module:Stationlist row - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AStationlist_row"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Stationlist_row&amp;action=history"/>
	<updated>2026-04-19T13:26:20Z</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:Stationlist_row&amp;diff=479612&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:Stationlist_row&amp;diff=479612&amp;oldid=prev"/>
		<updated>2021-07-16T07:27:57Z</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;local p = { } -- Package to be exported&lt;br /&gt;
local getArgs = require('Module:Arguments').getArgs -- Import module function to work with passed arguments&lt;br /&gt;
local lang = mw.getContentLanguage() -- Retrieve built-in locale for date formatting&lt;br /&gt;
&lt;br /&gt;
function dtsYearCore(date, circa)&lt;br /&gt;
	-- A limited replacement for {{dts}}. This is passed a date and derives a sort key from it. It returns a string with the hidden sort key, along with the year of the original date.&lt;br /&gt;
	if not date then return false end -- If the date is an empty string, stop and go back to whence it came.&lt;br /&gt;
	local year = lang:formatDate('Y', date) -- This invocation of lang:formatDate returns just the year.&lt;br /&gt;
	if year == date then -- If the provided date is just the year:&lt;br /&gt;
		date = date .. &amp;quot;-01-01&amp;quot; -- Tack on January 1 for the sort key to work right.&lt;br /&gt;
	end&lt;br /&gt;
	local month = lang:formatDate('m', date) -- Stores the month of the date.&lt;br /&gt;
	local day = lang:formatDate('d', date) -- Stores the day for this date.&lt;br /&gt;
	local dtsStr = string.format(&amp;quot;%05d-%02d-%02d&amp;quot;, year, month, day) -- Create and store the formatted hidden sort key. The year must be five digits, per convention.&lt;br /&gt;
	local spanParams = {style = &amp;quot;display:none; speak:none&amp;quot;} -- These CSS properties hide the sort key from normal view.&lt;br /&gt;
	local dtsSpan = mw.text.tag({name='span', content=dtsStr, attrs=spanParams}) -- This generates the HTML code necessary for the hidden sort key.&lt;br /&gt;
	if circa == 'yes' then -- If the date is tagged as circa,&lt;br /&gt;
		return dtsSpan .. &amp;quot;&amp;lt;abbr title=\&amp;quot;circa\&amp;quot;&amp;gt;c.&amp;lt;/abbr&amp;gt;&amp;lt;span style=\&amp;quot;white-space:nowrap;\&amp;quot;&amp;gt;&amp;amp;thinsp;&amp;quot; .. year .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot; -- Add the circa abbreviation to the display. Derived from {{circa}}&lt;br /&gt;
	else -- Otherwise,&lt;br /&gt;
		return dtsSpan .. year -- Return the hidden sort key concatenated with the year for this date.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function dtsYear(date, circa)&lt;br /&gt;
	local success, result = pcall(dtsYearCore, date, circa)&lt;br /&gt;
	if success then&lt;br /&gt;
		return result&lt;br /&gt;
	else&lt;br /&gt;
		return string.format('%s&amp;lt;span class=&amp;quot;error&amp;quot;&amp;gt;Error: Invalid date &amp;quot;%s&amp;quot;.&amp;lt;/span&amp;gt;', circa and '&amp;lt;abbr title=&amp;quot;circa&amp;quot;&amp;gt;c.&amp;lt;/abbr&amp;gt;&amp;amp;thinsp;' or '', date)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function dateCell(date, circa, ref)&lt;br /&gt;
	-- This function returns the proper value for a date cell.&lt;br /&gt;
	return '|align=center|' .. (dtsYear(date, circa) or &amp;quot;—&amp;quot;) .. (ref or '')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._row(args)&lt;br /&gt;
	local concat = table.concat&lt;br /&gt;
	local insert = table.insert&lt;br /&gt;
	local stationCell = '|' .. args.station&lt;br /&gt;
	local locationCell = '|' .. args.location&lt;br /&gt;
	local linesCell&lt;br /&gt;
	if args.lines ~= 'none' then&lt;br /&gt;
		local lines = {}&lt;br /&gt;
		for _,v in ipairs(mw.text.split(args.lines, ';')) do&lt;br /&gt;
			insert(lines, v)&lt;br /&gt;
		end&lt;br /&gt;
		linesCell = '|' .. concat(lines, '&amp;lt;hr&amp;gt;')&lt;br /&gt;
	else&lt;br /&gt;
		linesCell = ''&lt;br /&gt;
	end&lt;br /&gt;
	local openedCell = dateCell(args.opened, args.circa_opened, args.opened_ref)&lt;br /&gt;
	local rebuiltCell = dateCell(args.rebuilt, args.circa_rebuilt, args.rebuilt_ref)&lt;br /&gt;
	local agencyClosedCell = dateCell(args.agency_closed, args.circa_agency_closed, args.agency_closed_ref)&lt;br /&gt;
	local closedCell = dateCell(args.closed, args.circa_closed, args.closed_ref)&lt;br /&gt;
	local notes = args.notes or ''&lt;br /&gt;
	local notesCell = notes == 'none' and '' or '|' .. notes&lt;br /&gt;
	local cells = {'|-', stationCell, locationCell, linesCell, openedCell, rebuiltCell, agencyClosedCell, closedCell, notesCell}&lt;br /&gt;
	return concat(cells, '\n')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.row(frame)&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	return p._row(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>