<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.shogiharbour.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AShogi_diagram</id>
	<title>Module:Shogi diagram - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.shogiharbour.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AShogi_diagram"/>
	<link rel="alternate" type="text/html" href="http://wiki.shogiharbour.com/index.php?title=Module:Shogi_diagram&amp;action=history"/>
	<updated>2026-05-15T16:30:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>http://wiki.shogiharbour.com/index.php?title=Module:Shogi_diagram&amp;diff=28&amp;oldid=prev</id>
		<title>Kashi: Created page with &quot;local shogiobject = {}  ----------------------- -- internal functions  -----------------------   -- returns a japanese character for a roman letter abbreviation -- called by the shogiboard() function local function piecesymbol(abbreviation) 	-- the abbreviation argument is a string of 1-3 letters that stand for the English names of the shogi pieces 	-- the abbreviation is extracted out of a longer string by the processString() function 	 	-- letter to character mapping (...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.shogiharbour.com/index.php?title=Module:Shogi_diagram&amp;diff=28&amp;oldid=prev"/>
		<updated>2024-01-11T10:38:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local shogiobject = {}  ----------------------- -- internal functions  -----------------------   -- returns a japanese character for a roman letter abbreviation -- called by the shogiboard() function local function piecesymbol(abbreviation) 	-- the abbreviation argument is a string of 1-3 letters that stand for the English names of the shogi pieces 	-- the abbreviation is extracted out of a longer string by the processString() function 	 	-- letter to character mapping (...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local shogiobject = {}&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
-- internal functions &lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- returns a japanese character for a roman letter abbreviation&lt;br /&gt;
-- called by the shogiboard() function&lt;br /&gt;
local function piecesymbol(abbreviation)&lt;br /&gt;
	-- the abbreviation argument is a string of 1-3 letters that stand for the English names of the shogi pieces&lt;br /&gt;
	-- the abbreviation is extracted out of a longer string by the processString() function&lt;br /&gt;
	&lt;br /&gt;
	-- letter to character mapping (hash table)&lt;br /&gt;
	local piecenames = {&lt;br /&gt;
		p = &amp;#039;歩&amp;#039;,&lt;br /&gt;
		t = &amp;#039;と&amp;#039;,&lt;br /&gt;
		l = &amp;#039;香&amp;#039;,&lt;br /&gt;
		pl = &amp;#039;杏&amp;#039;,&lt;br /&gt;
		n = &amp;#039;桂&amp;#039;,&lt;br /&gt;
		pn = &amp;#039;圭&amp;#039;,&lt;br /&gt;
		s = &amp;#039;銀&amp;#039;,&lt;br /&gt;
		ps = &amp;#039;全&amp;#039;,&lt;br /&gt;
		g = &amp;#039;金&amp;#039;,&lt;br /&gt;
		b = &amp;#039;角&amp;#039;,&lt;br /&gt;
		h = &amp;#039;馬&amp;#039;,&lt;br /&gt;
		r = &amp;#039;飛&amp;#039;,&lt;br /&gt;
		d = &amp;#039;龍&amp;#039;,&lt;br /&gt;
		gyoku = &amp;#039;玉&amp;#039;,&lt;br /&gt;
		ou = &amp;#039;王&amp;#039;,&lt;br /&gt;
		tx = &amp;#039;个&amp;#039;,&lt;br /&gt;
		plx = &amp;#039;仝&amp;#039;,&lt;br /&gt;
		pnx = &amp;#039;今&amp;#039;,&lt;br /&gt;
		dx = &amp;#039;竜&amp;#039;,&lt;br /&gt;
		e = &amp;#039;象&amp;#039;,&lt;br /&gt;
		a = &amp;#039;太&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	-- spit out the character corresponding to abbreviation&lt;br /&gt;
	-- if the abbreviation string is empty, then spit out nobreak space (for html tables)		&lt;br /&gt;
	piece = piecenames[abbreviation] or &amp;#039;&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
	return string.format( piece )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- function separates out the piece, the side, and the boldness info present in the string argument&lt;br /&gt;
-- it returns an array with these three values plus the color (for promoted pieces)&lt;br /&gt;
-- this info is passed to the makeTD() function&lt;br /&gt;
function processString(ss)&lt;br /&gt;
	-- strip whitespace&lt;br /&gt;
	ss = mw.text.trim(ss)&lt;br /&gt;
	&lt;br /&gt;
	-- get the last character of the string&lt;br /&gt;
	local lastchar = mw.ustring.sub(ss, -1)&lt;br /&gt;
	&lt;br /&gt;
	-- chop off last character of string&lt;br /&gt;
	local restofstring = mw.ustring.sub(ss, 1, -2)&lt;br /&gt;
&lt;br /&gt;
	-- default is normal font&lt;br /&gt;
	-- but if the string ends with &amp;#039;l&amp;#039; for &amp;#039;last move&amp;#039;, &lt;br /&gt;
	-- then the font should be bold and we need to get a new string with the this &amp;#039;l&amp;#039; chopped off (with a new last character)&lt;br /&gt;
	local boldness = &amp;#039;normal&amp;#039;&lt;br /&gt;
	if lastchar:match(&amp;#039;l&amp;#039;) then&lt;br /&gt;
		boldness = &amp;#039;bold&amp;#039;&lt;br /&gt;
		lastchar = mw.ustring.sub(restofstring, -1)&lt;br /&gt;
		restofstring = mw.ustring.sub(restofstring, 1, -2)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- the side is either &amp;#039;g&amp;#039; for &amp;#039;gote&amp;#039; or &amp;#039;s&amp;#039; for &amp;#039;sente&amp;#039;&lt;br /&gt;
	-- it&amp;#039;s the last character in the string (and if the string ended)&lt;br /&gt;
	local side = lastchar&lt;br /&gt;
	&lt;br /&gt;
	-- the leftover string is the shogi piece abbreviation&lt;br /&gt;
	local pieceabbr = restofstring&lt;br /&gt;
	&lt;br /&gt;
	-- default is black font&lt;br /&gt;
	-- if the piece is promoted (one the abbreviations below), then the piece should be red&lt;br /&gt;
	local color = &amp;#039;black&amp;#039;&lt;br /&gt;
	if pieceabbr:match(&amp;#039;t&amp;#039;) or pieceabbr:match(&amp;#039;pl&amp;#039;) or pieceabbr:match(&amp;#039;pn&amp;#039;) or pieceabbr:match(&amp;#039;ps&amp;#039;) or pieceabbr:match(&amp;#039;h&amp;#039;) or pieceabbr:match(&amp;#039;d&amp;#039;) then&lt;br /&gt;
		color = &amp;#039;red&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- this is an exceptional bit:&lt;br /&gt;
	-- gote&amp;#039;s king is usually 王 instead of 玉 by convention, &lt;br /&gt;
	-- but it&amp;#039;s convenient to use the &amp;#039;k&amp;#039; code for both sente and gote and let the default character be side-dependent&lt;br /&gt;
	if pieceabbr:match(&amp;#039;k&amp;#039;) and side:match(&amp;#039;g&amp;#039;) then&lt;br /&gt;
		pieceabbr = &amp;#039;ou&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if pieceabbr:match(&amp;#039;k&amp;#039;) and side:match(&amp;#039;s&amp;#039;) then&lt;br /&gt;
		pieceabbr = &amp;#039;gyoku&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- similar to above exception, reverse default&lt;br /&gt;
	if pieceabbr:match(&amp;#039;ak&amp;#039;) and side:match(&amp;#039;s&amp;#039;) then&lt;br /&gt;
		pieceabbr = &amp;#039;ou&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if pieceabbr:match(&amp;#039;ak&amp;#039;) and side:match(&amp;#039;g&amp;#039;) then&lt;br /&gt;
		pieceabbr = &amp;#039;gyoku&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- convert abbreviation to Japanese character&lt;br /&gt;
	local piecechar = piecesymbol(pieceabbr)&lt;br /&gt;
	&lt;br /&gt;
	if ss:match(&amp;#039;yy&amp;#039;) or ss:match(&amp;#039;gr&amp;#039;) or ss:match(&amp;#039;rat&amp;#039;) or ss:match(&amp;#039;lat&amp;#039;) or ss:match(&amp;#039;uat&amp;#039;) or ss:match(&amp;#039;dat&amp;#039;) or &lt;br /&gt;
           ss:match(&amp;#039;lra&amp;#039;) or ss:match(&amp;#039;las&amp;#039;) or ss:match(&amp;#039;ras&amp;#039;) or ss:match(&amp;#039;uda&amp;#039;) or ss:match(&amp;#039;das&amp;#039;) or ss:match(&amp;#039;uas&amp;#039;) or &lt;br /&gt;
           ss:match(&amp;#039;da&amp;#039;) or ss:match(&amp;#039;dau&amp;#039;) or ss:match(&amp;#039;dad&amp;#039;) or ss:match(&amp;#039;daus&amp;#039;) or ss:match(&amp;#039;dads&amp;#039;) or ss:match(&amp;#039;daa&amp;#039;) or &lt;br /&gt;
           ss:match(&amp;#039;daad&amp;#039;) or ss:match(&amp;#039;daau&amp;#039;) or ss:match(&amp;#039;daaus&amp;#039;) or ss:match(&amp;#039;daads&amp;#039;) or ss:match(&amp;#039;kar&amp;#039;) or ss:match(&amp;#039;kal&amp;#039;) or &lt;br /&gt;
           ss:match(&amp;#039;kadr&amp;#039;) or ss:match(&amp;#039;kadl&amp;#039;) or ss:match(&amp;#039;rah&amp;#039;) or ss:match(&amp;#039;lah&amp;#039;) or ss:match(&amp;#039;dah&amp;#039;) or ss:match(&amp;#039;uah&amp;#039;) or &lt;br /&gt;
           ss:match(&amp;#039;durh&amp;#039;) or ss:match(&amp;#039;dulh&amp;#039;) or ss:match(&amp;#039;ddrh&amp;#039;) or ss:match(&amp;#039;ddlh&amp;#039;) or ss:match(&amp;#039;ddl&amp;#039;) or ss:match(&amp;#039;ddr&amp;#039;) or &lt;br /&gt;
           ss:match(&amp;#039;dul&amp;#039;) or ss:match(&amp;#039;dur&amp;#039;) then&lt;br /&gt;
		piecechar = &amp;#039;[[File:shogi_&amp;#039; .. ss .. &amp;#039;22.svg|20px]]&amp;#039;&lt;br /&gt;
		side = &amp;#039;arrow&amp;#039;&lt;br /&gt;
		color = &amp;#039;arrow&amp;#039;&lt;br /&gt;
		boldness = &amp;#039;arrow&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local result = {piecechar, side, color, boldness}&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- function makes a &amp;lt;td&amp;gt; containing the piece with CSS stuff&lt;br /&gt;
-- uses the info from processString() to customize the CSS based on which side, color, and boldness&lt;br /&gt;
function makeTD(stringarg)&lt;br /&gt;
	-- got to process the string argument into its informational bits&lt;br /&gt;
	-- this processedstring is an array (or whatever the equivalent is in Lua)&lt;br /&gt;
	local processedstring = processString(stringarg)&lt;br /&gt;
	-- saving the pieces of the array as separate objects to be referred to below&lt;br /&gt;
	local piecechar = processedstring[1]&lt;br /&gt;
	local side = processedstring[2]&lt;br /&gt;
	local color = processedstring[3]&lt;br /&gt;
	local bold = processedstring[4]&lt;br /&gt;
	&lt;br /&gt;
	-- i guess one needs a root node?&lt;br /&gt;
	local root = mw.html.create(&amp;#039;&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	-- the default &amp;lt;td&amp;gt;&lt;br /&gt;
	local td = root:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;border&amp;#039;, &amp;#039;black 1px solid&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;width&amp;#039;, &amp;#039;20px&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;height&amp;#039;, &amp;#039;20px&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;padding&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;line-height&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;font-family&amp;#039;, &amp;#039;&amp;quot;Hiragino Mincho ProN&amp;quot;, serif&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
		if not side:match(&amp;#039;arrow&amp;#039;) then&lt;br /&gt;
			td:wikitext( piecechar )&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
	-- g = gote&lt;br /&gt;
	-- gote should be upside down text&lt;br /&gt;
	if side:match( &amp;#039;g&amp;#039; ) then&lt;br /&gt;
		td:css(&amp;#039;transform&amp;#039;, &amp;#039;rotate(180deg)&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- for promoted pieces&lt;br /&gt;
	if color:match( &amp;#039;red&amp;#039; ) then&lt;br /&gt;
		-- this is a darkish reddish color&lt;br /&gt;
		td:css(&amp;#039;color&amp;#039;, &amp;#039;#E00303&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- for bold pieces&lt;br /&gt;
	if bold:match( &amp;#039;bold&amp;#039; ) then&lt;br /&gt;
		td:css(&amp;#039;font-weight&amp;#039;, &amp;#039;bolder&amp;#039;)&lt;br /&gt;
		-- traditionally bold type is gothic (sans serif) in Japanese typesetting of shogi diagrams within Japanese shogi books&lt;br /&gt;
		td:css(&amp;#039;font-family&amp;#039;, &amp;#039; HiraginoSans-W5, sans-serif&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- for arrow svgs &lt;br /&gt;
	if side:match(&amp;#039;arrow&amp;#039;) then&lt;br /&gt;
		td:css(&amp;#039;padding&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;width&amp;#039;, &amp;#039;20px&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;height&amp;#039;, &amp;#039;20px&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;font-size&amp;#039;, &amp;#039;1px&amp;#039;)&lt;br /&gt;
		td:css(&amp;#039;line-height&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		td:wikitext( piecechar )&lt;br /&gt;
	end&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- function makes the shogi diagram&lt;br /&gt;
-- this is basically a &amp;lt;div&amp;gt; enclosing a .css &amp;lt;div&amp;gt; wrapper with a &amp;lt;table&amp;gt; inside&lt;br /&gt;
function shogiboard(args)&lt;br /&gt;
	-- these are the column coordinate labels 9-1&lt;br /&gt;
	local colLabels = {&amp;#039;9&amp;#039;, &amp;#039;8&amp;#039;, &amp;#039;7&amp;#039;, &amp;#039;6&amp;#039;, &amp;#039;5&amp;#039;, &amp;#039;4&amp;#039;, &amp;#039;3&amp;#039;, &amp;#039;2&amp;#039;, &amp;#039;1&amp;#039;, &amp;#039;&amp;amp;nbsp;&amp;#039;}&lt;br /&gt;
	-- these are the row coordinate labels a-i (western notation)&lt;br /&gt;
	local rowLabels = {&amp;#039;1&amp;#039;, &amp;#039;2&amp;#039;, &amp;#039;3&amp;#039;, &amp;#039;4&amp;#039;, &amp;#039;5&amp;#039;, &amp;#039;6&amp;#039;, &amp;#039;7&amp;#039;, &amp;#039;8&amp;#039;, &amp;#039;9&amp;#039;}&lt;br /&gt;
	-- these are the row coordinate labels 1-9 (Japanese notation)&lt;br /&gt;
	-- this isn&amp;#039;t set up for use yet&lt;br /&gt;
	local rowLabelsJP = {&amp;#039;一&amp;#039;, &amp;#039;二&amp;#039;, &amp;#039;三&amp;#039;, &amp;#039;四&amp;#039;, &amp;#039;五&amp;#039;, &amp;#039;六&amp;#039;, &amp;#039;七&amp;#039;, &amp;#039;八&amp;#039;, &amp;#039;九&amp;#039;}&lt;br /&gt;
	&lt;br /&gt;
	local headerarg = args[2]&lt;br /&gt;
	local toppieceinhandarg = args[3]&lt;br /&gt;
	&lt;br /&gt;
	local root = mw.html.create(&amp;#039;div&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	-- &amp;lt;div&amp;gt; wrapper&lt;br /&gt;
	local shogiboardwrapper = root:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
		:addClass(&amp;#039;shogiboardwrapper&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;padding-left&amp;#039;, &amp;#039;4px&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;padding-bottom&amp;#039;, &amp;#039;2px&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	-- the diagram header/caption&lt;br /&gt;
	local headerstring = mw.text.trim(headerarg)&lt;br /&gt;
	local header = shogiboardwrapper:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
		header:css(&amp;#039;padding&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		header:wikitext(headerstring)&lt;br /&gt;
		header:css(&amp;#039;font-size&amp;#039;, &amp;#039;14px&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	-- this is the &amp;#039;piece-in-hand&amp;#039; argument for gote&lt;br /&gt;
	-- strip whitespace&lt;br /&gt;
	local strippedpieceinhandtop = mw.text.trim(toppieceinhandarg) or &amp;#039;&amp;#039;&lt;br /&gt;
	-- put it in a &amp;lt;div&amp;gt; with .css formating&lt;br /&gt;
	local pieceinhandtopdiv = shogiboardwrapper:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
		pieceinhandtopdiv:css(&amp;#039;padding&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		pieceinhandtopdiv:css(&amp;#039;font-size&amp;#039;, &amp;#039;12px&amp;#039;)&lt;br /&gt;
		pieceinhandtopdiv:wikitext(&amp;#039;☖ pieces in hand: &amp;#039;)&lt;br /&gt;
	-- i was going to put the actual argument text into conditional &amp;lt;span&amp;gt; .css formating, but i couldn&amp;#039;t get the logical test in an if/else structure right...&lt;br /&gt;
	local piecesinhandtopspan = pieceinhandtopdiv:tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
		piecesinhandtopspan:css(&amp;#039;font-size&amp;#039;, &amp;#039;13px&amp;#039;)&lt;br /&gt;
		piecesinhandtopspan:wikitext(strippedpieceinhandtop)&lt;br /&gt;
	&lt;br /&gt;
	-- the shogi table&lt;br /&gt;
	local shogitable = shogiboardwrapper:tag(&amp;#039;table&amp;#039;)&lt;br /&gt;
		:addClass(&amp;#039;shogitable&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;border&amp;#039;, &amp;#039;1&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;border-collapse&amp;#039;, &amp;#039;collapse&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;border&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;padding-top&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;background-color&amp;#039;, &amp;#039;white&amp;#039;)&lt;br /&gt;
		&lt;br /&gt;
	-- font size for the shogi piece text&lt;br /&gt;
	piecefontsize = &amp;#039;17px&amp;#039;&lt;br /&gt;
	-- font size for the column/row piece coordinate labels (9-1) and (a-i)&lt;br /&gt;
	colrowfontsize = &amp;#039;11px&amp;#039;&lt;br /&gt;
	-- padding amount for the row piece coordinate labels (a-i)&lt;br /&gt;
	padrowlab = &amp;#039;1px&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	-- the row for the column coordinate labels&lt;br /&gt;
	local columnlabelrow = shogitable:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-size&amp;#039;, colrowfontsize)&lt;br /&gt;
		:css(&amp;#039;background-color&amp;#039;, &amp;#039;#f9f9f9&amp;#039;)&lt;br /&gt;
	-- iterating over the column label to put each label in a &amp;lt;td&amp;gt;&lt;br /&gt;
	for i,v in ipairs(colLabels) do &lt;br /&gt;
		local td = columnlabelrow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, &amp;#039;20px&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;height&amp;#039;, &amp;#039;5px&amp;#039;)&lt;br /&gt;
			:wikitext( v )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- iterate over the 81 shogi piece arguments (left to right, top to bottom)&lt;br /&gt;
	&lt;br /&gt;
	-- index number displacement/offset&lt;br /&gt;
	-- this is just the number of arguments that precede the 81 shogi piece arguments that are in the html &amp;lt;table&amp;gt;&lt;br /&gt;
	-- i just keep the piece arguments as indexes 1-81, then add nx to the index value&lt;br /&gt;
	nx = 3&lt;br /&gt;
	-- loop for all rows&lt;br /&gt;
	for icols = 1,9 do&lt;br /&gt;
		local trow = shogitable:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, piecefontsize)&lt;br /&gt;
		-- put a single piece into a &amp;lt;td&amp;gt;&lt;br /&gt;
		-- iterate over 9 pieces in the row from offset -8 to 0&lt;br /&gt;
		for irow = (icols*9)-8,(icols*9) do&lt;br /&gt;
			trow:wikitext( makeTD(args[(irow+nx)]) )&lt;br /&gt;
		end&lt;br /&gt;
		-- add row coordinate label &amp;lt;td&amp;gt;&lt;br /&gt;
		local rowlabel = trow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, colrowfontsize)&lt;br /&gt;
			:css(&amp;#039;padding-left&amp;#039;, padrowlab)&lt;br /&gt;
			:css(&amp;#039;padding-top&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;padding-bottom&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;background-color&amp;#039;, &amp;#039;#f9f9f9&amp;#039;)&lt;br /&gt;
			:wikitext( rowLabels[icols] )&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- this is the &amp;#039;piece-in-hand&amp;#039; argument for sente (same as above for gote)&lt;br /&gt;
	-- only difference is the black shogi piece glyph (☗)&lt;br /&gt;
	local strippedpieceinhandbottom = mw.text.trim(args[81+1+nx]) or &amp;#039;&amp;#039;	&lt;br /&gt;
	local pieceinhandbottomdiv = shogiboardwrapper:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
		pieceinhandbottomdiv:css(&amp;#039;padding&amp;#039;, &amp;#039;0&amp;#039;)&lt;br /&gt;
		pieceinhandbottomdiv:css(&amp;#039;font-size&amp;#039;, &amp;#039;12px&amp;#039;)&lt;br /&gt;
		pieceinhandbottomdiv:wikitext(&amp;#039;☗ pieces in hand: &amp;#039;)&lt;br /&gt;
	local piecesinhandbottomspan = pieceinhandbottomdiv:tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
		piecesinhandbottomspan:css(&amp;#039;font-size&amp;#039;, &amp;#039;13px&amp;#039;)&lt;br /&gt;
		piecesinhandbottomspan:wikitext(strippedpieceinhandbottom)&lt;br /&gt;
		&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------------&lt;br /&gt;
-- main function &lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
function shogiobject.board(frame)&lt;br /&gt;
	-- need to use getParent().args for reasons i dont understand&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	return shogiboard(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return shogiobject&lt;/div&gt;</summary>
		<author><name>Kashi</name></author>
	</entry>
</feed>