fixed img path

This commit is contained in:
Bachir Soussi Chiadmi
2017-05-08 16:57:58 +02:00
parent 17c1c441fb
commit b7cc198f32
+14 -6
View File
@@ -124,15 +124,16 @@ def generate_html(book, toc):
# outputfile=out_f)
output_dom = BeautifulSoup(output, 'html.parser')
# append html story page to template_dom
story_page = BeautifulSoup('<div class="story-page" id="story-page-'+str(pi)+'"></div>', 'html.parser')
story_page.div.append(output_dom)
story_dom.append(story_page)
# copy images
for img in output_dom.find_all('img'):
# print('-- img ',img)
att_src = re.sub(r"^\/", "", img['src'])
img['src'] = att_src
# domimg = output_dom.find('img', {'src':img['src']})
# domimg['src'] = att_src
# print(domimg)
src_img = os.path.join(_BOOK_SRC, att_src)
# print('- - '+src_img)
@@ -149,6 +150,13 @@ def generate_html(book, toc):
shutil.copyfile(src_img, dest_img)
# append html story page to template_dom
story_page = BeautifulSoup('<div class="story-page" id="story-page-'+str(pi)+'"></div>', 'html.parser')
story_page.div.append(output_dom)
story_dom.append(story_page)
pi = pi+1
# create main html file from filled template html dom