diff options
author | Soreine <nicolas@gitbook.com> | 2016-05-17 12:48:03 +0200 |
---|---|---|
committer | Soreine <nicolas@gitbook.com> | 2016-05-17 12:48:03 +0200 |
commit | 167d3957bf2caa1f46bc1b1ef5084fd468594c8d (patch) | |
tree | 4213d84826f73f25d8d3c12f6d48aad5a6da9c2c /lib/parse/lookupStructureFile.js | |
parent | a9571fd67d3d638d6d9d6c11a7e626c5600a68a2 (diff) | |
download | gitbook-167d3957bf2caa1f46bc1b1ef5084fd468594c8d.zip gitbook-167d3957bf2caa1f46bc1b1ef5084fd468594c8d.tar.gz gitbook-167d3957bf2caa1f46bc1b1ef5084fd468594c8d.tar.bz2 |
Expose lookup method for parsable files
Diffstat (limited to 'lib/parse/lookupStructureFile.js')
-rw-r--r-- | lib/parse/lookupStructureFile.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/parse/lookupStructureFile.js b/lib/parse/lookupStructureFile.js new file mode 100644 index 0000000..d4a8f02 --- /dev/null +++ b/lib/parse/lookupStructureFile.js @@ -0,0 +1,20 @@ +var findParsableFile = require('./findParsableFile'); + +/** + Lookup a structure file (ex: SUMMARY.md, GLOSSARY.md) in a book. Uses + book's config to find it. + + @param {Book} book + @param {String} type: one of ["glossary", "readme", "summary", "langs"] + @return {Promise<File>} The path of the file found, relative + to the book content root. +*/ +function lookupStructureFile(book, type) { + var config = book.getConfig(); + + var fileToSearch = config.getValue(['structure', type]); + + return findParsableFile(book, fileToSearch); +} + +module.exports = lookupStructureFile; |