Append citations to blog posts

merge-requests/8/head
Bob Mottram 2020-11-06 13:50:23 +00:00
parent aa939c39eb
commit a1b2bcd5b6
1 changed files with 22 additions and 1 deletions

View File

@ -5583,6 +5583,27 @@ def individualPostAsHtml(allowDownloads: bool,
'<div class="gitpatch"><pre><code>' + contentStr + \ '<div class="gitpatch"><pre><code>' + contentStr + \
'</code></pre></div>\n' '</code></pre></div>\n'
# show blog citations
citationsStr = ''
if boxName == 'tlblog':
if postJsonObject['object'].get('tag'):
for tagJson in postJsonObject['object']['tag']:
if not tagJson.get('type'):
continue
if tagJson['type'] != 'Article':
continue
if not tagJson.get('name'):
continue
if not tagJson.get('url'):
continue
citationsStr += \
'<li><a href="' + tagJson['url'] + '">' + \
'<cite>' + tagJson['name'] + '</cite></a></li>\n'
if citationsStr:
citationsStr = '<p><b>' + translate['Citations'] + \
':</b></p>' + \
'<ul>\n' + citationsStr + '</ul>\n'
postHtml = '' postHtml = ''
if boxName != 'tlmedia': if boxName != 'tlmedia':
postHtml = ' <div id="' + timelinePostBookmark + \ postHtml = ' <div id="' + timelinePostBookmark + \
@ -5591,7 +5612,7 @@ def individualPostAsHtml(allowDownloads: bool,
postHtml += ' <div class="post-title">\n' + \ postHtml += ' <div class="post-title">\n' + \
' ' + titleStr + \ ' ' + titleStr + \
replyAvatarImageInPost + ' </div>\n' replyAvatarImageInPost + ' </div>\n'
postHtml += contentStr + footerStr + '\n' postHtml += contentStr + citationsStr + footerStr + '\n'
postHtml += ' </div>\n' postHtml += ' </div>\n'
else: else:
postHtml = galleryStr postHtml = galleryStr