aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/conversion.py2
-rw-r--r--mammoth/documents.py6
-rw-r--r--mammoth/docx/document_xml.py2
3 files changed, 7 insertions, 3 deletions
diff --git a/mammoth/conversion.py b/mammoth/conversion.py
index fc35efe..c4631e1 100644
--- a/mammoth/conversion.py
+++ b/mammoth/conversion.py
@@ -99,6 +99,8 @@ class DocumentConverter(object):
run_generator.start("sub")
if run.is_underline:
self._convert_underline(run_generator)
+ if run.is_strikethrough:
+ run_generator.start("s")
self._convert_elements_to_html(run.children, run_generator)
run_generator.end_all()
html_generator.append(run_generator)
diff --git a/mammoth/documents.py b/mammoth/documents.py
index 0e96c05..f2678ca 100644
--- a/mammoth/documents.py
+++ b/mammoth/documents.py
@@ -5,7 +5,7 @@ Document = dodge.data_class("Document", ["children", "notes"])
Paragraph = dodge.data_class("Paragraph", ["children", "style_id", "style_name", "numbering"])
Run = dodge.data_class("Run", [
"children", "style_id", "style_name", "is_bold", "is_italic",
- "is_underline", "vertical_alignment",
+ "is_underline", "is_strikethrough", "vertical_alignment",
])
Text = dodge.data_class("Text", ["value"])
Hyperlink = dodge.data_class("Hyperlink", ["href", "anchor", "children"])
@@ -33,12 +33,12 @@ def document(children, notes=None):
def paragraph(children, style_id=None, style_name=None, numbering=None):
return Paragraph(children, style_id, style_name, numbering)
-def run(children, style_id=None, style_name=None, is_bold=None, is_italic=None, is_underline=None, vertical_alignment=None):
+def run(children, style_id=None, style_name=None, is_bold=None, is_italic=None, is_underline=None, is_strikethrough=None, vertical_alignment=None):
if vertical_alignment is None:
vertical_alignment = VerticalAlignment.baseline
return Run(
children, style_id, style_name, bool(is_bold), bool(is_italic),
- bool(is_underline), vertical_alignment,
+ bool(is_underline), bool(is_strikethrough), vertical_alignment,
)
class VerticalAlignment(object):
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index 84e2790..3147ed4 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -80,6 +80,7 @@ def _create_reader(numbering, content_types, relationships, styles, note_element
is_bold = properties.find_child("w:b")
is_italic = properties.find_child("w:i")
is_underline = properties.find_child("w:u")
+ is_strikethrough = properties.find_child("w:strike")
return _read_xml_elements(element.children) \
.map(lambda children: documents.run(
@@ -89,6 +90,7 @@ def _create_reader(numbering, content_types, relationships, styles, note_element
is_bold=is_bold,
is_italic=is_italic,
is_underline=is_underline,
+ is_strikethrough=is_strikethrough,
vertical_alignment=vertical_alignment,
))