diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-06-10 15:40:05 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-06-10 15:40:05 +0100 |
| commit | 296ac78496e4d94dafd1a4f6f872a1283b796318 (patch) | |
| tree | 1d30666e971e63a5bf0e4008bf1a0abacde3d0be /lib/documents.js | |
| parent | 88b21ba0d0989a5c4f142f5971d33b069a7dfb26 (diff) | |
Pass all footnotes into document object
Diffstat (limited to 'lib/documents.js')
| -rw-r--r-- | lib/documents.js | 11 |
1 files changed, 10 insertions, 1 deletions
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; |
