Skip to content

Commit

Permalink
Don't accumulate newlines on missing mentions/hashtags
Browse files Browse the repository at this point in the history
  • Loading branch information
wm75 committed Jun 18, 2024
1 parent dd0eb9a commit 094e2f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/plugins/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ def format_content(self, content, mentions, hashtags, images, **kwargs):
else:
warnings = ""

chunks = self.wrap_text_with_index(f"{content}\n\n{mentions}\n{hashtags}")
content += "\n"
if mentions:
content = f"{content}\n{mentions}"
if hashtags:
content = f"{content}\n{hashtags}"
chunks = self.wrap_text_with_index(content.strip("\n"))

formatted_content = {
"body": "\n\n".join(chunks),
Expand Down
7 changes: 6 additions & 1 deletion lib/plugins/mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def format_content(self, content, mentions, hashtags, images, **kwargs):
else:
warnings = ""

chunks = self.wrap_text_with_index(f"{content}\n\n{mentions}\n{hashtags}")
content += "\n"
if mentions:
content = f"{content}\n{mentions}"
if hashtags:
content = f"{content}\n{hashtags}"
chunks = self.wrap_text_with_index(content.strip("\n"))

formatted_content = {
"body": "\n\n".join(chunks),
Expand Down

0 comments on commit 094e2f4

Please sign in to comment.