diff options
Diffstat (limited to 'mammoth/html_generation.py')
| -rw-r--r-- | mammoth/html_generation.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mammoth/html_generation.py b/mammoth/html_generation.py index c7f4f38..e538f6e 100644 --- a/mammoth/html_generation.py +++ b/mammoth/html_generation.py @@ -68,12 +68,22 @@ def satisfy_html_path(generator, path): generator.end() for element in path.elements[first_unsatisfied_index:]: - attributes = {} - if element.class_names: - attributes["class"] = _generate_class_attribute(element) - generator.start(element.names[0], attributes=attributes) + _append_element(generator, element) + + +def append_html_path(generator, path): + for element in path.elements: + _append_element(generator, element) + + +def _append_element(generator, element): + attributes = {} + if element.class_names: + attributes["class"] = _generate_class_attribute(element) + generator.start(element.names[0], attributes=attributes) + def _find_first_unsatisfied_index(generator, path): for index, (generated_element, path_element) in enumerate(zip(generator._stack, path.elements)): if not _is_element_match(generated_element, path_element): |
