-
-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way to write multiple comments on a move? #946
Comments
Hi. It's currently not really possible (except by subclassing By the way, which PGN viewer has this requirement? |
This is how Lichess.org outputs comments + annotations: 2... Nf6 { Queen's Gambit Declined - Marshall defense } { [%csl Gc4][%cal Gc4d5] } And Chesstempo.org: 1.e4 e5 { This is a comment } {[%cal Gf2f5,Gg2g3][%csl Gb3,Yc4]} And this NodeJS library for parsing PGN files seem to want it formatted this way too. https://www.npmjs.com/package/pgn-parser Check out test/test_grammer.js around line 170 for a test that tells alot. I have sort of gotten around this by now by creating python script using your parser and a hack that inserts } { between the text part and the [% part after it is printed, but at least based on these three frameworks/sites I would guess this would be something good to support. |
I'm trying to use python-chess to merge two pgn games, which is working fine. But it appears some PGN viewers really want the normal text comments and the %cal and %csl annotations separated into their own comment, like so:
I seem to have no way to create this type of comment since the "comment" field in the GameNode class in pgn.py is a string, when I think I want it to be a list of strings. So I end up with this:
I have also tried setting node.comment = f"{text} }} {{ {annotations}" , ie injecting a } and a { inside the comment but it doesn't work, and is hacky anyway. It appears to insert the { but the } never appears.
What's your take on this? Just something the library doesn't support?
The text was updated successfully, but these errors were encountered: