Bug fix
This commit is contained in:
6
epub.py
6
epub.py
@@ -209,6 +209,7 @@ class ContentParser(HTMLParser):
|
|||||||
self._paragraph_data = ''
|
self._paragraph_data = ''
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
self.footnote = ''
|
self.footnote = ''
|
||||||
|
self.img_index = 0
|
||||||
|
|
||||||
def handle_data(self, data: str):
|
def handle_data(self, data: str):
|
||||||
if self._in_paragraph:
|
if self._in_paragraph:
|
||||||
@@ -265,7 +266,6 @@ class ContentParser(HTMLParser):
|
|||||||
root = self
|
root = self
|
||||||
self.footnote = ''
|
self.footnote = ''
|
||||||
data = ''
|
data = ''
|
||||||
img_index = 0
|
|
||||||
for i in data_list:
|
for i in data_list:
|
||||||
if isinstance(i, str):
|
if isinstance(i, str):
|
||||||
if default_data_list:
|
if default_data_list:
|
||||||
@@ -275,11 +275,11 @@ class ContentParser(HTMLParser):
|
|||||||
elif isinstance(i, HTMLImage):
|
elif isinstance(i, HTMLImage):
|
||||||
if i.is_valid():
|
if i.is_valid():
|
||||||
try:
|
try:
|
||||||
data += i.to_local(img_index)
|
data += i.to_local(root.img_index)
|
||||||
self.images.append(i)
|
self.images.append(i)
|
||||||
if i.footnote:
|
if i.footnote:
|
||||||
root.footnote += i.footnote
|
root.footnote += i.footnote
|
||||||
img_index += 1
|
root.img_index += 1
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("the image is not valid.", i.src)
|
print("the image is not valid.", i.src)
|
||||||
elif isinstance(i, list):
|
elif isinstance(i, list):
|
||||||
|
|||||||
Reference in New Issue
Block a user