aboutsummaryrefslogtreecommitdiff
path: root/mammoth/transforms.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-04-04 19:45:45 +0100
committerMichael Williamson <mike@zwobble.org>2017-04-04 19:45:45 +0100
commit438d88240b5bfa99494562fc39817967fbfbb2f0 (patch)
treef7ec099147c1614c027e9ca71c3dc2f5ffd6db0a /mammoth/transforms.py
parentc2c41682589c2488ae0a0eb25b0e5adace338d36 (diff)
Extract element_of_type in transforms module
Diffstat (limited to 'mammoth/transforms.py')
-rw-r--r--mammoth/transforms.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mammoth/transforms.py b/mammoth/transforms.py
index 21bcbf6..d126578 100644
--- a/mammoth/transforms.py
+++ b/mammoth/transforms.py
@@ -2,9 +2,13 @@ from . import documents
def paragraph(transform_paragraph):
+ return element_of_type(documents.Paragraph, transform_paragraph)
+
+
+def element_of_type(element_type, transform):
def transform_element(element):
- if isinstance(element, documents.Paragraph):
- return transform_paragraph(element)
+ if isinstance(element, element_type):
+ return transform(element)
else:
return element