EPUB: fix opf:file-as

Fixes #39
This commit is contained in:
John Factotum
2024-11-03 11:19:14 +08:00
parent 519c0329b2
commit 24187b79f9
+2 -2
View File
@@ -224,7 +224,7 @@ const getMetadata = opf => {
} }
const makeContributor = x => x ? ({ const makeContributor = x => x ? ({
name: makeLanguageMap(x), name: makeLanguageMap(x),
sortAs: makeLanguageMap(x.props?.['file-as']?.[0]), sortAs: makeLanguageMap(x.props?.['file-as']?.[0]) ?? x.attrs['file-as'],
role: x.props?.role?.filter(x => x.scheme === PREFIX.marc + 'relators') role: x.props?.role?.filter(x => x.scheme === PREFIX.marc + 'relators')
?.map(x => x.value) ?? [x.attrs.role], ?.map(x => x.value) ?? [x.attrs.role],
code: prop(x, 'term') ?? x.attrs.term, code: prop(x, 'term') ?? x.attrs.term,
@@ -262,7 +262,7 @@ const getMetadata = opf => {
identifier: getIdentifier(opf), identifier: getIdentifier(opf),
title: makeLanguageMap(mainTitle), title: makeLanguageMap(mainTitle),
sortAs: makeLanguageMap(mainTitle?.props?.['file-as']?.[0]) sortAs: makeLanguageMap(mainTitle?.props?.['file-as']?.[0])
?? makeLanguageMap(mainTitle?.attrs?.['file-as']) ?? mainTitle?.attrs?.['file-as']
?? legacyMeta?.['calibre:title_sort'], ?? legacyMeta?.['calibre:title_sort'],
subtitle: dc.title?.find(x => prop(x, 'title-type') === 'subtitle')?.value, subtitle: dc.title?.find(x => prop(x, 'title-type') === 'subtitle')?.value,
language: dc.language?.map(x => x.value), language: dc.language?.map(x => x.value),