forked from indymedia/epicyon
Show citations on new blog post
parent
c77b18c734
commit
3c6a35b280
2
posts.py
2
posts.py
|
@ -1243,7 +1243,7 @@ def createBlogPost(baseDir: str,
|
|||
sections = line.strip().split(citationsSeparator)
|
||||
if len(sections) != 3:
|
||||
continue
|
||||
dateStr = sections[0]
|
||||
# dateStr = sections[0]
|
||||
title = sections[1]
|
||||
link = sections[2]
|
||||
tagJson = {
|
||||
|
|
|
@ -2748,6 +2748,30 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
extraFields += '<input type="text" name="location">\n'
|
||||
extraFields += '</div>\n'
|
||||
|
||||
citationsStr = ''
|
||||
if endpoint == 'newblog':
|
||||
citationsFilename = \
|
||||
baseDir + '/accounts/' + \
|
||||
nickname + '@' + domain + '/.citations.txt'
|
||||
if os.path.isfile(citationsFilename):
|
||||
citationsStr = '<div class="container">\n'
|
||||
citationsStr += '<p><label class="labels">' + \
|
||||
translate['Citations'] + ':</label></p>\n'
|
||||
citationsSeparator = '#####'
|
||||
with open(citationsFilename, "r") as f:
|
||||
citations = f.readlines()
|
||||
for line in citations:
|
||||
if citationsSeparator not in line:
|
||||
continue
|
||||
sections = line.strip().split(citationsSeparator)
|
||||
if len(sections) != 3:
|
||||
continue
|
||||
title = sections[1]
|
||||
link = sections[2]
|
||||
citationsStr += \
|
||||
'<a href="' + link + '">' + title + '</a><br>'
|
||||
citationsStr += '</div>\n'
|
||||
|
||||
dateAndLocation = ''
|
||||
if endpoint != 'newshare' and \
|
||||
endpoint != 'newreport' and \
|
||||
|
@ -3050,7 +3074,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
newPostForm += \
|
||||
' <textarea id="message" name="message" style="height:' + \
|
||||
str(messageBoxHeight) + 'px"' + selectedStr + '></textarea>\n'
|
||||
newPostForm += extraFields+dateAndLocation
|
||||
newPostForm += extraFields + citationsStr + dateAndLocation
|
||||
if not mediaInstance or replyStr:
|
||||
newPostForm += newPostImageSection
|
||||
newPostForm += ' </div>\n'
|
||||
|
|
Loading…
Reference in New Issue