diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/docx/body-reader.js | 12 |
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) { |
