sensitive = "yes" if self.data['sensitive'] else "no"
yield text.Paragraph("Sensitive: " + sensitive)
spoiler = noneify(self.data['spoiler_text'], include_empty=True)
- yield text.Paragraph("Spoiler text: " + spoiler)
+ yield text.IndentedParagraph(0, 2, "Spoiler text: " + spoiler)
yield text.BlankLine()
replies = str(self.data['replies_count'])
yield text.Paragraph("Favourites: " + faves)
yield text.BlankLine()
+ if len(self.mentions) > 0:
+ yield text.Paragraph("Mentioned user:")
+ for mention in self.mentions:
+ yield text.IndentedParagraph(2, 4, text.ColouredString(
+ self.client.fq(mention['acct']), 'f'))
+ yield text.BlankLine()
+
app_subdict = self.data.get('application', {})
client = noneify(app_subdict.get('name'))
yield text.Paragraph("Client name: " + client)
client_url = noneify(app_subdict.get('website'), colour='u')
yield text.Paragraph("Client website: " + client_url)
+ yield text.BlankLine()
def get_reply_recipients(self):
yield self.client.fq(self.account['acct'])
def __repr__(self):
return f"Paragraph({self.words!r}, unfinished={self.unfinished_word!r})"
+class IndentedParagraph(Paragraph):
+ def __init__(self, firstindent, laterindent, text=None):
+ super().__init__(text)
+ self.firstindent = firstindent
+ self.laterindent = laterindent
+
+ def render(self, width):
+ it = super().render(width - self.firstindent, width - self.laterindent)
+ try:
+ yield " " * self.firstindent + next(it)
+ except StopIteration:
+ return
+ for line in it:
+ yield " " * self.laterindent + next(it)
+
class NotificationLog:
can_highlight_as_target = True