diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-01-19 23:05:45 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-01-19 23:05:45 +0000 |
| commit | 965bd9513da033b9804af8ec29c7fa609a84512c (patch) | |
| tree | 28027622b24a00bb44fd4a1e9c91462493d78989 /lib/document-to-html.js | |
| parent | 58cae6030e51481ffb462e52ab6aeb479e0a705d (diff) | |
Add support for endnotes
Diffstat (limited to 'lib/document-to-html.js')
| -rw-r--r-- | lib/document-to-html.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index 030df32..eec329f 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -28,9 +28,9 @@ function DocumentConverter(options) { } function DocumentConversion(options) { - var footnoteNumber = 1; + var noteNumber = 1; - var footnoteIds = []; + var noteReferences = []; options = options || {}; var generateUniquifier = options.generateUniquifier || function() { @@ -140,7 +140,7 @@ function DocumentConversion(options) { }); }); - function footnoteUid(id) { + function noteUid(id) { return uniquifier + "-" + id; } @@ -199,10 +199,10 @@ function DocumentConversion(options) { } else { html.closeAll(); html.open(htmlPaths.element("ol")); - var footnotes = footnoteIds.map(function(id) { - return document.notes.findFootnoteById(id); + var notes = noteReferences.map(function(noteReference) { + return document.notes.resolve(noteReference); }); - convertElements(footnotes, html, messages, function(error) { + convertElements(notes, html, messages, function(error) { if (error) { callback(error); } else { @@ -234,22 +234,22 @@ function DocumentConversion(options) { } }); }, - "footnoteReference": function(element, html, messages, callback) { - var uid = footnoteUid(element.footnoteId); + "noteReference": function(element, html, messages, callback) { + var uid = noteUid(element.noteId); html.open(htmlPaths.element("sup")); html.open(htmlPaths.element("a", { - href: "#footnote-" + uid, - id: "footnote-ref-" + uid + href: "#" + element.noteType + "-" + uid, + id: element.noteType + "-ref-" + uid })); - footnoteIds.push(element.footnoteId); - html.text("[" + (footnoteNumber++) + "]"); + noteReferences.push(element); + html.text("[" + (noteNumber++) + "]"); html.close(); html.close(); callback(); }, "note": function(element, html, messages, callback) { - var uid = footnoteUid(element.id); + var uid = noteUid(element.id); html.open(htmlPaths.element("li", {id: element.noteType + "-" + uid})); var footnoteHtml = new HtmlGenerator(); |
