Browse Source

replace story page id number by summary title sanitazed

Bachir Soussi Chiadmi 7 years ago
parent
commit
812b50f0be
1 changed files with 5 additions and 3 deletions
  1. 5 3
      bin/build.py

+ 5 - 3
bin/build.py

@@ -98,8 +98,10 @@ def generate_html(book, toc):
 
    pi = 0
    for p in toc:
-      print(toc[p]['file'])
-      pagename = toc[p]['file'].replace('.md', '')
+      # print(toc[p])
+      pagename = toc[p]['label']
+      pageid = re.sub('[^a-z0-9]+', '-', pagename.lower())
+      print(pageid)
 
       # files
       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
-      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_dom.append(story_page)