def _format(self, format_name, caller=None): body = caller() text = format_text(self.environment.app, format_name, Markup(body.rstrip()).unescape(), exact_format=True) return text
def render(self, ctx, data, out): with io.StringIO() as tmp: inner_out = tmp.write for c in self.children: c.render(ctx, data, inner_out) text = format_text(ctx.engine.piecrust_app, self.format, tmp.getvalue(), exact_format=True) out(text)
def _formatWith(self, value, format_name): return format_text(self.app, format_name, value)