aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTobias Bocanegra <tripod@adobe.com>2020-09-07 14:52:12 +0900
committerTobias Bocanegra <tripod@adobe.com>2020-09-07 14:52:26 +0900
commit091111ce4b0bece922d814a63e8f294cf52b79a6 (patch)
tree8eca9cef0405c571c659454e06092b3bedfe30f2 /lib
parent50ed890db42c2cf6a1dbdf33c767059b654756df (diff)
Fix: Underline with value 'none' is wrongly detected
fixes #249
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/body-reader.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index e7e306c..ad4f409 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -70,7 +70,7 @@ function BodyReader(options) {
font: element.firstOrEmpty("w:rFonts").attributes["w:ascii"],
fontSize: fontSize,
isBold: readBooleanElement(element.first("w:b")),
- isUnderline: readBooleanElement(element.first("w:u")),
+ isUnderline: readUnderline(element.first("w:u")),
isItalic: readBooleanElement(element.first("w:i")),
isStrikethrough: readBooleanElement(element.first("w:strike")),
isSmallCaps: readBooleanElement(element.first("w:smallCaps"))
@@ -78,6 +78,15 @@ function BodyReader(options) {
});
}
+ function readUnderline(element) {
+ if (element) {
+ var value = element.attributes["w:val"];
+ return value !== "false" && value !== "0" && value !== "none";
+ } else {
+ return false;
+ }
+ }
+
function readBooleanElement(element) {
if (element) {
var value = element.attributes["w:val"];