aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-01-19 22:17:33 +0000
committerMichael Williamson <mike@zwobble.org>2017-01-19 22:17:33 +0000
commit12eb3306caaa503e887539a3cf641116156a43c6 (patch)
tree7be4a2de32e42e0c0cbff93e303ebdff211057c6
parent782b60232d03d9185dda82c05633c96f68a32e7c (diff)
Simplify reading of paragraph properties
-rw-r--r--lib/docx/body-reader.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index bdc0954..2d74c13 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -118,20 +118,14 @@ function BodyReader(options) {
.insertExtra();
},
"w:pPr": function(element) {
- var properties = {
- type: "paragraphProperties"
- };
-
- var alignElement = element.first("w:jc");
- if (alignElement) {
- properties.alignment = alignElement.attributes["w:val"];
- }
- properties.numbering = readNumberingProperties(element.firstOrEmpty("w:numPr"));
-
return readParagraphStyle(element).map(function(style) {
- properties.styleId = style.styleId;
- properties.styleName = style.name;
- return properties;
+ return {
+ type: "paragraphProperties",
+ styleId: style.styleId,
+ styleName: style.name,
+ alignment: element.firstOrEmpty("w:jc").attributes["w:val"],
+ numbering: readNumberingProperties(element.firstOrEmpty("w:numPr"))
+ };
});
},
"w:r": function(element) {