fix punctuation

This commit is contained in:
chrys 2017-11-11 00:42:55 +01:00
parent 5d4b1cec8e
commit 7ed2436a14
2 changed files with 8 additions and 7 deletions

View File

@ -30,10 +30,11 @@ class headLineManager():
newText += text[lastPos:span[0]]
numberOfChars = len(text[span[0]:span[1]])
name = text[span[0]:span[1]][:2]
if name.strip(name[0]) == '':
newText += ' ' + str(numberOfChars) + ' ' + name[0] + ' '
print(self.env['runtime']['punctuationManager'].proceedPunctuation(name, True))
if name[0] == name[1]:
newText += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' '
else:
newText += ' ' + str(int(numberOfChars / 2)) + ' ' + name + ' '
newText += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' '
lastPos = span[1]
if lastPos != 0:
newText += ' '
@ -44,10 +45,10 @@ class headLineManager():
result += text[lastPos:span[0]]
numberOfChars = len(newText[span[0]:span[1]])
name = newText[span[0]:span[1]][:2]
if name.strip(name[0]) == '':
result += ' ' + str(numberOfChars) + ' ' + name[0] + ' '
if name[0] == name[1]:
result += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' '
else:
result += ' ' + str(int(numberOfChars / 2)) + ' ' + name + ' '
result += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' '
lastPos = span[1]
if lastPos != 0:
result += ' '

View File

@ -49,7 +49,7 @@ class punctuationManager():
if key in punctuation and key not in ' ':
if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \
len(key) == 1 and \
key in ",.;:?!-":
key in ",.;:?!":
resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ')
else:
resultText = resultText.replace(str(key),' ' +str(item) + ' ')