Update hashtags after processing

merge-requests/8/head
Bob Mottram 2020-10-25 11:22:52 +00:00
parent a9c07065a0
commit 006908c30c
1 changed files with 18 additions and 17 deletions

View File

@ -596,23 +596,6 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
domainFull = domain + ':' + str(port)
hashtags = item[6]
for tagName in hashtags:
htId = tagName.replace('#', '')
hashtagUrl = \
httpPrefix + "://" + domainFull + "/tags/" + htId
newTag = {
'href': hashtagUrl,
'name': tagName,
'type': 'Hashtag'
}
blog['object']['tag'].append(newTag)
if tagName in blog['object']['content']:
hashtagHtml = \
"<a href=\"" + hashtagUrl + \
"\" class=\"addedHashtag\" " + \
"rel=\"tag\">#<span>" + \
htId + "</span></a>"
blog['object']['content'].replace(tagName, hashtagHtml)
postId = newPostId.replace('/', '#')
@ -627,6 +610,24 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
# save the post and update the index
if savePost:
for tagName in hashtags:
htId = tagName.replace('#', '')
hashtagUrl = \
httpPrefix + "://" + domainFull + "/tags/" + htId
newTag = {
'href': hashtagUrl,
'name': tagName,
'type': 'Hashtag'
}
blog['object']['tag'].append(newTag)
if tagName in blog['object']['content']:
hashtagHtml = \
"<a href=\"" + hashtagUrl + \
"\" class=\"addedHashtag\" " + \
"rel=\"tag\">#<span>" + \
htId + "</span></a>"
blog['object']['content'].replace(tagName, hashtagHtml)
newswire[originalDateStr][6] = hashtags
storeHashTags(baseDir, 'news', blog)