Fix PGN parser: move extraction and Event header value
This commit is contained in:
@@ -21,8 +21,8 @@ function parseGameBlock(block) {
|
||||
|
||||
// Der Event-Header fehlt, weil wir danach splitten – extrahiere ihn aus dem Blockanfang
|
||||
const eventEnd = block.indexOf('"]');
|
||||
if (eventEnd > 0) {
|
||||
headers.Event = block.substring(0, eventEnd);
|
||||
if (eventEnd > 1) {
|
||||
headers.Event = block.substring(1, eventEnd);
|
||||
}
|
||||
|
||||
const headerRegex = /^\s*\[(\w+)\s+"([^"]*)"\]/gm;
|
||||
@@ -35,7 +35,7 @@ function parseGameBlock(block) {
|
||||
}
|
||||
|
||||
// Extract moves - everything after the last header
|
||||
const lastHeaderEnd = block.lastIndexOf(']"');
|
||||
const lastHeaderEnd = block.lastIndexOf('"]');
|
||||
let movesText = lastHeaderEnd > -1 ? block.substring(lastHeaderEnd + 2).trim() : '';
|
||||
|
||||
// Remove comments from moves for cleaner parsing
|
||||
|
||||
Reference in New Issue
Block a user