From 296ac78496e4d94dafd1a4f6f872a1283b796318 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 10 Jun 2014 15:40:05 +0100 Subject: Pass all footnotes into document object --- lib/documents.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/documents.js') diff --git a/lib/documents.js b/lib/documents.js index 135e229..86e0709 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -15,7 +15,7 @@ function Document(children, options) { return { type: types.document, children: children, - footnotes: options.footnotes || [] + footnotes: options.footnotes || new Footnotes({}) }; } @@ -71,6 +71,14 @@ function FootnoteReference(options) { }; } +function Footnotes(footnotes) { + this._footnotes = footnotes; +} + +Footnotes.prototype.findFootnoteById = function(id) { + return this._footnotes[id] || null; +} + function Footnote(options) { return { type: types.footnote, @@ -105,5 +113,6 @@ exports.Text = Text; exports.Tab = Tab; exports.Hyperlink = Hyperlink; exports.FootnoteReference = FootnoteReference; +exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.Image = Image; -- cgit v1.2.3