diff options
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; |