No suffix

main2
Bob Mottram 2019-11-04 20:45:10 +00:00
parent ed2e97ab55
commit ba5608c705
2 changed files with 3 additions and 5 deletions

View File

@ -257,9 +257,7 @@ def removeLongWords(content: str,maxWordLength: int,longWordsList: []) -> str:
continue continue
elif 'dat:' in wordStr: elif 'dat:' in wordStr:
continue continue
suffix=''
if '<' in wordStr: if '<' in wordStr:
suffix='<'+wordStr.split('<',1)[1]
wordStr=wordStr.split('<',1)[0] wordStr=wordStr.split('<',1)[0]
if '/' in wordStr: if '/' in wordStr:
continue continue
@ -267,11 +265,11 @@ def removeLongWords(content: str,maxWordLength: int,longWordsList: []) -> str:
content= \ content= \
content.replace(wordStr, \ content.replace(wordStr, \
wordStr[:maxWordLength]+separator+ \ wordStr[:maxWordLength]+separator+ \
wordStr[maxWordLength:]+suffix) wordStr[maxWordLength:])
else: else:
content= \ content= \
content.replace(wordStr, \ content.replace(wordStr, \
wordStr[:maxWordLength]+suffix) wordStr[:maxWordLength])
return content return content
def addHtmlTags(baseDir: str,httpPrefix: str, \ def addHtmlTags(baseDir: str,httpPrefix: str, \

View File

@ -1531,7 +1531,7 @@ def testWebLinks():
assert 'ellipsis' in linkedText assert 'ellipsis' in linkedText
exampleText='<p>1. HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAH</p>' exampleText='<p>1. HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAH</p>'
resultText=removeLongWords(exampleText,40,[]) resultText=removeLongWords(exampleText,40,[])
assert resultText=='<p>1. HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA</p></p>' assert resultText=='<p>1. HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA</p>'
def testAddEmoji(): def testAddEmoji():
print('testAddEmoji') print('testAddEmoji')