Allow None render hooks

This commit is contained in:
Tim Van Baak 2020-03-21 08:59:33 -07:00
parent 7780d2b1f1
commit b47085ff6a

View File

@ -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"""