cleaned up print statements

This commit is contained in:
ldolse 2011-01-09 19:57:15 +08:00
parent c2cef786ce
commit 9751f99db9
2 changed files with 6 additions and 8 deletions

View File

@ -196,28 +196,28 @@ class Dehyphenator(object):
lookupword = self.removesuffixes.sub('', dehyphenated) lookupword = self.removesuffixes.sub('', dehyphenated)
if self.prefixes.match(firsthalf) is None: if self.prefixes.match(firsthalf) is None:
lookupword = self.removeprefix.sub('', lookupword) lookupword = self.removeprefix.sub('', lookupword)
print "lookup word is: "+str(lookupword)+", orig is: " + str(hyphenated) #print "lookup word is: "+str(lookupword)+", orig is: " + str(hyphenated)
try: try:
searchresult = self.html.find(lookupword.lower()) searchresult = self.html.find(lookupword.lower())
except: except:
return hyphenated return hyphenated
if self.format == 'html_cleanup' or self.format == 'txt_cleanup': if self.format == 'html_cleanup' or self.format == 'txt_cleanup':
if self.html.find(lookupword) != -1 or searchresult != -1: if self.html.find(lookupword) != -1 or searchresult != -1:
print "Cleanup:returned dehyphenated word: " + str(dehyphenated) #print "Cleanup:returned dehyphenated word: " + str(dehyphenated)
return dehyphenated return dehyphenated
elif self.html.find(hyphenated) != -1: elif self.html.find(hyphenated) != -1:
print "Cleanup:returned hyphenated word: " + str(hyphenated) #print "Cleanup:returned hyphenated word: " + str(hyphenated)
return hyphenated return hyphenated
else: else:
print "Cleanup:returning original text "+str(firsthalf)+" + linefeed "+str(secondhalf) #print "Cleanup:returning original text "+str(firsthalf)+" + linefeed "+str(secondhalf)
return firsthalf+u'\u2014'+wraptags+secondhalf return firsthalf+u'\u2014'+wraptags+secondhalf
else: else:
if self.html.find(lookupword) != -1 or searchresult != -1: if self.html.find(lookupword) != -1 or searchresult != -1:
print "returned dehyphenated word: " + str(dehyphenated) #print "returned dehyphenated word: " + str(dehyphenated)
return dehyphenated return dehyphenated
else: else:
print " returned hyphenated word: " + str(hyphenated) #print " returned hyphenated word: " + str(hyphenated)
return hyphenated return hyphenated
def __call__(self, html, format, length=1): def __call__(self, html, format, length=1):

View File

@ -80,7 +80,6 @@ class TXTInput(InputFormatPlugin):
# Get length for hyphen removal and punctuation unwrap # Get length for hyphen removal and punctuation unwrap
docanalysis = DocAnalysis('txt', txt) docanalysis = DocAnalysis('txt', txt)
length = docanalysis.line_length(.5) length = docanalysis.line_length(.5)
print "length is "+str(length)
if options.formatting_type == 'auto': if options.formatting_type == 'auto':
options.formatting_type = detect_formatting_type(txt) options.formatting_type = detect_formatting_type(txt)
@ -130,7 +129,6 @@ class TXTInput(InputFormatPlugin):
html = convert_basic(txt, epub_split_size_kb=flow_size) html = convert_basic(txt, epub_split_size_kb=flow_size)
# Dehyphenate in cleanup mode for missed txt and markdown conversion # Dehyphenate in cleanup mode for missed txt and markdown conversion
print "going through final dehyphenation"
dehyphenator = Dehyphenator() dehyphenator = Dehyphenator()
html = dehyphenator(html,'txt_cleanup', length) html = dehyphenator(html,'txt_cleanup', length)
html = dehyphenator(html,'html_cleanup', length) html = dehyphenator(html,'html_cleanup', length)