mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
GwR add support for lists in notes field
This commit is contained in:
parent
93ff7258e6
commit
3407f7cf0d
@ -1524,17 +1524,17 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
this_title['formats'] = formats
|
this_title['formats'] = formats
|
||||||
|
|
||||||
# Add user notes to be displayed in header
|
# Add user notes to be displayed in header
|
||||||
# Special case handling for datetime fields
|
# Special case handling for datetime fields and lists
|
||||||
if self.opts.header_note_source_field:
|
if self.opts.header_note_source_field:
|
||||||
field_md = self.__db.metadata_for_field(self.opts.header_note_source_field)
|
field_md = self.__db.metadata_for_field(self.opts.header_note_source_field)
|
||||||
notes = self.__db.get_field(record['id'],
|
notes = self.__db.get_field(record['id'],
|
||||||
self.opts.header_note_source_field,
|
self.opts.header_note_source_field,
|
||||||
index_is_id=True)
|
index_is_id=True)
|
||||||
if notes and field_md['datatype'] == 'datetime':
|
|
||||||
# Reformat date fields to match UI presentation: dd MMM YYYY
|
|
||||||
notes = format_date(notes,'dd MMM yyyy')
|
|
||||||
|
|
||||||
if notes:
|
if notes:
|
||||||
|
if field_md['datatype'] == 'text' and isinstance(notes,list):
|
||||||
|
notes = ' · '.join(notes)
|
||||||
|
elif field_md['datatype'] == 'datetime':
|
||||||
|
notes = format_date(notes,'dd MMM yyyy')
|
||||||
this_title['notes'] = {'source':field_md['name'],
|
this_title['notes'] = {'source':field_md['name'],
|
||||||
'content':notes}
|
'content':notes}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user