1
0
Fork 0

Note content: use italics for book titles + em-dash for Quotation

This commit is contained in:
Adeodato Simó 2023-09-17 15:32:29 -03:00
parent ce3885d4f6
commit cc05cabcb5
No known key found for this signature in database
GPG key ID: CDF447845F1A986F
2 changed files with 17 additions and 8 deletions

View file

@ -270,7 +270,7 @@ class GeneratedNote(Status):
"""indicate the book in question for mastodon (or w/e) users"""
message = self.content
books = ", ".join(
f'<a href="{book.remote_id}">"{book.title}"</a>'
f'<a href="{book.remote_id}"><i>{book.title}</i></a>'
for book in self.mention_books.all()
)
return f"{self.user.display_name} {message} {books}"
@ -324,7 +324,7 @@ class Comment(BookStatus):
progress = self.progress or 0
citation = (
f'comment on <a href="{self.book.remote_id}">'
f'"{self.book.title}"</a>'
f"<i>{self.book.title}</i></a>"
)
if self.progress_mode == "PG" and progress > 0:
citation += f", p. {progress}"
@ -365,7 +365,8 @@ class Quotation(BookStatus):
"""indicate the book in question for mastodon (or w/e) users"""
quote = re.sub(r"^<p>", '<p>"', self.quote)
quote = re.sub(r"</p>$", '"</p>', quote)
citation = f'-- <a href="{self.book.remote_id}">"{self.book.title}"</a>'
title, href = self.book.title, self.book.remote_id
citation = f'— <a href="{href}"><i>{title}</i></a>'
if position := self._format_position():
citation += f", {position}"
return f"{quote} <p>{citation}</p>{self.content}"