def format_context(ctx): if ctx.title and ctx.author_name: return '“{}” by {}'.format(ctx.title, ctx.author_name) if ctx.title: return ctx.title if ctx.author_name: return 'a post by {}'.format(ctx.author_name) return util.prettify_url(ctx.permalink)
def get_slugify_target(self): components = [] if self.author_name: components.append(self.author_name) if self.title: components.append(self.title) elif self.content_plain: components.append(self.content_plain) else: components.append(util.prettify_url(self.permalink or self.url)) return ' '.join(components)
def title_or_url(self): return self.title or util.prettify_url(self.permalink)
def prettify_url(*args, **kwargs): return util.prettify_url(*args, **kwargs)