main
Bob Mottram 2021-02-11 10:01:27 +00:00
parent 2f5d270c3f
commit 2cbcd4eeb2
1 changed files with 34 additions and 25 deletions

View File

@ -1425,31 +1425,17 @@ def createPublicPost(baseDir: str,
eventStatus, ticketUrl)
def createBlogPost(baseDir: str,
nickname: str, domain: str, port: int, httpPrefix: str,
content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool, commentsEnabled: bool,
attachImageFilename: str, mediaType: str,
imageDescription: str,
inReplyTo=None, inReplyToAtomUri=None, subject=None,
schedulePost=False,
eventDate=None, eventTime=None, location=None) -> {}:
blog = \
createPublicPost(baseDir,
nickname, domain, port, httpPrefix,
content, followersOnly, saveToFile,
clientToServer, commentsEnabled,
attachImageFilename, mediaType,
imageDescription,
inReplyTo, inReplyToAtomUri, subject,
schedulePost,
eventDate, eventTime, location, True)
def _appendCitationsToBlogPost(baseDir: str,
nickname: str, domain: str,
blogJson: {}) -> None:
"""Appends any citations to a new blog post
"""
# append citations tags, stored in a file
citationsFilename = \
baseDir + '/accounts/' + \
nickname + '@' + domain + '/.citations.txt'
if os.path.isfile(citationsFilename):
if not os.path.isfile(citationsFilename):
return
citationsSeparator = '#####'
with open(citationsFilename, "r") as f:
citations = f.readlines()
@ -1467,9 +1453,32 @@ def createBlogPost(baseDir: str,
"name": title,
"url": link
}
blog['object']['tag'].append(tagJson)
blogJson['object']['tag'].append(tagJson)
return blog
def createBlogPost(baseDir: str,
nickname: str, domain: str, port: int, httpPrefix: str,
content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool, commentsEnabled: bool,
attachImageFilename: str, mediaType: str,
imageDescription: str,
inReplyTo=None, inReplyToAtomUri=None, subject=None,
schedulePost=False,
eventDate=None, eventTime=None, location=None) -> {}:
blogJson = \
createPublicPost(baseDir,
nickname, domain, port, httpPrefix,
content, followersOnly, saveToFile,
clientToServer, commentsEnabled,
attachImageFilename, mediaType,
imageDescription,
inReplyTo, inReplyToAtomUri, subject,
schedulePost,
eventDate, eventTime, location, True)
_appendCitationsToBlogPost(baseDir, nickname, domain, blogJson)
return blogJson
def createNewsPost(baseDir: str,