Open ChessBase databases (.cbh, .cbv) and zip/7z archives
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run

New crate chess-import converts non-PGN sources to PGN in memory and returns
a PgnDatabase, so the library, notation and analysis work unchanged:
- .cbv archives (container rewritten after uncbv), .cbh with companion files
  (layout after the public Morphy format description): games, variations,
  comments with per-database code page detection, NAGs, squares/arrows, set-up
  positions, time spent, book chapters (guiding texts) as move-less records;
- ChessBase figurines become piece letters, diagram/object markers handled,
  Western names in Cyrillic databases read correctly;
- .zip/.7z with PGN (own encoding each), .cbh and .cbv; duplicates skipped;
- .cbz/encrypted archives and 2CBH rejected with clear messages.
Library: '+ Add database', format shown, import notes; comments keep
paragraph breaks. Tests on the user's sample books (skipped when absent).

Also: AUR PKGBUILD for 0.2.0 with the bundled Stockfish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubel 2026-10-18 13:18:27 +03:00
parent 26bf901124
commit bb7d3b3fa6
31 changed files with 3618 additions and 64 deletions

View file

@ -354,12 +354,24 @@ fn comment_text(comments: &[String]) -> String {
for c in comments {
for part in parse_comment(c) {
if let CommentPart::Text(t) = part {
// Source line breaks are formatting, not content: reflow to the panel width.
for word in t.split_whitespace() {
if !out.is_empty() {
out.push(' ');
// Single line breaks are formatting, not content: reflow to the panel width.
// A blank line starts a new paragraph (book chapters imported from ChessBase).
let mut blank = false;
for line in t.lines() {
if line.trim().is_empty() {
blank = true;
continue;
}
if blank && !out.is_empty() {
out.push_str("\n\n");
}
blank = false;
for word in line.split_whitespace() {
if !out.is_empty() && !out.ends_with('\n') {
out.push(' ');
}
out.push_str(word);
}
out.push_str(word);
}
}
}