mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix using --insert-metadata with ebook-convert not inserting the title and author metadata from the source document
This commit is contained in:
parent
c68a5c8ab1
commit
78b7112012
@ -119,8 +119,13 @@ class Jacket(Base):
|
|||||||
except:
|
except:
|
||||||
title = _('Unknown')
|
title = _('Unknown')
|
||||||
|
|
||||||
|
try:
|
||||||
|
authors = list(map(unicode_type, self.oeb.metadata.creator))
|
||||||
|
except:
|
||||||
|
authors = [_('Unknown')]
|
||||||
|
|
||||||
root = render_jacket(mi, self.opts.output_profile,
|
root = render_jacket(mi, self.opts.output_profile,
|
||||||
alt_title=title, alt_tags=tags,
|
alt_title=title, alt_tags=tags, alt_authors=authors,
|
||||||
alt_comments=comments, rescale_fonts=True)
|
alt_comments=comments, rescale_fonts=True)
|
||||||
id, href = self.oeb.manifest.generate('calibre_jacket', 'jacket.xhtml')
|
id, href = self.oeb.manifest.generate('calibre_jacket', 'jacket.xhtml')
|
||||||
|
|
||||||
@ -202,7 +207,7 @@ class Tags(unicode_type):
|
|||||||
|
|
||||||
def render_jacket(mi, output_profile,
|
def render_jacket(mi, output_profile,
|
||||||
alt_title=_('Unknown'), alt_tags=[], alt_comments='',
|
alt_title=_('Unknown'), alt_tags=[], alt_comments='',
|
||||||
alt_publisher=(''), rescale_fonts=False):
|
alt_publisher='', rescale_fonts=False, alt_authors=None):
|
||||||
css = P('jacket/stylesheet.css', data=True).decode('utf-8')
|
css = P('jacket/stylesheet.css', data=True).decode('utf-8')
|
||||||
template = P('jacket/template.xhtml', data=True).decode('utf-8')
|
template = P('jacket/template.xhtml', data=True).decode('utf-8')
|
||||||
|
|
||||||
@ -210,7 +215,7 @@ def render_jacket(mi, output_profile,
|
|||||||
css = re.sub(r'/\*.*?\*/', '', css, flags=re.DOTALL)
|
css = re.sub(r'/\*.*?\*/', '', css, flags=re.DOTALL)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
title_str = mi.title if mi.title else alt_title
|
title_str = alt_title if mi.is_null('title') else mi.title
|
||||||
except:
|
except:
|
||||||
title_str = _('Unknown')
|
title_str = _('Unknown')
|
||||||
title_str = escape(title_str)
|
title_str = escape(title_str)
|
||||||
@ -218,7 +223,7 @@ def render_jacket(mi, output_profile,
|
|||||||
|
|
||||||
series = Series(mi.series, mi.series_index)
|
series = Series(mi.series, mi.series_index)
|
||||||
try:
|
try:
|
||||||
publisher = mi.publisher if mi.publisher else alt_publisher
|
publisher = mi.publisher if not mi.is_null('publisher') else alt_publisher
|
||||||
except:
|
except:
|
||||||
publisher = ''
|
publisher = ''
|
||||||
publisher = escape(publisher)
|
publisher = escape(publisher)
|
||||||
@ -242,10 +247,14 @@ def render_jacket(mi, output_profile,
|
|||||||
if comments:
|
if comments:
|
||||||
comments = comments_to_html(comments)
|
comments = comments_to_html(comments)
|
||||||
|
|
||||||
|
orig = mi.authors
|
||||||
|
if mi.is_null('authors'):
|
||||||
|
mi.authors = list(alt_authors or (_('Unknown'),))
|
||||||
try:
|
try:
|
||||||
author = mi.format_authors()
|
author = mi.format_authors()
|
||||||
except:
|
except:
|
||||||
author = ''
|
author = ''
|
||||||
|
mi.authors = orig
|
||||||
author = escape(author)
|
author = escape(author)
|
||||||
|
|
||||||
def generate_html(comments):
|
def generate_html(comments):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user