diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-06-13 12:55:42 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-06-13 12:55:42 +0100 |
| commit | d12d00f3ed36f0ffe8f8920cf028fb977a18ce24 (patch) | |
| tree | 50d2b6c6c10b7aed41acee4c6a6167fe0cacadd6 /lib/docx | |
| parent | 0546ccd76018d05a513fb1a1c4bb6bca42628dab (diff) | |
Handle highlight value of none
Diffstat (limited to 'lib/docx')
| -rw-r--r-- | lib/docx/body-reader.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js index 78c732e..28bd2ef 100644 --- a/lib/docx/body-reader.js +++ b/lib/docx/body-reader.js @@ -95,7 +95,7 @@ function BodyReader(options) { isStrikethrough: readBooleanElement(element.first("w:strike")), isAllCaps: readBooleanElement(element.first("w:caps")), isSmallCaps: readBooleanElement(element.first("w:smallCaps")), - highlight: element.firstOrEmpty("w:highlight").attributes["w:val"] + highlight: readHighlightValue(element.firstOrEmpty("w:highlight").attributes["w:val"]) }; }); } @@ -118,6 +118,14 @@ function BodyReader(options) { } } + function readHighlightValue(value) { + if (!value || value === "none") { + return null; + } else { + return value; + } + } + function readParagraphStyle(element) { return readStyle(element, "w:pStyle", "Paragraph", styles.findParagraphStyleById); } |
