mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Catalog generation: Support pseudo-list strings from composite columns
This commit is contained in:
commit
9518dcef80
@ -1531,10 +1531,23 @@ class EPUB_MOBI(CatalogPlugin):
|
||||
self.opts.header_note_source_field,
|
||||
index_is_id=True)
|
||||
if notes:
|
||||
if field_md['datatype'] == 'text' and isinstance(notes,list):
|
||||
if field_md['datatype'] == 'text':
|
||||
if isinstance(notes,list):
|
||||
notes = ' · '.join(notes)
|
||||
elif field_md['datatype'] == 'datetime':
|
||||
notes = format_date(notes,'dd MMM yyyy')
|
||||
elif field_md['datatype'] == 'composite':
|
||||
m = re.match(r'\[(.+)\]$', notes)
|
||||
if m is not None:
|
||||
# Sniff for special pseudo-list string "[<item, item>]"
|
||||
bracketed_content = m.group(1)
|
||||
if ',' in bracketed_content:
|
||||
# Recast the comma-separated items as a list
|
||||
items = bracketed_content.split(',')
|
||||
items = [i.strip() for i in items]
|
||||
notes = ' · '.join(items)
|
||||
else:
|
||||
notes = bracketed_content
|
||||
this_title['notes'] = {'source':field_md['name'],
|
||||
'content':notes}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user