shaack / cm-pgn

Parse and create PGNs (Portable Game Notation for chess games)
MIT License
29 stars 20 forks source link

Bug fixes and enhancements to render() function in both History.js and Pgn.js #14

Closed goodvibs closed 1 year ago

goodvibs commented 1 year ago

The render() function now outputs PGNs with variations in the same format Lichess uses. Prior to this branch, there were a few bugs that caused the render() function in History.js to output strings that, although mostly followed the PGN standard, could be slightly unreadable. For example, for the PGN "1. e4 (1. d4) 1... e5" the previous render() function would output "1. e4 (1. d4) e5." Includes a few other bug fixes as well.

In addition, the render() function in History.js now accepts two optional boolean arguments: renderComments and renderNags. The values of these arguments dictate whether comments are rendered and nags are rendered, respectively. The render() function in Pgn.js now accepts the same two optional boolean arguments in addition to a third: renderHeader. The value of this argument dictates whether a header is rendered in the PGN.

I have performed basic unit tests to verify that History.js and Pgn.js work as intended, to the best of my knowledge. However, running more rigorous tests wouldn't hurt.

shaack commented 1 year ago

Thank you. 👍 Published as v2.3.0