UNPKG

824 Btext/coffeescriptView Raw
1_ = require('lodash')
2getConfig = require('./config')
3SwigHelper = require('./swig-helper')
4HbHelper = require('@resin.io/doxx-handlebars-helper')
5LunrSearch = require('./lunr-search')
6Nav = require('./nav')
7
8Doxx = (config) ->
9 if not (this instanceof Doxx)
10 return new Doxx(arguments...)
11
12 this.config = getConfig(config)
13 return
14
15Doxx::build = require('./build')
16
17Doxx::navParse = ->
18 Nav.parse(this.config)
19Doxx.navPP = Nav.pp
20
21Doxx::configureExpress = (app) ->
22 SwigHelper.configureExpress(app, this.config)
23
24Doxx::getLocals = ->
25 layoutLocals = this.config.layoutLocals
26 return _.assign {}, layoutLocals, arguments...
27
28Doxx::loadLunrIndex = ->
29 LunrSearch.loadIndex(this.config)
30
31Doxx::lunrSearch = LunrSearch.search
32
33Doxx.Handlebars = HbHelper.Handlebars
34Doxx.swig = SwigHelper.swig
35
36module.exports = Doxx