summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-06-11 09:42:57 +0100
committerMichael Williamson <mike@zwobble.org>2014-06-11 09:42:57 +0100
commitc098d25076380da5adbcfa7a4e1378e4fdf347d4 (patch)
tree9a2cd34e4a87549a7811e3a1cec73c06eb5a7783
parentfab4cbb2a2c87b9eb5c11cc91d8d0fbea6201ea8 (diff)
Wrap footnote references in square brackets
-rw-r--r--lib/document-to-html.js2
-rw-r--r--tests/document-to-html.tests.js4
-rw-r--r--tests/mammoth.tests.js2
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, '<sup><a href="#footnote-4">1</a></sup>');
+ assert.equal(result.value, '<sup><a href="#footnote-4">[1]</a></sup>');
});
});
@@ -229,7 +229,7 @@ describe('DocumentConverter', function() {
var converter = new DocumentConverter();
return converter.convertToHtml(document).then(function(result) {
- var expectedOutput = '<p>Knock knock<sup><a href="#footnote-4">1</a></sup></p>' +
+ var expectedOutput = '<p>Knock knock<sup><a href="#footnote-4">[1]</a></sup></p>' +
'<ol><li id="footnote-4"><p>Who\'s there?</p></li></ol>';
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 = '<p>Ouch<sup><a href="#footnote-1">1</a></sup>.<sup><a href="#footnote-2">2</a></sup></p>' +
+ var expectedOutput = '<p>Ouch<sup><a href="#footnote-1">[1]</a></sup>.<sup><a href="#footnote-2">[2]</a></sup></p>' +
'<ol><li id="footnote-1"><p> A tachyon walks into a bar.</p></li>' +
'<li id="footnote-2"><p> Fin.</p></li></ol>'
assert.equal(result.value, expectedOutput);