mirror of https://gitlab.com/bashrc2/epicyon
Indentation
parent
cd7221ddf2
commit
b5541563eb
|
@ -271,34 +271,34 @@ def newswireHashtagProcessing(session, baseDir: str, postJsonObject: {},
|
||||||
'name': addHashtag,
|
'name': addHashtag,
|
||||||
'type': 'Hashtag'
|
'type': 'Hashtag'
|
||||||
}
|
}
|
||||||
# does the tag already exist?
|
# does the tag already exist?
|
||||||
addTagObject = None
|
addTagObject = None
|
||||||
for t in postJsonObject['object']['tag']:
|
for t in postJsonObject['object']['tag']:
|
||||||
if t.get('type') and t.get('name'):
|
if t.get('type') and t.get('name'):
|
||||||
if t['type'] == 'Hashtag' and \
|
if t['type'] == 'Hashtag' and \
|
||||||
t['name'] == addHashtag:
|
t['name'] == addHashtag:
|
||||||
addTagObject = t
|
addTagObject = t
|
||||||
break
|
break
|
||||||
# append the tag if it wasn't found
|
# append the tag if it wasn't found
|
||||||
if not addTagObject:
|
if not addTagObject:
|
||||||
postJsonObject['object']['tag'].append(newTag)
|
postJsonObject['object']['tag'].append(newTag)
|
||||||
# add corresponding html to the post content
|
# add corresponding html to the post content
|
||||||
hashtagHtml = \
|
hashtagHtml = \
|
||||||
" <a href=\"" + hashtagUrl + \
|
" <a href=\"" + hashtagUrl + \
|
||||||
"\" class=\"mention hashtag\" " + \
|
"\" class=\"mention hashtag\" " + \
|
||||||
"rel=\"tag\">#<span>" + \
|
"rel=\"tag\">#<span>" + \
|
||||||
htId + "</span></a>"
|
htId + "</span></a>"
|
||||||
content = postJsonObject['object']['content']
|
content = postJsonObject['object']['content']
|
||||||
if hashtagHtml not in content:
|
if hashtagHtml not in content:
|
||||||
if content.endswith('</p>'):
|
if content.endswith('</p>'):
|
||||||
content = \
|
content = \
|
||||||
content[:len(content) - len('</p>')] + \
|
content[:len(content) - len('</p>')] + \
|
||||||
hashtagHtml + '</p>'
|
hashtagHtml + '</p>'
|
||||||
else:
|
else:
|
||||||
content += hashtagHtml
|
content += hashtagHtml
|
||||||
postJsonObject['object']['content'] = content
|
postJsonObject['object']['content'] = content
|
||||||
storeHashTags(baseDir, 'news', postJsonObject)
|
storeHashTags(baseDir, 'news', postJsonObject)
|
||||||
# actionOccurred = True
|
# actionOccurred = True
|
||||||
|
|
||||||
# remove a hashtag
|
# remove a hashtag
|
||||||
if actionStr.startswith('remove '):
|
if actionStr.startswith('remove '):
|
||||||
|
|
Loading…
Reference in New Issue