diff options
Diffstat (limited to 'mammoth')
| -rw-r--r-- | mammoth/docx/body_xml.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index a087191..db3da4e 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -1,5 +1,6 @@ import contextlib import re +import sys from .. import documents from .. import results @@ -9,6 +10,9 @@ from .xmlparser import node_types, XmlElement from .styles_xml import Styles from .uris import replace_fragment, uri_to_zip_entry_name +if sys.version_info >= (3, ): + unichr = chr + def reader( numbering=None, @@ -202,6 +206,10 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f return _success(documents.tab()) + def no_break_hyphen(element): + return _success(documents.text(unichr(0x2011))) + + def table(element): return _read_xml_elements(element.children) \ .flat_map(calculate_row_spans) \ @@ -432,6 +440,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f "w:fldChar": read_fld_char, "w:instrText": read_instr_text, "w:tab": tab, + "w:noBreakHyphen": no_break_hyphen, "w:tbl": table, "w:tr": table_row, "w:tc": table_cell, |
