diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-09-12 16:06:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-09-12 16:06:21 +0100 |
| commit | 4c88820f3d4778e75a4be50f7a2d78d03dc86316 (patch) | |
| tree | aae9012c78c4f98f691c99adcded4693e67234d8 /mammoth/docx/style_map.py | |
| parent | 470ce2b5f07ed0191842db93bd5b653099c00aff (diff) | |
Add reading and writing of embedded style maps
Diffstat (limited to 'mammoth/docx/style_map.py')
| -rw-r--r-- | mammoth/docx/style_map.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mammoth/docx/style_map.py b/mammoth/docx/style_map.py new file mode 100644 index 0000000..2841830 --- /dev/null +++ b/mammoth/docx/style_map.py @@ -0,0 +1,17 @@ +from ..zips import open_zip + + +_style_map_path = "mammoth/style-map" + + +def write_style_map(fileobj, style_map): + with open_zip(fileobj, "a") as zip_file: + zip_file.write_str(_style_map_path, style_map) + + +def read_style_map(fileobj): + with open_zip(fileobj, "r") as zip_file: + if zip_file.exists(_style_map_path): + return zip_file.read_str(_style_map_path) + + |
