mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Port use of BS in Kindle and Kobo drivers
This commit is contained in:
parent
2fc337d779
commit
5e097e3ac7
@ -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<br />Last page read: %(loc)d (%(pr)d%%)") % dict(
|
||||
markup = _("%(time)s<br />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<br />Last page read: Location %(loc)d (%(pr)d%%)") % dict(
|
||||
markup = _("%(time)s<br />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('<span style="font-weight:bold">' + markup + '</span>').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('<span>' + annotations + '</span>').find('span')
|
||||
divTag.insert(dtc, annot)
|
||||
dtc += 1
|
||||
|
||||
ka_soup.insert(0,divTag)
|
||||
|
@ -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(
|
||||
_("<hr /><b>Book last read:</b> %(time)s<br /><b>Percentage read:</b> %(pr)d%%<hr />") % dict(
|
||||
markup = _("<hr /><b>Book last read:</b> %(time)s<br /><b>Percentage read:</b> %(pr)d%%<hr />") % dict(
|
||||
time=last_read,
|
||||
# loc=last_read_location,
|
||||
pr=percent_read)))
|
||||
pr=percent_read)
|
||||
else:
|
||||
spanTag.insert(0,BeautifulSoup(
|
||||
_("<hr /><b>Book last read:</b> %(time)s<br /><b>Percentage read:</b> %(pr)d%%<hr />") % dict(
|
||||
markup = _("<hr /><b>Book last read:</b> %(time)s<br /><b>Percentage read:</b> %(pr)d%%<hr />") % dict(
|
||||
time=last_read,
|
||||
# loc=last_read_location,
|
||||
pr=percent_read)))
|
||||
pr=percent_read)
|
||||
spanTag = BeautifulSoup('<span style="font-weight:normal">' + markup + '</span>').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('<span>' + annotations + '</span>').find('span')
|
||||
divTag.insert(dtc, annot)
|
||||
dtc += 1
|
||||
|
||||
ka_soup.insert(0,divTag)
|
||||
|
Loading…
x
Reference in New Issue
Block a user