From 841de73928538038496f15467aba9001b47a2d9c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 14 Dec 2013 15:15:05 +0000 Subject: Add appending of other HTML generators --- mammoth/html_generation.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mammoth/html_generation.py') diff --git a/mammoth/html_generation.py b/mammoth/html_generation.py index c2d0240..e276bdc 100644 --- a/mammoth/html_generation.py +++ b/mammoth/html_generation.py @@ -37,6 +37,12 @@ class HtmlGenerator(object): attribute_string = _generate_attribute_string(element.attributes) self._fragments.append("<{0}{1}>".format(element.name, attribute_string)) + def append(self, other): + if other._fragments: + self._write_all() + for fragment in other._fragments: + self._fragments.append(fragment) + def html_string(self): return "".join(self._fragments) -- cgit v1.2.3