mirror of https://gitlab.com/bashrc2/epicyon
Detecting mentions for @nick@domain
parent
2fdd5036a4
commit
470f32382a
11
content.py
11
content.py
|
@ -105,6 +105,7 @@ 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:]
|
||||||
|
# @nick
|
||||||
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
|
||||||
|
@ -116,7 +117,6 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
|
||||||
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
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
possibleNickname=possibleHandle.split('@')[0]
|
possibleNickname=possibleHandle.split('@')[0]
|
||||||
|
@ -128,6 +128,15 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
|
||||||
recipients.append(recipientActor)
|
recipients.append(recipientActor)
|
||||||
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+possibleDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
||||||
return True
|
return True
|
||||||
|
# @nick@domain
|
||||||
|
if '@' in possibleHandle:
|
||||||
|
possibleNickname=possibleHandle.split('@')[0]
|
||||||
|
replaceDomain=possibleHandle.split('@')[1]
|
||||||
|
recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname
|
||||||
|
if recipientActor not in recipients:
|
||||||
|
recipients.append(recipientActor)
|
||||||
|
replaceMentions[wordStr]="<span class=\"h-card\"><a href=\""+httpPrefix+"://"+replaceDomain+"/@"+possibleNickname+"\" class=\"u-url mention\">@<span>"+possibleNickname+"</span></a></span>"
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def addHtmlTags(baseDir: str,httpPrefix: str, \
|
def addHtmlTags(baseDir: str,httpPrefix: str, \
|
||||||
|
|
Loading…
Reference in New Issue