diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-01-25 16:48:36 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-01-25 16:48:36 +0000 |
| commit | cd2fd5e4a2efbf444ef3cf1908cd891aad8b8023 (patch) | |
| tree | 657f36e4e4a046fbdcf5283b995722a9832ac831 | |
| parent | 88709afd9b72bcb12b12273bf9c382031d93d622 (diff) | |
Add style mappings for LibreOffice footnotes and endnotes
| -rw-r--r-- | mammoth/options.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mammoth/options.py b/mammoth/options.py index 79aec8c..19f9d33 100644 --- a/mammoth/options.py +++ b/mammoth/options.py @@ -11,10 +11,17 @@ def read_options(options): def _read_style_map(style_text): - lines = filter(None, map(lambda line: line.strip(), style_text.split("\n"))) + lines = filter(None, map(_get_line, style_text.split("\n"))) return lists.map(style_reader.read_style, lines) +def _get_line(line): + line = line.strip() + if line.startswith("#"): + return None + else: + return line + _default_style_map = _read_style_map(""" p[style-name='Normal'] => p:fresh @@ -35,6 +42,12 @@ p[style-name='heading 4'] => h4:fresh p[style-name='footnote text'] => p r[style-name='footnote reference'] => + +# LibreOffice +p[style-name='Footnote'] => p +r[style-name='Footnote anchor'] => +p[style-name='Endnote'] => p +r[style-name='Endnote anchor'] => p:unordered-list(1) => ul > li:fresh p:unordered-list(2) => ul|ol > li > ul > li:fresh |
