diff options
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | lib/document-to-html.js | 2 | ||||
| -rw-r--r-- | test/document-to-html.tests.js | 17 |
3 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,7 @@ +# 1.4.9 + +* Allow hyperlinks to be collapsed. + # 1.4.8 * Improve list support by following w:numStyleLink in w:abstractNum. diff --git a/lib/document-to-html.js b/lib/document-to-html.js index bb27476..2267933 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -372,7 +372,7 @@ function DocumentConversion(options, comments) { } var children = convertElements(element.children, messages, options); - return [Html.freshElement("a", attributes, children)]; + return [Html.nonFreshElement("a", attributes, children)]; }, "bookmarkStart": function(element, messages, options) { var anchor = Html.freshElement("a", { diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index 8d8ae9a..6e61d45 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -354,6 +354,23 @@ test('docx hyperlink is converted to <a>', function() { }); }); +test('docx hyperlink can be collapsed', function() { + var hyperlink = new documents.Document([ + new documents.Hyperlink( + [runOfText("Hello ")], + {href: "http://www.example.com"} + ), + new documents.Hyperlink( + [runOfText("world")], + {href: "http://www.example.com"} + ) + ]); + var converter = new DocumentConverter(); + return converter.convertToHtml(hyperlink).then(function(result) { + assert.equal(result.value, '<a href="http://www.example.com">Hello world</a>'); + }); +}); + test('docx hyperlink with anchor is converted to <a>', function() { var hyperlink = new documents.Hyperlink( [runOfText("Hello.")], |
