kopia lustrzana https://gitlab.com/jaywink/federation
Fix some characters stopping tags being identified
Closes socialhome/socialhome#222merge-requests/160/head
rodzic
f704175a21
commit
a2653239d6
|
@ -63,6 +63,8 @@
|
|||
|
||||
* Don't try to relay AP payloads to Diaspora receivers and vice versa, for now, until cross-protocol
|
||||
relaying is supported.
|
||||
|
||||
* Fix some characters stopping tags being identified ([related issue](https://git.feneas.org/socialhome/socialhome/-/issues/222))
|
||||
|
||||
## [0.19.0] - 2019-12-15
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ class TestFindTags:
|
|||
assert text == "foo\n```\n#code\n```\n#notcode/notcode\n\n #alsocode\n"
|
||||
|
||||
def test_endings_are_filtered_out(self):
|
||||
source = "#parenthesis) #exp! #list]"
|
||||
source = "#parenthesis) #exp! #list] *#doh* _#bah_ #gah%"
|
||||
tags, text = find_tags(source)
|
||||
assert tags == {"parenthesis", "exp", "list"}
|
||||
assert tags == {"parenthesis", "exp", "list", "doh", "bah", "gah"}
|
||||
assert text == source
|
||||
tags, text = find_tags(source, replacer=self._replacer)
|
||||
assert text == "#parenthesis/parenthesis) #exp/exp! #list/list]"
|
||||
assert text == "#parenthesis/parenthesis) #exp/exp! #list/list] *#doh/doh* _#bah/bah_ #gah/gah%"
|
||||
|
||||
def test_finds_tags(self):
|
||||
source = "#post **Foobar** #tag #OtherTag #third\n#fourth"
|
||||
|
|
|
@ -50,7 +50,7 @@ def find_tags(text: str, replacer: callable = None) -> Tuple[Set, str]:
|
|||
words = line.split(" ")
|
||||
for word in words:
|
||||
if word.find('#') > -1:
|
||||
candidate = word.strip().strip("([]),.!?:")
|
||||
candidate = word.strip().strip("([]),.!?:*_%")
|
||||
if candidate.find('<') > -1 or candidate.find('>') > -1:
|
||||
# Strip html
|
||||
candidate = bleach.clean(word, strip=True)
|
||||
|
|
Ładowanie…
Reference in New Issue