Attaching citations to a blog as tags

merge-requests/8/head
Bob Mottram 2020-11-06 11:21:41 +00:00
parent fbebbdc3d2
commit 3f53b06517
2 changed files with 28 additions and 1 deletions

View File

@ -1228,6 +1228,27 @@ def createBlogPost(baseDir: str,
schedulePost,
eventDate, eventTime, location)
blog['object']['type'] = 'Article'
# append citations tags, stored in a file
citationsFilename = \
baseDir + '/accounts/' + \
nickname + '@' + domain + '/.citations.txt'
if os.path.isfile(citationsFilename):
citationsSeparator = '#####'
with open(citationsFilename, "r") as f:
citations = f.readlines()
for line in citations:
sections = line.split(citationsSeparator)
dateStr = sections[0]
title = sections[1]
link = sections[2]
tagJson = {
"type": "Article",
"name": title
"url": link
}
blog['object']['tag'].append(tagJson)
return blog

View File

@ -5912,6 +5912,8 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
translate['Submit'] + '">\n'
htmlStr += ' </center>\n'
citationsSeparator = '#####'
# list of newswire items
if newswire:
ctr = 0
@ -5923,9 +5925,13 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
title = removeLongWords(item[0], 16, []).replace('\n', '<br>')
link = item[1]
citationValue = \
dateStr + citationsSeparator + \
title + citationsSeparator + \
link
htmlStr += \
'<input type="checkbox" name="newswire' + str(ctr) + \
'" value="' + dateStr + '"/>' + \
'" value="' + citationValue + '"/>' + \
'<a href="' + link + '">' + title + '</a> '
htmlStr += '<span class="newswireDate">' + \
dateShown + '</span><br>\n'