From b47085ff6ae0758378885e987687bfe35a68bf66 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sat, 21 Mar 2020 08:59:33 -0700 Subject: [PATCH] Allow None render hooks --- amanuensis/parser/text.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/amanuensis/parser/text.py b/amanuensis/parser/text.py index 9b03c84..1be4d9a 100644 --- a/amanuensis/parser/text.py +++ b/amanuensis/parser/text.py @@ -9,7 +9,10 @@ import re class Renderable(): def render(self, renderer): - return getattr(renderer, type(self).__name__)(self) + hook = getattr(renderer, type(self).__name__, None) + if hook: + return hook(self) + return None class TextSpan(Renderable): """An unstyled length of text"""