forked from indymedia/epicyon
Handle mentions without domains
parent
d769c5b258
commit
9976e016b1
28
content.py
28
content.py
|
@ -17,20 +17,20 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
|
||||||
if len(wordStr)<2:
|
if len(wordStr)<2:
|
||||||
return False
|
return False
|
||||||
possibleHandle=wordStr[1:]
|
possibleHandle=wordStr[1:]
|
||||||
#if '@' not in possibleHandle:
|
if '@' not in possibleHandle:
|
||||||
# # fall back to a best effort match against the following list
|
# fall back to a best effort match against the following list
|
||||||
# # if no domain was specified. eg. @nick
|
# if no domain was specified. eg. @nick
|
||||||
# possibleNickname=possibleHandle
|
possibleNickname=possibleHandle
|
||||||
# for follow in following:
|
for follow in following:
|
||||||
# if follow.startswith(possibleNickname+'@'):
|
if follow.startswith(possibleNickname+'@'):
|
||||||
# replaceDomain=follow.replace('\n','').split('@')[1]
|
replaceDomain=follow.replace('\n','').split('@')[1]
|
||||||
# recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname
|
recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname
|
||||||
# if recipientActor not in recipients:
|
if recipientActor not in recipients:
|
||||||
# recipients.append(recipientActor)
|
recipients.append(recipientActor)
|
||||||
# replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+replaceDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+replaceDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
||||||
# replaceFound=True
|
replaceFound=True
|
||||||
# return True
|
return True
|
||||||
# return False
|
return False
|
||||||
possibleNickname=possibleHandle.split('@')[0]
|
possibleNickname=possibleHandle.split('@')[0]
|
||||||
possibleDomain=possibleHandle.split('@')[1]
|
possibleDomain=possibleHandle.split('@')[1]
|
||||||
for follow in following:
|
for follow in following:
|
||||||
|
|
Loading…
Reference in New Issue