aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/style_map.py
blob: 94c32af632f5cd0b0029fe9c842b6d7e921ff922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from ..zips import open_zip, update_zip


_style_map_path = "mammoth/style-map"


def write_style_map(fileobj, style_map):
    update_zip(fileobj, {
        _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)