mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
TXT Input: Only run dehyphenate when option set.
This commit is contained in:
parent
a0fd28d966
commit
a031246152
@ -89,12 +89,6 @@ class TXTInput(InputFormatPlugin):
|
||||
else:
|
||||
log.debug('Auto detected paragraph type as %s' % options.paragraph_type)
|
||||
|
||||
dehyphenate = False
|
||||
if options.formatting_type in ('auto', 'heuristic'):
|
||||
# Set this here because we want it to run over all
|
||||
# formatting types if auto is used.
|
||||
dehyphenate = True
|
||||
|
||||
# Detect formatting
|
||||
if options.formatting_type == 'auto':
|
||||
options.formatting_type = detect_formatting_type(txt)
|
||||
@ -127,7 +121,7 @@ class TXTInput(InputFormatPlugin):
|
||||
preprocessor = HeuristicProcessor(options, log=getattr(self, 'log', None))
|
||||
txt = preprocessor.punctuation_unwrap(length, txt, 'txt')
|
||||
|
||||
if dehyphenate:
|
||||
if getattr(options, 'enable_heuristics', False) and getattr(options, 'dehyphenate', False):
|
||||
docanalysis = DocAnalysis('txt', txt)
|
||||
length = docanalysis.line_length(.5)
|
||||
dehyphenator = Dehyphenator(options.verbose, log=self.log)
|
||||
|
Loading…
x
Reference in New Issue
Block a user