summaryrefslogtreecommitdiff
path: root/mammoth/raw_text.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-07-15 16:19:37 +0100
committerMichael Williamson <mike@zwobble.org>2015-07-15 16:19:37 +0100
commit7d8e8197b03f87a8cac2eed8f75e8a41136cc760 (patch)
tree9f8595f9e2a4b5fa6eea74abaf433e722b0d4edf /mammoth/raw_text.py
parentd18e908606feeb30b21adf9a583065e6a5a74a0f (diff)
Split off raw_text module
Diffstat (limited to 'mammoth/raw_text.py')
-rw-r--r--mammoth/raw_text.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mammoth/raw_text.py b/mammoth/raw_text.py
new file mode 100644
index 0000000..fb39acf
--- /dev/null
+++ b/mammoth/raw_text.py
@@ -0,0 +1,12 @@
+from . import documents
+
+
+def extract_raw_text_from_element(element):
+ if isinstance(element, documents.Text):
+ return element.value
+ else:
+ text = "".join(map(extract_raw_text_from_element, element.children))
+ if isinstance(element, documents.Paragraph):
+ return text + "\n\n"
+ else:
+ return text