aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan Lehman <jonathan.lehman91@gmail.com>2017-02-17 11:59:38 -0500
committerJonathan Lehman <jonathan.lehman91@gmail.com>2017-02-17 11:59:38 -0500
commit75e327ddfff69d7bdbaff994e4662f7c37cc2b85 (patch)
tree318fe55904110bdec9131af14e6d2ade3100acf9 /lib
parentc626ef8e1047fb9f27fc4db8c17783a711bd566a (diff)
Handle split instrText elements
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/body-reader.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index e92f8b4..9345e02 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -21,6 +21,7 @@ function createBodyReader(options) {
function BodyReader(options) {
var fieldHyperlink = null;
+ var currentInstrText = [];
var relationships = options.relationships;
var contentTypes = options.contentTypes;
var docxFile = options.docxFile;
@@ -159,14 +160,17 @@ function BodyReader(options) {
var type = element.attributes["w:fldCharType"];
if (type === "end") {
fieldHyperlink = null;
+ } else if (type === "separate") {
+ var hyperlink = parseHyperlinkFieldCode(currentInstrText.join(''));
+ if (hyperlink !== null) {
+ fieldHyperlink = hyperlink;
+ }
+ currentInstrText = [];
}
return emptyResult();
},
"w:instrText": function(element) {
- var hyperlink = parseHyperlinkFieldCode(element.text());
- if (hyperlink !== null) {
- fieldHyperlink = hyperlink;
- }
+ currentInstrText.push(element.text());
return emptyResult();
},
"w:t": function(element) {