MCPcopy Create free account
hub / github.com/TruthHun/BookStack / updateRelationships

Function updateRelationships

static/word2md/mammoth.browser.js:1977–1994  ·  view source on GitHub ↗
(docxFile)

Source from the content-addressed store, hash-verified

1975}
1976
1977function updateRelationships(docxFile) {
1978 var path = "word/_rels/document.xml.rels";
1979 var relationshipsUri = "http://schemas.openxmlformats.org/package/2006/relationships";
1980 var relationshipElementName = "{" + relationshipsUri + "}Relationship";
1981 return docxFile.read(path, "utf8")
1982 .then(xml.readString)
1983 .then(function(relationshipsContainer) {
1984 var relationships = relationshipsContainer.children;
1985 addOrUpdateElement(relationships, relationshipElementName, "Id", {
1986 "Id": "rMammothStyleMap",
1987 "Type": schema,
1988 "Target": styleMapAbsolutePath
1989 });
1990
1991 var namespaces = {"": relationshipsUri};
1992 return docxFile.write(path, xml.writeString(relationshipsContainer, namespaces));
1993 });
1994}
1995
1996function updateContentTypes(docxFile) {
1997 var path = "[Content_Types].xml";

Callers 1

writeStyleMapFunction · 0.70

Calls 1

addOrUpdateElementFunction · 0.70

Tested by

no test coverage detected