aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mammoth/options.py4
-rw-r--r--tests/options_tests.py9
2 files changed, 12 insertions, 1 deletions
diff --git a/mammoth/options.py b/mammoth/options.py
index a2e32b7..9d51b48 100644
--- a/mammoth/options.py
+++ b/mammoth/options.py
@@ -3,8 +3,10 @@ from . import style_reader, lists
def read_options(options):
custom_style_map = _read_style_map(options.get("style_map") or "")
+ include_default_style_map = options.get("include_default_style_map", True)
- options["style_map"] = custom_style_map + _default_style_map
+ options["style_map"] = custom_style_map + \
+ (_default_style_map if include_default_style_map else [])
return options
diff --git a/tests/options_tests.py b/tests/options_tests.py
index c646b12..12c1af8 100644
--- a/tests/options_tests.py
+++ b/tests/options_tests.py
@@ -16,3 +16,12 @@ def custom_style_mappings_are_prepended_to_default_style_mappings():
})["style_map"]
assert_equal(style_reader.read_style("p.SectionTitle => h2"), style_map[0])
assert_equal(_default_style_map, style_map[1:])
+
+
+@istest
+def default_style_mappings_are_ignored_if_include_default_style_map_is_false():
+ style_map = read_options({
+ "style_map": "p.SectionTitle => h2",
+ "include_default_style_map": False
+ })["style_map"]
+ assert_equal([style_reader.read_style("p.SectionTitle => h2")], style_map)