FB2 stores series info as `<sequence name="…" number="…"/>` inside `<title-info>`, but the foliate-js FB2 parser never read it, so `belongsTo.series` was always empty and the series name/index never surfaced in the library or book details. Refresh-metadata and re-import didn't help since they share the same parser path. Bumps the foliate-js submodule to pull in the `<sequence>` parsing (readest/foliate-js#28) and adds a regression test + fixture. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,25 @@ describe('Calibre series metadata', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('FB2 (title-info sequence)', () => {
|
||||
let book: BookDoc;
|
||||
|
||||
beforeAll(async () => {
|
||||
book = await loadFixture('sample-metadata.fb2', 'application/x-fictionbook+xml', 'FB2');
|
||||
});
|
||||
|
||||
it('extracts series name and position from the sequence element', () => {
|
||||
const series = getSeries(book);
|
||||
expect(series).toBeTruthy();
|
||||
expect(series!.name).toBe('Metadata Series');
|
||||
expect(series!.position).toBe('3');
|
||||
});
|
||||
|
||||
it('preserves the title', () => {
|
||||
expect(book.metadata.title).toBe('FB2 Metadata');
|
||||
});
|
||||
});
|
||||
|
||||
describe('CBZ (ComicInfo.xml + ComicBookInfo)', () => {
|
||||
let book: BookDoc;
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
|
||||
<description>
|
||||
<title-info>
|
||||
<genre>sf_fantasy</genre>
|
||||
<author>
|
||||
<first-name>Jane</first-name>
|
||||
<last-name>Doe</last-name>
|
||||
</author>
|
||||
<book-title>FB2 Metadata</book-title>
|
||||
<annotation>
|
||||
<p>A short annotation.</p>
|
||||
</annotation>
|
||||
<lang>en</lang>
|
||||
<sequence name="Metadata Series" number="3"/>
|
||||
</title-info>
|
||||
<document-info>
|
||||
<author>
|
||||
<first-name/>
|
||||
<last-name/>
|
||||
</author>
|
||||
<date value="2023-10-18">18 October 2023</date>
|
||||
<id>43AC9A08-92D4-432C-B908-FCE4992205CC</id>
|
||||
<version>1.0</version>
|
||||
</document-info>
|
||||
</description>
|
||||
<body>
|
||||
<title>
|
||||
<p>FB2 Metadata</p>
|
||||
</title>
|
||||
<section>
|
||||
<title>
|
||||
<p>Chapter 1</p>
|
||||
</title>
|
||||
<p>Hello world.</p>
|
||||
</section>
|
||||
</body>
|
||||
</FictionBook>
|
||||
+1
-1
Submodule packages/foliate-js updated: f518015950...d5e197c3de
Reference in New Issue
Block a user