From bc8c341b37bfac34bbeaccdd5368c2d7edc309ac Mon Sep 17 00:00:00 2001 From: Bruno Herfst Date: Wed, 26 Oct 2016 11:04:09 +1100 Subject: Add support for page and column breaks --- mammoth/document_matchers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mammoth/document_matchers.py') diff --git a/mammoth/document_matchers.py b/mammoth/document_matchers.py index d1f8e74..faccb50 100644 --- a/mammoth/document_matchers.py +++ b/mammoth/document_matchers.py @@ -39,6 +39,15 @@ class comment_reference(object): element_type = "comment_reference" +BreakMatcher = collections.namedtuple("BreakMatcher", ["break_type"]) +BreakMatcher.element_type = "break" + + +line_break = BreakMatcher("line") +page_break = BreakMatcher("page") +column_break = BreakMatcher("column") + + def equal_to(value): return StringMatcher(_operator_equal_to, value) @@ -50,7 +59,6 @@ def _operator_equal_to(first, second): def starts_with(value): return StringMatcher(_operator_starts_with, value) - def _operator_starts_with(first, second): return second.upper().startswith(first.upper()) -- cgit v1.2.3