summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-11-19 18:15:22 +0000
committerMichael Williamson <mike@zwobble.org>2016-11-19 18:15:22 +0000
commitc089bf6bb4c565651f302ae5a57ac546223a68db (patch)
treecf59dab70b15e45243db5bb91973f7c5bccb9074
parent954211d736386bebca30393e63481e04af429878 (diff)
Simplify run property creation
-rw-r--r--lib/docx/body-reader.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 61dc79d..8c403be 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -34,21 +34,18 @@ function BodyReader(options) {
}
function readRunProperties(element) {
- var properties = {
- type: "runProperties"
- };
-
- properties.verticalAlignment = element.firstOrEmpty("w:vertAlign").attributes["w:val"];
- properties.font = element.firstOrEmpty("w:rFonts").attributes["w:ascii"];
- properties.isBold = readBooleanElement(element.first("w:b"));
- properties.isUnderline = readBooleanElement(element.first("w:u"));
- properties.isItalic = readBooleanElement(element.first("w:i"));
- properties.isStrikethrough = readBooleanElement(element.first("w:strike"));
-
return readRunStyle(element).map(function(style) {
- properties.styleId = style.styleId;
- properties.styleName = style.name;
- return properties;
+ return {
+ type: "runProperties",
+ styleId: style.styleId,
+ styleName: style.name,
+ verticalAlignment: element.firstOrEmpty("w:vertAlign").attributes["w:val"],
+ font: element.firstOrEmpty("w:rFonts").attributes["w:ascii"],
+ isBold: readBooleanElement(element.first("w:b")),
+ isUnderline: readBooleanElement(element.first("w:u")),
+ isItalic: readBooleanElement(element.first("w:i")),
+ isStrikethrough: readBooleanElement(element.first("w:strike"))
+ };
});
}