Commit 1aa08dc
gaoflow
pgn: accept tag pairs with leading whitespace (fixes #1115)
The PGN standard specifies that whitespace is not significant.
`read_game()` was checking `line.startswith("[")` and matching
`TAG_REGEX` against the raw line, both of which fail when a tag pair
is preceded by horizontal whitespace (e.g. a file that begins with
" [Event ...]").
Strip leading whitespace before the `startswith` guard and the regex
match so that indented tag pairs are recognised correctly.1 parent 8330cfd commit 1aa08dc
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1636 | 1636 | | |
1637 | 1637 | | |
1638 | 1638 | | |
1639 | | - | |
| 1639 | + | |
| 1640 | + | |
1640 | 1641 | | |
1641 | 1642 | | |
1642 | 1643 | | |
1643 | 1644 | | |
1644 | 1645 | | |
1645 | | - | |
| 1646 | + | |
1646 | 1647 | | |
1647 | 1648 | | |
1648 | 1649 | | |
| |||
0 commit comments