tokoharu / shogi_addon_for_anki Goto Github PK
View Code? Open in Web Editor NEWAnki向け将棋局面ビジュアライザ
Anki向け将棋局面ビジュアライザ
ごめんなさい
test.
I'll preface this bug report with two caveats:
I have a card template that just puts [kif][/kif] or [sfen][/sfen] around the raw contents of an anki field {{KIF}} or {{SFEN}} respectively. SFEN seems to work just fine - I haven't found any problems yet.
KIF on the other hand seems very fragile. Please consider the two following kifu, one of which is provided by you as a sample, the other of which is the first of a pack of 詰将棋 kifu.
1) Your Sample:
後手の持駒:飛二 角二 金二 銀四 桂四 香四 歩十八
9 8 7 6 5 4 3 2 1
+---------------------------+
| ・ ・ ・ ・v玉 ・ ・ ・ ・|一
| ・ ・ ・ ・ ・ ・ ・ ・ ・|二
| ・ ・ ・ ・ 金 ・ ・ ・ ・|三
| ・ ・ ・ ・ ・ ・ ・ ・ ・|四
| ・ ・ ・ ・ ・ ・ ・ ・ ・|五
| ・ ・ ・ ・ ・ ・ ・ ・ ・|六
| ・ ・ ・ ・ ・ ・ ・ ・ ・|七
| ・ ・ ・ ・ ・ ・ ・ ・ ・|八
| ・ ・ ・ ・ ・ ・ ・ ・ ・|九
+---------------------------+
先手の持駒:金
先手:
後手:
後手の持駒:飛二 角二 金二 銀四 桂四 香四 歩十八 9 8 7 6 5 4 3 2 1 +---------------------------+ | ・ ・ ・ ・v玉 ・ ・ ・ ・|一 | ・ ・ ・ ・ ・ ・ ・ ・ ・|二 | ・ ・ ・ ・ 金 ・ ・ ・ ・|三 | ・ ・ ・ ・ ・ ・ ・ ・ ・|四 | ・ ・ ・ ・ ・ ・ ・ ・ ・|五 | ・ ・ ・ ・ ・ ・ ・ ・ ・|六 | ・ ・ ・ ・ ・ ・ ・ ・ ・|七 | ・ ・ ・ ・ ・ ・ ・ ・ ・|八 | ・ ・ ・ ・ ・ ・ ・ ・ ・|九 +---------------------------+ 先手の持駒:金 先手: 後手:
CTRL+SHIFT+X
), it still doesn't work. Same problem as above. The Raw HTML obviously still contains exactly what the sample text kifu contains.<div>
formatting, which unfortunately seems to be significant for the way the plugin works:<div>後手の持駒:飛二 角二 金二 銀四 桂四 香四 歩十八 </div> <div> 9 8 7 6 5 4 3 2 1 </div> <div>+---------------------------+ </div> <div>| ・ ・ ・ ・v玉 ・ ・ ・ ・|一 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|二 </div> <div>| ・ ・ ・ ・ 金 ・ ・ ・ ・|三 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|四 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|五 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|六 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|七 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|八 </div> <div>| ・ ・ ・ ・ ・ ・ ・ ・ ・|九 </div> <div>+---------------------------+ </div> <div>先手の持駒:金 </div> <div>先手:</div> <div>後手:</div>
2) My 詰将棋 kifu
# ---- Kifu for Windows V4.01β 棋譜ファイル ----
# ファイル名:D:\b\temp\M2TOK141\KIFU\1t120600-1.kif
棋戦:1手詰
戦型:なし
手合割:平手
後手の持駒:飛 角 金四 銀三 桂四 香三 歩十七
9 8 7 6 5 4 3 2 1
+---------------------------+
| ・ ・ ・ ・ ・ ・ ・ ・v香|一
| ・ ・ ・ ・ 飛 馬 ・ ・v玉|二
| ・ ・ ・ ・ ・ ・ ・v歩 ・|三
| ・ ・ ・ ・ ・ ・v銀 ・ ・|四
| ・ ・ ・ ・ ・ ・ ・ ・ ・|五
| ・ ・ ・ ・ ・ ・ ・ ・ ・|六
| ・ ・ ・ ・ ・ ・ ・ ・ ・|七
| ・ ・ ・ ・ ・ ・ ・ ・ ・|八
| ・ ・ ・ ・ ・ ・ ・ ・ ・|九
+---------------------------+
先手の持駒:なし
先手:大内延介
後手:最新詰将棋200選
手数----指手---------消費時間--
*作者:大内延介
*発表誌:最新詰将棋200選
1 3一馬(42) ( 0:00/00:00:00)
2 中断 ( 0:00/00:00:00)
まで1手で中断
(the #
comment lines don't seem significant)
Debug info:
Anki 2.1.15 (442df9d6) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1
Platform: Linux
Flags: frz=False ao=True sv=2
Add-ons possibly involved: tokoharu_shogi
Caught exception:
File "/usr/share/anki/aqt/browser.py", line 98, in data
return self.columnData(index)
File "/usr/share/anki/aqt/browser.py", line 238, in columnData
return self.question(c)
File "/usr/share/anki/aqt/browser.py", line 292, in question
return htmlToTextLine(c.q(browser=True))
File "/usr/share/anki/anki/cards.py", line 120, in q
return self.css() + self._getQA(reload, browser)['q']
File "/usr/share/anki/anki/cards.py", line 137, in _getQA
self._qa = self.col._renderQA(data, *args)
File "/usr/share/anki/anki/collection.py", line 591, in _renderQA
d[type] = runFilter(
File "/usr/share/anki/anki/hooks.py", line 39, in runFilter
arg = func(arg, *args)
File "/home/adam/.local/share/Anki2/addons21/tokoharu_shogi/__init__.py", line 328, in make_kif_table
return kif_re.sub(insert_kif_table, txt)
File "/home/adam/.local/share/Anki2/addons21/tokoharu_shogi/__init__.py", line 276, in insert_kif_table
gote_str += get_mochi_kif(line)
File "/home/adam/.local/share/Anki2/addons21/tokoharu_shogi/__init__.py", line 265, in get_mochi_kif
ret += format_mochi(pdata[0], val)
<class 'IndexError'>: string index out of range
I have a large collection of 詰将棋 kifu files, and I was hoping to be able to create a deck by parsing out the initial board state as one Field (the question side), and the subsequent moves as another Field (the answer side), but it seems that this plugin doesn't use the kifu plaintext, and it also seems that there are some problems with Anki 2.1.
If you are still interested in maintaining this plugin, I would be very keen to hear back from you, and am willing to provide more details or test any changes as needed.
In Anki2.1.20+, following command cannot to be used (actually, this was deprecated command).
addHook("mungeQA", make_fen_table)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.