diff --git a/amanuensis/parser/render.py b/amanuensis/parser/render.py index 37bc91a..1016fda 100644 --- a/amanuensis/parser/render.py +++ b/amanuensis/parser/render.py @@ -10,16 +10,16 @@ class PreviewHtmlRenderer(): def LineBreak(self, span): return '
' def ParsedArticle(self, span): - return '\n'.join([child.render(self) for child in span.spans]) + return '\n'.join(span.recurse(self)) def BodyParagraph(self, span): - return f'

{"".join([child.render(self) for child in span.spans])}

' + return f'

{"".join(span.recurse(self))}

' def SignatureParagraph(self, span): return ('

' - f'{"".join([child.render(self) for child in span.spans])}' + f'{"".join(span.recurse(self))}' '

') def BoldSpan(self, span): - return f'{"".join([child.render(self) for child in span.spans])}' + return f'{"".join(span.recurse(self))}' def ItalicSpan(self, span): - return f'{"".join([child.render(self) for child in span.spans])}' + return f'{"".join(span.recurse(self))}' def CitationSpan(self, span): return f'{span.cite_text}' diff --git a/amanuensis/parser/text.py b/amanuensis/parser/text.py index 45f8868..c2a2220 100644 --- a/amanuensis/parser/text.py +++ b/amanuensis/parser/text.py @@ -29,6 +29,8 @@ class SpanContainer(Renderable): self.spans = spans def __str__(self): return f"[{type(self).__name__} {' '.join([str(span) for span in self.spans])}]" + def recurse(self, renderer): + return [child.render(renderer) for child in self.spans] class ParsedArticle(SpanContainer): """Multiple paragraphs"""