mirror of https://gitlab.com/bashrc2/epicyon
Another long lines failure case
parent
d5f82c568d
commit
eb9135ac3e
|
@ -643,6 +643,8 @@ def removeLongWords(content: str, maxWordLength: int,
|
|||
if wordStr not in longWordsList:
|
||||
longWordsList.append(wordStr)
|
||||
for wordStr in longWordsList:
|
||||
if wordStr.startswith('<p>'):
|
||||
wordStr = wordStr.replace('<p>', '')
|
||||
if wordStr.startswith('<'):
|
||||
continue
|
||||
if len(wordStr) == 76:
|
||||
|
@ -678,6 +680,8 @@ def removeLongWords(content: str, maxWordLength: int,
|
|||
continue
|
||||
if '<' in wordStr:
|
||||
replaceWord = wordStr.split('<', 1)[0]
|
||||
# if len(replaceWord) > maxWordLength:
|
||||
# replaceWord = replaceWord[:maxWordLength]
|
||||
content = content.replace(wordStr, replaceWord)
|
||||
wordStr = replaceWord
|
||||
if '/' in wordStr:
|
||||
|
|
16
tests.py
16
tests.py
|
@ -1911,6 +1911,22 @@ def testActorParsing():
|
|||
def testWebLinks():
|
||||
print('testWebLinks')
|
||||
|
||||
exampleText = \
|
||||
"<p>Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + \
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + \
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + \
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + \
|
||||
" <a href=\"https://domain.ugh/tags/turbot\" class=\"mention " + \
|
||||
"hashtag\" rel=\"tag\">#<span>turbot</span></a> <a href=\"" + \
|
||||
"https://domain.ugh/tags/haddock\" class=\"mention hashtag\"" + \
|
||||
" rel=\"tag\">#<span>haddock</span></a></p>"
|
||||
resultText = removeLongWords(exampleText, 40, [])
|
||||
assert resultText == "<p>Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + \
|
||||
" <a href=\"https://domain.ugh/tags/turbot\" class=\"mention " + \
|
||||
"hashtag\" rel=\"tag\">#<span>turbot</span></a> " + \
|
||||
"<a href=\"https://domain.ugh/tags/haddock\" " + \
|
||||
"class=\"mention hashtag\" rel=\"tag\">#<span>haddock</span></a></p>"
|
||||
|
||||
exampleText = \
|
||||
'<p><span class=\"h-card\"><a href=\"https://something/@orother' + \
|
||||
'\" class=\"u-url mention\">@<span>foo</span></a></span> Some ' + \
|
||||
|
|
Loading…
Reference in New Issue