From: Jan Szejko Date: Thu, 18 Feb 2016 15:13:53 +0000 (+0100) Subject: turn off hyphenator X-Git-Tag: 1.7~79 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/4795d15d061b8ed6e4762be2c7787b355bbe3e63?ds=inline;hp=-c turn off hyphenator --- 4795d15d061b8ed6e4762be2c7787b355bbe3e63 diff --git a/librarian/epub.py b/librarian/epub.py index bf2d4d9..831639b 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -406,7 +406,7 @@ def transform_chunk(chunk_xml, chunk_no, annotations, empty=False, _empty_html_s def transform(wldoc, verbose=False, style=None, html_toc=False, - sample=None, cover=None, flags=None): + sample=None, cover=None, flags=None, hyphenate=False): """ produces a EPUB file sample=n: generate sample e-book (with at least n paragraphs) @@ -419,8 +419,9 @@ def transform(wldoc, verbose=False, replace_characters(wldoc.edoc.getroot()) - hyphenator = set_hyph_language(wldoc.edoc.getroot()) - hyphenate_and_fix_conjunctions(wldoc.edoc.getroot(), hyphenator) + if hyphenate: + hyphenator = set_hyph_language(wldoc.edoc.getroot()) + hyphenate_and_fix_conjunctions(wldoc.edoc.getroot(), hyphenator) # every input file will have a TOC entry, # pointing to starting chunk diff --git a/librarian/mobi.py b/librarian/mobi.py index a0e463a..61a6de1 100644 --- a/librarian/mobi.py +++ b/librarian/mobi.py @@ -13,7 +13,7 @@ from librarian import OutputFile def transform(wldoc, verbose=False, sample=None, cover=None, - use_kindlegen=False, flags=None): + use_kindlegen=False, flags=None, hyphenate=True): """ produces a MOBI file wldoc: a WLDocument @@ -26,7 +26,8 @@ def transform(wldoc, verbose=False, sample=None, cover=None, del wldoc epub = document.as_epub(verbose=verbose, sample=sample, - html_toc=True, cover=cover or True, flags=flags) + html_toc=True, cover=cover or True, flags=flags, + hyphenate=hyphenate) if verbose: kwargs = {} else: