def build_intro_html(intro_dict,chapter_numbers_dict):
# Prepare variables
first_chapter_number = chapter_numbers_dict["1"]
intro_text = intro_dict["intro_text"]
# Build page sections
# Make html header and title of page
title_section = title_section = ("""
"""+ "Story Intro" +"""
""")
# Chapter text
intro_text_section = "\n
"+intro_text
links_section = """\n
"""
# join html strings into one page
page_html = title_section + intro_text_section + links_section
encoded_html = page_html.encode('utf-8')
return encoded_html
def build_chapter_html(chapter_dict,chapter_numbers_dict):
# Make links
links_list = build_page_links(chapter_dict,chapter_numbers_dict)
# Extract data from dict
chapter_path = chapter_dict["chapter_path"]
chapter_title = chapter_dict["chapter_title"]
chapter_text = chapter_dict["chapter_text"]
chapter_author = chapter_dict["chapter_author"]
# join data together with html snippets
# Make html header and title of page
title_section = ("""
"""+ chapter_title +"""
""")
# Chapter title
chapter_title_section = chapter_title +" from path: "+ chapter_path
# Author name
chapter_author_section = "\n
By:" + chapter_author
# Chapter text
chapter_text_section = "\n
"+chapter_text
# Make links section of page
links_section = "\n
\n
Choices:\n
"
for link_html in links_list:
links_section += link_html
# Join sections together
page_html = title_section + chapter_title_section + chapter_author_section + chapter_text_section + links_section
encoded_html = page_html.encode('utf-8')
return encoded_html