diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py
index b7ece0bc78..c0065c24c9 100644
--- a/src/calibre/library/catalog.py
+++ b/src/calibre/library/catalog.py
@@ -1,4 +1,4 @@
-import datetime, htmlentitydefs, os, re, shutil, time, traceback
+import datetime, htmlentitydefs, os, re, shutil, time
from collections import namedtuple
from copy import deepcopy
@@ -2205,9 +2205,23 @@ class EPUB_MOBI(CatalogPlugin):
textTag = Tag(ncx_soup, "text")
if book['series']:
tokens = book['title'].split(': ')
- textTag.insert(0, NavigableString(self.formatNCXText('%s (%s)' % (tokens[1], tokens[0]), dest='title')))
+ if self.generateForKindle:
+ # Don't include Author for Kindle
+ textTag.insert(0, NavigableString(self.formatNCXText('%s (%s)' % \
+ (tokens[1], tokens[0]), dest='title')))
+ else:
+ # Include Author for non-Kindle
+ textTag.insert(0, NavigableString(self.formatNCXText('%s · %s (%s)' % \
+ (tokens[1], book['author'], tokens[0]), dest='title')))
else:
- textTag.insert(0, NavigableString(self.formatNCXText(book['title'], dest='title')))
+ if self.generateForKindle:
+ # Don't include Author for Kindle
+ textTag.insert(0, NavigableString(self.formatNCXText('%s' % (book['title']),
+ dest='title')))
+ else:
+ # Include Author for non-Kindle
+ textTag.insert(0, NavigableString(self.formatNCXText('%s · %s' % \
+ (book['title'], book['author']), dest='title')))
navLabelTag.insert(0,textTag)
navPointVolumeTag.insert(0,navLabelTag)
@@ -2221,7 +2235,7 @@ class EPUB_MOBI(CatalogPlugin):
cmTag['name'] = "author"
navStr = '%s | %s' % (self.formatNCXText(book['author'], dest='author'),
book['date'].split()[1])
- if 'tags' in book:
+ if 'tags' in book and len(book['tags']):
navStr = self.formatNCXText(navStr + ' | ' + ' · '.join(sorted(book['tags'])), dest='author')
cmTag.insert(0, NavigableString(navStr))
navPointVolumeTag.insert(2, cmTag)
@@ -3284,10 +3298,10 @@ class EPUB_MOBI(CatalogPlugin):
Deprecated HTML returns as HTML via BeautifulSoup()
'''
-
- # Explode lost CRs to \n\n
# Hackish - ignoring sentences ending or beginning in numbers to avoid
# confusion with decimal points.
+
+ # Explode lost CRs to \n\n
for lost_cr in re.finditer('([a-z])([\.\?!])([A-Z])',comments):
comments = comments.replace(lost_cr.group(),
'%s%s\n\n%s' % (lost_cr.group(1),
@@ -3309,6 +3323,8 @@ class EPUB_MOBI(CatalogPlugin):
# Convert solo returns to
comments = re.sub('[\r\n]','
', comments)
+ # Convert two hypens to emdash
+ comments = re.sub('--','—',comments)
soup = BeautifulSoup(comments)
result = BeautifulSoup()