diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index c3a059493e..9cd41ce557 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -213,20 +213,17 @@ class KINDLE(USBMS): divTag['class'] = 'user_annotations' # Add the last-read location - spanTag = ka_soup.new_tag('span') - spanTag['style'] = 'font-weight:bold' if bookmark.book_format == 'pdf': - spanTag.insert(0,BeautifulSoup( - _("%(time)s
Last page read: %(loc)d (%(pr)d%%)") % dict( + markup = _("%(time)s
Last page read: %(loc)d (%(pr)d%%)") % dict( time=strftime(u'%x', timestamp.timetuple()), loc=last_read_location, - pr=percent_read))) + pr=percent_read) else: - spanTag.insert(0,BeautifulSoup( - _("%(time)s
Last page read: Location %(loc)d (%(pr)d%%)") % dict( + markup = _("%(time)s
Last page read: Location %(loc)d (%(pr)d%%)") % dict( time=strftime(u'%x', timestamp.timetuple()), loc=last_read_location, - pr=percent_read))) + pr=percent_read) + spanTag = BeautifulSoup('' + markup + '').find('span') divTag.insert(dtc, spanTag) dtc += 1 @@ -261,7 +258,8 @@ class KINDLE(USBMS): typ=user_notes[location]['type'])) for annotation in annotations: - divTag.insert(dtc, BeautifulSoup(annotation)) + annot = BeautifulSoup('' + annotations + '').find('span') + divTag.insert(dtc, annot) dtc += 1 ka_soup.insert(0,divTag) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 9b07496cbb..a051d2951e 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -1222,20 +1222,17 @@ class KOBO(USBMS): divTag['class'] = 'user_annotations' # Add the last-read location - spanTag = ka_soup.new_tag('span') - spanTag['style'] = 'font-weight:normal' if bookmark.book_format == 'epub': - spanTag.insert(0,BeautifulSoup( - _("
Book last read: %(time)s
Percentage read: %(pr)d%%
") % dict( + markup = _("
Book last read: %(time)s
Percentage read: %(pr)d%%
") % dict( time=last_read, # loc=last_read_location, - pr=percent_read))) + pr=percent_read) else: - spanTag.insert(0,BeautifulSoup( - _("
Book last read: %(time)s
Percentage read: %(pr)d%%
") % dict( + markup = _("
Book last read: %(time)s
Percentage read: %(pr)d%%
") % dict( time=last_read, # loc=last_read_location, - pr=percent_read))) + pr=percent_read) + spanTag = BeautifulSoup('' + markup + '').find('span') divTag.insert(dtc, spanTag) dtc += 1 @@ -1294,7 +1291,8 @@ class KOBO(USBMS): annotation=user_notes[location]['annotation'])) for annotation in annotations: - divTag.insert(dtc, BeautifulSoup(annotation)) + annot = BeautifulSoup('' + annotations + '').find('span') + divTag.insert(dtc, annot) dtc += 1 ka_soup.insert(0,divTag)