replace story page id number by summary title sanitazed

This commit is contained in:
Bachir Soussi Chiadmi
2017-05-20 11:22:37 +02:00
parent 83d2818723
commit 812b50f0be
+5 -3
View File
@@ -98,8 +98,10 @@ def generate_html(book, toc):
pi = 0 pi = 0
for p in toc: for p in toc:
print(toc[p]['file']) # print(toc[p])
pagename = toc[p]['file'].replace('.md', '') pagename = toc[p]['label']
pageid = re.sub('[^a-z0-9]+', '-', pagename.lower())
print(pageid)
# files # files
in_f = os.path.join(_BOOK_SRC, toc[p]['file']) in_f = os.path.join(_BOOK_SRC, toc[p]['file'])
@@ -152,7 +154,7 @@ def generate_html(book, toc):
# append html story page to template_dom # append html story page to template_dom
story_page = BeautifulSoup('<div class="story-page" id="story-page-'+str(pi)+'"></div>', 'html.parser') story_page = BeautifulSoup('<div class="story-page story-page-'+str(pi)+'" id="'+pageid+'"></div>', 'html.parser')
story_page.div.append(output_dom) story_page.div.append(output_dom)
story_dom.append(story_page) story_dom.append(story_page)