From 1d23886c121f92862b36be0a3dee6070397f2f02 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Nov 2011 09:59:22 +0530 Subject: [PATCH] Book jacket generation: Add ability to customize the book jacket template and add custom columns into the jacket. Fixes #889912 ([Enhancement] Add metadata from custom columns to jacket) --- resources/jacket/template.xhtml | 8 ++++++++ src/calibre/ebooks/oeb/transforms/jacket.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/resources/jacket/template.xhtml b/resources/jacket/template.xhtml index 056ac0aad3..f76a126309 100644 --- a/resources/jacket/template.xhtml +++ b/resources/jacket/template.xhtml @@ -36,6 +36,14 @@
+ +
{comments}
diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index d3b66d1e81..987fe0ce86 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -171,6 +171,14 @@ def render_jacket(mi, output_profile, comments=comments, footer='' ) + for key in mi.custom_field_keys(): + try: + display_name, val = mi.format_field_extended(key)[:2] + key = key.replace('#', '_') + args[key] = val + args[key+'_label'] = display_name + except: + pass generated_html = P('jacket/template.xhtml', data=True).decode('utf-8').format(**args)