2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
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
74
75
76
77
78
79
80
81
82
83
84
var _ = require('lodash');
module.exports = function componentsDataProcessor() {
    return {
        $runBefore: ['rendering-docs'],
        $runAfter: ['paths-computed'],
        $process: function (docs) {
 
            var apiParts = [
                {type: 'module', items: []},
                {type: 'service', items: []},
                {type: 'directive', items: []},
                {type: 'object', items: []}
            ];
 
            docs.forEach(function (doc) {
                var part = _.find(apiParts, function (part) {
                    if (part.type === doc.docType)
                        return true;
                });
 
                if(part) {
                    part.items.push({
                        name:doc.name,
                        url:doc.outputPath
                    });
                }
            });
 
            docs.filter(function(doc){
                return doc.methods != null;
            }).forEach(function(doc){
                doc.methods = _.sortBy(doc.methods, "name");
            });
 
            var navigation = [
                {
                    title: 'API Docucmentation',
                    name: 'api',
                    url: '/docs/api',
                    items: apiParts
                },
                // note: runnable examples are not yet implemented (instead we link to external demo site)
                {
                    title: 'Examples',
                    name: 'examples',
                    url: '/docs/examples',
                    items: []
                }
            ];
 
            docs.push({
                template: 'content.template.html',
                outputPath: 'partials/content.html',
                path: 'partials/content.html'
            });
 
            docs.push({
                template: 'api-index.template.html',
                outputPath: 'partials/api-index.html',
                path: 'partials/api-index.html'
            });
 
            docs.push({
                template: 'get-started.template.html',
                outputPath: 'partials/get-started.html',
                path: 'partials/get-started.html'
            });
 
            docs.push({
                template: 'nav.template.html',
                outputPath: 'partials/nav.html',
                path: 'partials/nav.html'
            });
 
            docs.push({
                name: 'NAVSERVICE',
                template: 'constants.template.js',
                outputPath: 'app/js/nav-service.js',
                path: 'app/js/nav-service.js',
                items: navigation
            });
        }
    }
};