diff options
Diffstat (limited to 'lib/output/website.js')
-rw-r--r-- | lib/output/website.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/output/website.js b/lib/output/website.js index 2533dee..3cf890e 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -96,6 +96,14 @@ WebsiteOutput.prototype.prepare = function() { return that.toURL(s); }); + // Get an article using its path + that.env.addFilter('getArticleByPath', function(s) { + var article = that.book.summary.getArticle(s); + if (!article) return undefined; + + return article.getContext(); + }); + // Relase path to an asset that.env.addFilter('resolveAsset', function(href) { href = path.join('gitbook', href); |