(root)
| 2055 | Styles.EMPTY = new Styles({}, {}, {}, {}); |
| 2056 | |
| 2057 | function 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 | |
| 2084 | function readStyleElement(styleElement) { |
| 2085 | var type = styleElement.attributes["w:type"]; |
nothing calls this directly
no test coverage detected