feat(metadata): surface calibre custom columns from EPUB metadata (#4939)

Parse calibre's embedded user metadata (custom columns) from the OPF
in foliate-js, store it on BookMetadata.calibreColumns, render the
columns in the book details view, and match column names and values
in the library search so a value like a recommends tag can be found
by typing it.

Closes #4811
This commit is contained in:
Huang Xin
2026-07-06 01:08:36 +09:00
committed by GitHub
parent 0b180da6a6
commit ec45a080fc
8 changed files with 345 additions and 4 deletions
@@ -19,6 +19,7 @@ import { useSettingsStore } from '@/store/settingsStore';
import { useEnv } from '@/context/EnvContext';
import {
formatAuthors,
formatCalibreColumnValue,
formatDate,
formatBytes,
formatLanguage,
@@ -273,6 +274,26 @@ const BookDetailView: React.FC<BookDetailViewProps> = ({
{metadata?.identifier || _('Unknown')}
</p>
</div>
{/*
Calibre custom columns embedded in the OPF (#4811). Column
names are user content, not translation keys. The identifier
cell above spans the full row on mobile, so alternate the
end-aligned style from a fresh even/odd count here.
*/}
{metadata?.calibreColumns?.map((column, index) => (
<div
key={column.label}
className={clsx(
'overflow-hidden',
index % 2 === 1 && 'pe-1 text-end sm:text-start',
)}
>
<span className='font-bold'>{column.name}</span>
<p className='text-neutral-content line-clamp-3 text-sm'>
{formatCalibreColumnValue(column)}
</p>
</div>
))}
{/*
Only books imported in-place (or files opened directly via the
OS, e.g. Android "Open with Readest") keep a `filePath`; books