diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-06-11 15:44:44 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-06-11 15:44:44 +0100 |
| commit | eb7facff4a57dcf6c6818eeeb47580a83a7cbdcc (patch) | |
| tree | eac83980810e1d11743971a4c26c7687a1313fe5 | |
| parent | f9b2d0c27fa9c3407e24dda32301c4f566af8d26 (diff) | |
Move jump back into last footnote paragraph
| -rw-r--r-- | lib/document-to-html.js | 7 | ||||
| -rw-r--r-- | tests/document-to-html.tests.js | 2 | ||||
| -rw-r--r-- | tests/mammoth.tests.js | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index faae02b..fe601bd 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -203,12 +203,11 @@ function DocumentConversion(options) { if (err) { callback(err); } else { + footnoteHtml.text(" "); + footnoteHtml.open(htmlPaths.element("a", {href: "#footnote-ref-" + uid})); + footnoteHtml.text("↑"); footnoteHtml.closeAll(); html.append(footnoteHtml); - html.text(" "); - html.open(htmlPaths.element("a", {href: "#footnote-ref-" + uid})); - html.text("↑"); - html.close(); html.close(); callback(); } diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index cf6fa5b..cfd1c20 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -234,7 +234,7 @@ describe('DocumentConverter', function() { }); return converter.convertToHtml(document).then(function(result) { var expectedOutput = '<p>Knock knock<sup><a href="#footnote-42-4" id="footnote-ref-42-4">[1]</a></sup></p>' + - '<ol><li id="footnote-42-4"><p>Who\'s there?</p> <a href="#footnote-ref-42-4">↑</a></li></ol>'; + '<ol><li id="footnote-42-4"><p>Who\'s there? <a href="#footnote-ref-42-4">↑</a></p></li></ol>'; assert.equal(result.value, expectedOutput); }); }); diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 7b502a4..1fc278e 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -98,8 +98,8 @@ describe('mammoth', function() { var expectedOutput = '<p>Ouch' + '<sup><a href="#footnote-42-1" id="footnote-ref-42-1">[1]</a></sup>.' + '<sup><a href="#footnote-42-2" id="footnote-ref-42-2">[2]</a></sup></p>' + - '<ol><li id="footnote-42-1"><p> A tachyon walks into a bar.</p> <a href="#footnote-ref-42-1">↑</a></li>' + - '<li id="footnote-42-2"><p> Fin.</p> <a href="#footnote-ref-42-2">↑</a></li></ol>' + '<ol><li id="footnote-42-1"><p> A tachyon walks into a bar. <a href="#footnote-ref-42-1">↑</a></p></li>' + + '<li id="footnote-42-2"><p> Fin. <a href="#footnote-ref-42-2">↑</a></p></li></ol>' assert.equal(result.value, expectedOutput); // TODO: get rid of warnings //~ assert.deepEqual(result.messages, []); |
