deactivated yphenation and added more comments

This commit is contained in:
2018-09-29 18:41:09 +02:00
parent 947295f5c5
commit ffbb098e4d
+10 -3
View File
@@ -90,27 +90,33 @@ class Compiler():
pdoc_filters = [] pdoc_filters = []
# convert markdown from file to html
output = pypandoc.convert_file(in_f, output = pypandoc.convert_file(in_f,
to='html5', to='html5',
format='markdown+smart+header_attributes+link_attributes+bracketed_spans', format='markdown+smart+header_attributes+link_attributes+bracketed_spans',
extra_args=pdoc_args, extra_args=pdoc_args,
filters=pdoc_filters) filters=pdoc_filters)
# print(output)
# convert html string to parseable html dom
output_dom = BeautifulSoup(output, 'html.parser') output_dom = BeautifulSoup(output, 'html.parser')
# hyphenate paragraphes # hyphenate paragraphes
for node in output_dom.find_all('p'): # for node in output_dom.find_all('p'):
self.hyphenate(node) # self.hyphenate(node)
# append html story page to template_dom # append html story page to template_dom
# create a page dom
story_page = BeautifulSoup( story_page = BeautifulSoup(
'<div class="story-page story-page-'+str(pi)+'" id="'+pageid+'"></div>', '<div class="story-page story-page-'+str(pi)+'" id="'+pageid+'"></div>',
'html.parser' 'html.parser'
) )
# append to page dom the converted content
story_page.div.append(output_dom) story_page.div.append(output_dom)
# append to global dom content the page with contents
story_dom.append(story_page) story_dom.append(story_page)
# increment pahe index
pi = pi+1 pi = pi+1
# create main html file from filled template html dom # create main html file from filled template html dom
@@ -129,6 +135,7 @@ class Compiler():
# print("hyphenate") # print("hyphenate")
nodetext = node.get_text() nodetext = node.get_text()
# print(nodetext) # print(nodetext)
nodestr = str(node) nodestr = str(node)
# print(nodestr) # print(nodestr)
for word in nodetext.split(' '): for word in nodetext.split(' '):