From 12eb3306caaa503e887539a3cf641116156a43c6 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 19 Jan 2017 22:17:33 +0000 Subject: Simplify reading of paragraph properties --- lib/docx/body-reader.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'lib') 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) { -- cgit v1.2.3