all files / packages/website/processors/ website.js

66.67% Statements 8/12
0% Branches 0/2
75% Functions 3/4
66.67% Lines 8/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73                                                                                                                                 
'use strict';
 
/**
 * Generates web app by given templates
 *
 * @dgService generateWebsiteProcessor
 */
module.exports = function generateWebsiteProcessor (log) {
 
  var debug = log.debug;
 
  var templates = [
      'index.html',
      'views/content.html',
      'views/footer.html',
      'views/main.html',
      'views/navbar.html',
      'views/sidebar.html',
      'views/searchbox.html',
      'scripts/a.directive.js',
      'scripts/docs.controller.js',
      'scripts/index.js',
      'scripts/main.controller.js',
      'scripts/navbar.controller.js',
      'scripts/search.controller.js',
      'scripts/pre.directive.js',
      'scripts/bloomfilter.js',
      'styles/docs.css',
      'styles/github.css',
      'styles/runnableExample.css',
      'bower.json',
      '.bowerrc'
  ];
  var locals = {};
 
  /**
   * An array of objects
   * @type {Array}
   *
   * {
   *    template: 'views/main.html',
   *    file: 'main.html'
   * }
   *
   * Be sure to add the template folder that your new main.html is in so it can find it.
   */
  var templateOverrides = [];
 
  return {
    locals: function(n, v) {
      if (void(v) === v) {
        delete locals[n];
      } else {
        locals[n] = v;
      }
      return this;
    },
    templates: templates,
    $runBefore: ['rendering-docs'],
    $process: function generateWebsiteProcessor (docs) {
      this.templates.forEach(function(t) {
        docs.push({
          docType: 'website',
          area: 'website',
          id: t,
          name: t.replace(/(^|\/)(\.)/g, '$1dot$2'),
          locals: locals
        });
      });
    }
  };
};