This commit is contained in:
Maciej Caderek
2022-02-20 23:36:33 +01:00
parent 5de734392c
commit 9561b0cbf6
5 changed files with 31 additions and 12 deletions

View File

@@ -193,6 +193,21 @@ class Game {
);
}
getFileName(anonymous: boolean) {
const header = this.header;
const w = anonymous ? "Anonymous" : header.WhitePretty;
const b = anonymous ? "Anonymous" : header.BlackPretty;
return (
(header.Date
? `${header.Date.replace(/\?/g, "X").replace(/\./g, "-")}_`
: "") +
`${w}_${b}` +
(header.Event ? `_${header.Event}` : "") +
(header.Round ? `_R${header.Round}` : "")
).replace(/\s+/g, "-");
}
get pgn() {
return this.game.pgn();
}