Commit 83504d6d authored by Aram Verstegen's avatar Aram Verstegen
Browse files

Trying to improve dehyphenation

parent 24bad335
...@@ -466,10 +466,15 @@ class EpubGenerator(object): ...@@ -466,10 +466,15 @@ class EpubGenerator(object):
if len(line_content) and len(line_content[-1]) and line_content[-1][-1] in hyphens: if len(line_content) and len(line_content[-1]) and line_content[-1][-1] in hyphens:
# Remove the last character if it is a hyphen # Remove the last character if it is a hyphen
line_content[-1] = line_content[-1][:-1] line_content[-1] = line_content[-1][:-1]
# Add placeholder value
line_content.append('\x7f')
page_content += line_content page_content += line_content
# Create HTML/epub page # Flatten list into string and add spaces
page_text = ' '.join(page_content) page_text = ' '.join(page_content)
# Remove placeholder and spaces in the positions that previously had a line break hyphen
page_text = page_text.replace(' \x7f ', '')
# Create HTML/epub page
page_html = u"<p>%s</p>" % page_text page_html = u"<p>%s</p>" % page_text
# Add a warning if the confidence in the text is below the given threshold # Add a warning if the confidence in the text is below the given threshold
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment