mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Revised code to include custom column name in generated jacket when custom column contents is None.
This commit is contained in:
parent
8164622561
commit
d65dcd572a
@ -188,15 +188,22 @@ def render_jacket(mi, output_profile,
|
||||
footer=''
|
||||
)
|
||||
for key in mi.custom_field_keys():
|
||||
try:
|
||||
display_name, val = mi.format_field_extended(key)[:2]
|
||||
key = key.replace('#', '_')
|
||||
display_name, val = mi.format_field_extended(key)[:2]
|
||||
key = key.replace('#', '_')
|
||||
if val:
|
||||
args[key] = escape(val)
|
||||
args[key+'_label'] = escape(display_name)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
args[key] = ''
|
||||
args[key+'_label'] = escape(display_name)
|
||||
|
||||
if False:
|
||||
print("Custom column values available in jacket template:")
|
||||
for key in args.keys():
|
||||
if key.startswith('_') and not key.endswith('_label'):
|
||||
print(" %s: %s" % ('#' + key[1:], args[key]))
|
||||
|
||||
# Used in the comment describing use of custom columns in templates
|
||||
# Don't change this unless you also change it in template.xhtml
|
||||
args['_genre_label'] = args.get('_genre_label', '{_genre_label}')
|
||||
args['_genre'] = args.get('_genre', '{_genre}')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user