diff options
| -rw-r--r-- | mammoth/document_matchers.py | 4 | ||||
| -rw-r--r-- | mammoth/style_reader/document_matcher_reader.py | 6 | ||||
| -rw-r--r-- | tests/style_reader_tests.py | 7 |
3 files changed, 16 insertions, 1 deletions
diff --git a/mammoth/document_matchers.py b/mammoth/document_matchers.py index 6f40318..2efd73f 100644 --- a/mammoth/document_matchers.py +++ b/mammoth/document_matchers.py @@ -31,3 +31,7 @@ class underline(object): class strikethrough(object): element_type = "strikethrough" + + +class comment_reference(object): + element_type = "comment_reference" diff --git a/mammoth/style_reader/document_matcher_reader.py b/mammoth/style_reader/document_matcher_reader.py index 66f5d19..b22b6a0 100644 --- a/mammoth/style_reader/document_matcher_reader.py +++ b/mammoth/style_reader/document_matcher_reader.py @@ -22,6 +22,8 @@ def read_document_matcher_node(root_node): return document_matchers.underline elif element_node.expr_name == "strikethrough": return document_matchers.strikethrough + elif element_node.expr_name == "comment_reference": + return document_matchers.comment_reference def _read_paragraph_node(paragraph_node): @@ -61,7 +63,7 @@ def _read_list_node(list_node): return None grammar_text = r""" -document_matcher = paragraph / run / underline / strikethrough / bold / italic +document_matcher = paragraph / run / underline / strikethrough / bold / italic / comment_reference underline = "u" @@ -71,6 +73,8 @@ bold = "b" italic = "i" +comment_reference = "comment-reference" + paragraph = "p" style_id? style_name_specifier? list? run = "r" style_id? style_name_specifier? diff --git a/tests/style_reader_tests.py b/tests/style_reader_tests.py index 1f68ac2..fddc75b 100644 --- a/tests/style_reader_tests.py +++ b/tests/style_reader_tests.py @@ -162,6 +162,13 @@ class ReadDocumentMatcherTests(object): read_document_matcher("strike") ) + @istest + def reads_comment_reference(self): + assert_equal( + document_matchers.comment_reference, + read_document_matcher("comment-reference") + ) + @istest def document_matcher_is_mapped_to_html_path_using_fat_arrow(): |
