aboutsummaryrefslogtreecommitdiff
path: root/mammoth/style_reader/document_matcher_reader.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-25 19:07:27 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-25 19:07:27 +0000
commit3ed30fd8bc749d3c8009b3fd9e8ce125af5ee441 (patch)
tree6460c7e1f2e9940a6ef1e84a2626acfd8ae5aff0 /mammoth/style_reader/document_matcher_reader.py
parent17ba20787c2637c65df0c02c6ffbd71a318e451a (diff)
Read italic document matcher
Diffstat (limited to 'mammoth/style_reader/document_matcher_reader.py')
-rw-r--r--mammoth/style_reader/document_matcher_reader.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mammoth/style_reader/document_matcher_reader.py b/mammoth/style_reader/document_matcher_reader.py
index ee5b467..66f5d19 100644
--- a/mammoth/style_reader/document_matcher_reader.py
+++ b/mammoth/style_reader/document_matcher_reader.py
@@ -14,12 +14,14 @@ def read_document_matcher_node(root_node):
return _read_paragraph_node(element_node)
elif element_node.expr_name == "run":
return _read_run_node(element_node)
+ elif element_node.expr_name == "bold":
+ return document_matchers.bold
+ elif element_node.expr_name == "italic":
+ return document_matchers.italic
elif element_node.expr_name == "underline":
return document_matchers.underline
elif element_node.expr_name == "strikethrough":
return document_matchers.strikethrough
- elif element_node.expr_name == "bold":
- return document_matchers.bold
def _read_paragraph_node(paragraph_node):
@@ -59,7 +61,7 @@ def _read_list_node(list_node):
return None
grammar_text = r"""
-document_matcher = paragraph / run / underline / strikethrough / bold
+document_matcher = paragraph / run / underline / strikethrough / bold / italic
underline = "u"
@@ -67,6 +69,8 @@ strikethrough = "strike"
bold = "b"
+italic = "i"
+
paragraph = "p" style_id? style_name_specifier? list?
run = "r" style_id? style_name_specifier?