diff options
| author | Tobias Bocanegra <tripod@adobe.com> | 2020-09-07 14:52:12 +0900 |
|---|---|---|
| committer | Tobias Bocanegra <tripod@adobe.com> | 2020-09-07 14:52:26 +0900 |
| commit | 091111ce4b0bece922d814a63e8f294cf52b79a6 (patch) | |
| tree | 8eca9cef0405c571c659454e06092b3bedfe30f2 /lib | |
| parent | 50ed890db42c2cf6a1dbdf33c767059b654756df (diff) | |
Fix: Underline with value 'none' is wrongly detected
fixes #249
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/docx/body-reader.js | 11 |
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"]; |
