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

Function readStylesXml

static/word2md/mammoth.browser.js:2057–2082  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

2055Styles.EMPTY = new Styles({}, {}, {}, {});
2056
2057function readStylesXml(root) {
2058 var paragraphStyles = {};
2059 var characterStyles = {};
2060 var tableStyles = {};
2061 var numberingStyles = {};
2062
2063 var styles = {
2064 "paragraph": paragraphStyles,
2065 "character": characterStyles,
2066 "table": tableStyles
2067 };
2068
2069 root.getElementsByTagName("w:style").forEach(function(styleElement) {
2070 var style = readStyleElement(styleElement);
2071 if (style.type === "numbering") {
2072 numberingStyles[style.styleId] = readNumberingStyleElement(styleElement);
2073 } else {
2074 var styleSet = styles[style.type];
2075 if (styleSet) {
2076 styleSet[style.styleId] = style;
2077 }
2078 }
2079 });
2080
2081 return new Styles(paragraphStyles, characterStyles, tableStyles, numberingStyles);
2082}
2083
2084function readStyleElement(styleElement) {
2085 var type = styleElement.attributes["w:type"];

Callers

nothing calls this directly

Calls 2

readStyleElementFunction · 0.70

Tested by

no test coverage detected