forked from indymedia/epicyon
No suffix
parent
ed2e97ab55
commit
ba5608c705
|
@ -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, \
|
||||||
|
|
2
tests.py
2
tests.py
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue