fix punctuation
This commit is contained in:
parent
5d4b1cec8e
commit
7ed2436a14
@ -30,10 +30,11 @@ class headLineManager():
|
|||||||
newText += text[lastPos:span[0]]
|
newText += text[lastPos:span[0]]
|
||||||
numberOfChars = len(text[span[0]:span[1]])
|
numberOfChars = len(text[span[0]:span[1]])
|
||||||
name = text[span[0]:span[1]][:2]
|
name = text[span[0]:span[1]][:2]
|
||||||
if name.strip(name[0]) == '':
|
print(self.env['runtime']['punctuationManager'].proceedPunctuation(name, True))
|
||||||
newText += ' ' + str(numberOfChars) + ' ' + name[0] + ' '
|
if name[0] == name[1]:
|
||||||
|
newText += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' '
|
||||||
else:
|
else:
|
||||||
newText += ' ' + str(int(numberOfChars / 2)) + ' ' + name + ' '
|
newText += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' '
|
||||||
lastPos = span[1]
|
lastPos = span[1]
|
||||||
if lastPos != 0:
|
if lastPos != 0:
|
||||||
newText += ' '
|
newText += ' '
|
||||||
@ -44,10 +45,10 @@ class headLineManager():
|
|||||||
result += text[lastPos:span[0]]
|
result += text[lastPos:span[0]]
|
||||||
numberOfChars = len(newText[span[0]:span[1]])
|
numberOfChars = len(newText[span[0]:span[1]])
|
||||||
name = newText[span[0]:span[1]][:2]
|
name = newText[span[0]:span[1]][:2]
|
||||||
if name.strip(name[0]) == '':
|
if name[0] == name[1]:
|
||||||
result += ' ' + str(numberOfChars) + ' ' + name[0] + ' '
|
result += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' '
|
||||||
else:
|
else:
|
||||||
result += ' ' + str(int(numberOfChars / 2)) + ' ' + name + ' '
|
result += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' '
|
||||||
lastPos = span[1]
|
lastPos = span[1]
|
||||||
if lastPos != 0:
|
if lastPos != 0:
|
||||||
result += ' '
|
result += ' '
|
||||||
|
@ -49,7 +49,7 @@ class punctuationManager():
|
|||||||
if key in punctuation and key not in ' ':
|
if key in punctuation and key not in ' ':
|
||||||
if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \
|
if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \
|
||||||
len(key) == 1 and \
|
len(key) == 1 and \
|
||||||
key in ",.;:?!-":
|
key in ",.;:?!":
|
||||||
resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ')
|
resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ')
|
||||||
else:
|
else:
|
||||||
resultText = resultText.replace(str(key),' ' +str(item) + ' ')
|
resultText = resultText.replace(str(key),' ' +str(item) + ' ')
|
||||||
|
Loading…
Reference in New Issue
Block a user