replace story page id number by summary title sanitazed
This commit is contained in:
+5
-3
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user