From c098d25076380da5adbcfa7a4e1378e4fdf347d4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 11 Jun 2014 09:42:57 +0100 Subject: Wrap footnote references in square brackets --- lib/document-to-html.js | 2 +- tests/document-to-html.tests.js | 4 ++-- tests/mammoth.tests.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/document-to-html.js b/lib/document-to-html.js index 5b8db9a..bec48b0 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -175,7 +175,7 @@ function DocumentConversion(options) { html.open(htmlPaths.element("sup")); html.open(htmlPaths.element("a", {href: "#footnote-" + element.footnoteId})); footnoteIds.push(element.footnoteId); - html.text((footnoteNumber++).toString()); + html.text("[" + (footnoteNumber++) + "]"); html.close(); html.close(); callback(); diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index da9879e..a8cf0ab 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -204,7 +204,7 @@ describe('DocumentConverter', function() { }); var converter = new DocumentConverter(); return converter.convertToHtml(footnoteReference).then(function(result) { - assert.equal(result.value, '1'); + assert.equal(result.value, '[1]'); }); }); @@ -229,7 +229,7 @@ describe('DocumentConverter', function() { var converter = new DocumentConverter(); return converter.convertToHtml(document).then(function(result) { - var expectedOutput = '

Knock knock1

' + + var expectedOutput = '

Knock knock[1]

' + '
  1. Who\'s there?

'; assert.equal(result.value, expectedOutput); }); diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 4983849..30fba34 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -94,7 +94,7 @@ describe('mammoth', function() { // TODO: don't duplicate footnotes with multiple references var docxPath = path.join(__dirname, "test-data/footnotes.docx"); return mammoth.convertToHtml({path: docxPath}).then(function(result) { - var expectedOutput = '

Ouch1.2

' + + var expectedOutput = '

Ouch[1].[2]

' + '
  1. A tachyon walks into a bar.

  2. ' + '
  3. Fin.

' assert.equal(result.value, expectedOutput); -- cgit v1.2.3