1 |
|
2 | (function() {
|
3 | var Doxx, HbHelper, LunrSearch, Nav, SwigHelper, _, getConfig,
|
4 | slice = [].slice;
|
5 |
|
6 | _ = require('lodash');
|
7 |
|
8 | getConfig = require('./config');
|
9 |
|
10 | SwigHelper = require('./swig-helper');
|
11 |
|
12 | HbHelper = require('@resin.io/doxx-handlebars-helper');
|
13 |
|
14 | LunrSearch = require('./lunr-search');
|
15 |
|
16 | Nav = require('./nav');
|
17 |
|
18 | Doxx = function(config) {
|
19 | if (!(this instanceof Doxx)) {
|
20 | return (function(func, args, ctor) {
|
21 | ctor.prototype = func.prototype;
|
22 | var child = new ctor, result = func.apply(child, args);
|
23 | return Object(result) === result ? result : child;
|
24 | })(Doxx, arguments, function(){});
|
25 | }
|
26 | this.config = getConfig(config);
|
27 | };
|
28 |
|
29 | Doxx.prototype.build = require('./build');
|
30 |
|
31 | Doxx.prototype.navParse = function() {
|
32 | return Nav.parse(this.config);
|
33 | };
|
34 |
|
35 | Doxx.navPP = Nav.pp;
|
36 |
|
37 | Doxx.prototype.configureExpress = function(app) {
|
38 | return SwigHelper.configureExpress(app, this.config);
|
39 | };
|
40 |
|
41 | Doxx.prototype.getLocals = function() {
|
42 | var layoutLocals;
|
43 | layoutLocals = this.config.layoutLocals;
|
44 | return _.assign.apply(_, [{}, layoutLocals].concat(slice.call(arguments)));
|
45 | };
|
46 |
|
47 | Doxx.prototype.loadLunrIndex = function() {
|
48 | return LunrSearch.loadIndex(this.config);
|
49 | };
|
50 |
|
51 | Doxx.prototype.lunrSearch = LunrSearch.search;
|
52 |
|
53 | Doxx.Handlebars = HbHelper.Handlebars;
|
54 |
|
55 | Doxx.swig = SwigHelper.swig;
|
56 |
|
57 | module.exports = Doxx;
|
58 |
|
59 | }).call(this);
|