Skip to content
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

Variations in combination with comments #260

Closed
queribox opened this issue Apr 10, 2023 · 2 comments
Closed

Variations in combination with comments #260

queribox opened this issue Apr 10, 2023 · 2 comments
Labels

Comments

@queribox
Copy link

queribox commented Apr 10, 2023

I really like the fact that this plugin tries to follow pgn as strict as possible!

It looks like the interpreter has some problems when both a variation and some comments are placed between two moves:

[pgn]
1.e4 e6 {French, I thought he would play Carokann} (1...c6){, but fortunately I like French too} 2.d4 d5 {and white wins}*
[/pgn]

has as a result:

1.e4 e6, but fortunately I like French too (1…c6) 2.d4 d5 and white wins

Since this looks like straightforward pgn, I hope you have a solution for this behaviour

@yo35
Copy link
Owner

yo35 commented Apr 10, 2023

There are two things here.

First of all, the fact that parser erases the text comment "French, I thought he would play Carokann" is a bug. This comment has to be rendered in some way. This is a bug.

But on the other hand, putting a text comment just between the end of a sub-variation (i.e. (1...c6)) and the following move (i.e. 2.d4) is not supported by the parser, and that is the expected behavior. The way the parser works, a text comment is always linked:

  1. to the previous move in the same variation,
  2. or to the beginning of the variation if it appears before the first move of the variation.

For instance, with

1.e4 e6 ({Comment A} 1...c6 {Comment B}) {Comment C} 2.d4

... Comment C is linked to move 1...e6 in the main variation, Comment B is linked to move 1...c6 in the sub-variation, and Comment A is linked to the beginning of the sub-variation. And during the restitution, a text comment always rendered just after the move it relates to (or at the very beginning of the sub-variation if it is linked to a sub-variation).

Hence, in your example, the expected output is:

1.e4 e6 French, I thought he would play Carokann , but fortunately I like French too (1…c6) 2.d4 d5 and white wins

This is what you will obtain with version 7.5.1 (just released).

But considering the meaning of the text comments in this particular example, I would suggest instead to write them as:

1.e4 e6 {French} ({I thought he would play Carokann} 1...c6 {but fortunately I like French too}) 2.d4 d5 {and white wins} *

@yo35 yo35 added the bug label Apr 10, 2023
@queribox
Copy link
Author

Thanx for fixing the bug. I can live with the way you implemented it. Some clubmembers are generating pgn via all kind of of (online) programs. Before publishing we have to check the way it looks on the website of the club. No problem and thanx again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants