gdritter repos frony-ritter-designs / 83b4058
Move some helper functions into models Getty Ritter 4 years ago
1 changed file(s) with 9 addition(s) and 0 deletion(s). Collapse all Expand all
88 class Image(typing.NamedTuple):
99 image: str
1010
11 def thumb(self):
12 return self.image[:-4] + '_thumb' + self.image[-4:]
13
1114 class PageContent:
1215 def __init__(self, source):
1316 self.source = source
1417
1518 def rendered(self):
1619 return markdown.markdown(self.source)
20
21 def snipped(self):
22 if len(self.source) < 256:
23 return self.source
24 else:
25 return self.source[:256] + '...'
1726
1827 class Design(typing.NamedTuple):
1928 title: str