diff options
author | Johan Preynat <johan.preynat@gmail.com> | 2016-05-04 10:25:37 +0200 |
---|---|---|
committer | Johan Preynat <johan.preynat@gmail.com> | 2016-05-04 10:25:37 +0200 |
commit | da8611e0c313225ffe03dcb7e99164c8564c5599 (patch) | |
tree | fbffcbfeda857570e4c7cdc9017156e6c202b62b /lib/api | |
parent | c84eaa83dd3bf307d5cc35b01febb2b6cc6ffbab (diff) | |
download | gitbook-da8611e0c313225ffe03dcb7e99164c8564c5599.zip gitbook-da8611e0c313225ffe03dcb7e99164c8564c5599.tar.gz gitbook-da8611e0c313225ffe03dcb7e99164c8564c5599.tar.bz2 |
Add global method resolve(fileName)
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/encodeGlobal.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/api/encodeGlobal.js b/lib/api/encodeGlobal.js index cb91a33..8144883 100644 --- a/lib/api/encodeGlobal.js +++ b/lib/api/encodeGlobal.js @@ -1,3 +1,4 @@ +var path = require('path'); var Promise = require('../utils/promise'); var PathUtils = require('../utils/path'); var fs = require('../utils/fs'); @@ -67,6 +68,16 @@ function encodeGlobal(output) { return bookFS.readAsString(fileName); }, + /** + Resolve a file from the book root + + @param {String} fileName + @return {String} + */ + resolve: function(fileName) { + return path.resolve(book.getContentRoot(), fileName); + }, + template: { /** Apply a templating block and returns its result |