Module:Shogi diagram
Appearance
![]() | This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Usage
{{#invoke:Shogi diagram|function_name}}
This module is called by Template:Shogi diagram.
Script error: The function "board" does not exist.
As the original template used .pngs/.svgs, when many templates were used on pages, the page load times became a bit long. In order to fix this, this module instead uses text. And, text is preferable anyway since it renders very sharp edges. The drawback is that it depends on web browser for rotated text – that is, the web browser must be a modern one.
It was based on Module:Chessboard.
local testobj = {}
local function piecesymbol(abbreviation)
-- strip whitespace
abbreviation = mw.text.trim(abbreviation)
-- letter to character mapping
local piecenames = {
p = '歩',
t = 'と',
l = '香',
pl = '杏',
n = '桂',
pn = '圭',
s = '銀',
ps = '全',
g = '金',
b = '角',
h = '馬',
r = '飛',
d = '龍',
k = '玉',
ak = '王',
tx = '个',
plx = '仝',
pnx = '今',
dx = '竜',
e = '象',
a = '太',
}
return string.format( piecenames[abbreviation] )
end
function testobj.testfunct(frame)
local arg = frame.args[1]
return piecesymbol(arg)
end
return testobj