aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/uris.py
blob: 892078efd34c3740ffd9df0003a2e4a96f64e69b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
def uri_to_zip_entry_name(base, uri):
    if uri.startswith("/"):
        return uri[1:]
    else:
        return base + "/" + uri


def replace_fragment(uri, fragment):
    hash_index = uri.find("#")
    if hash_index != -1:
        uri = uri[:hash_index]
    return uri + "#" + fragment