componentsData.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. var _ = require('lodash');
  2. module.exports = function componentsDataProcessor() {
  3. return {
  4. $runBefore: ['rendering-docs'],
  5. $runAfter: ['paths-computed'],
  6. $process: function (docs) {
  7. var apiParts = [
  8. {type: 'module', items: []},
  9. {type: 'service', items: []},
  10. {type: 'directive', items: []},
  11. {type: 'object', items: []}
  12. ];
  13. docs.forEach(function (doc) {
  14. var part = _.find(apiParts, function (part) {
  15. if (part.type === doc.docType)
  16. return true;
  17. });
  18. if(part) {
  19. part.items.push({
  20. name:doc.name,
  21. url:doc.outputPath
  22. });
  23. }
  24. });
  25. docs.filter(function(doc){
  26. return doc.methods != null;
  27. }).forEach(function(doc){
  28. doc.methods = _.sortBy(doc.methods, "name");
  29. });
  30. var navigation = [
  31. {
  32. title: 'API Docucmentation',
  33. name: 'api',
  34. url: '/docs/api',
  35. items: apiParts
  36. },
  37. // note: runnable examples are not yet implemented (instead we link to external demo site)
  38. {
  39. title: 'Examples',
  40. name: 'examples',
  41. url: '/docs/examples',
  42. items: []
  43. }
  44. ];
  45. docs.push({
  46. template: 'content.template.html',
  47. outputPath: 'partials/content.html',
  48. path: 'partials/content.html'
  49. });
  50. docs.push({
  51. template: 'api-index.template.html',
  52. outputPath: 'partials/api-index.html',
  53. path: 'partials/api-index.html'
  54. });
  55. docs.push({
  56. template: 'get-started.template.html',
  57. outputPath: 'partials/get-started.html',
  58. path: 'partials/get-started.html'
  59. });
  60. docs.push({
  61. template: 'nav.template.html',
  62. outputPath: 'partials/nav.html',
  63. path: 'partials/nav.html'
  64. });
  65. docs.push({
  66. name: 'NAVSERVICE',
  67. template: 'constants.template.js',
  68. outputPath: 'app/js/nav-service.js',
  69. path: 'app/js/nav-service.js',
  70. items: navigation
  71. });
  72. }
  73. }
  74. };