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
var Package = require('dgeni').Package;
var path = require('canonical-path');
var _ = require('lodash');
var projectPath = path.resolve(__dirname, '../');
var packagePath = __dirname;
 
module.exports = new Package('ng-table', [
    require('dgeni-packages/ngdoc'),
    require('dgeni-packages/nunjucks')
])
 
    .processor(require('./processors/indexPage'))
    .processor(require('./processors/componentsData'))
 
    .config(function (log, templateEngine, templateFinder) {
        templateEngine.config.tags = {
            variableStart: '{$',
            variableEnd: '$}'
        };
 
        templateFinder.templateFolders = [
            path.resolve(packagePath, 'template'),
            path.resolve(packagePath, 'template/ngdoc')
        ]
    })
 
    .config(function(readFilesProcessor, writeFilesProcessor){
        readFilesProcessor.basePath = projectPath;
        readFilesProcessor.sourceFiles = [
            { include:'dist/ng-table.js', basePath:'dist' }
        ];
        writeFilesProcessor.outputFolder = 'dist/docs'
    })
    .config(function(computeIdsProcessor, computePathsProcessor){
        computeIdsProcessor.idTemplates.push({
            docTypes: ['parameters'],
            idTemplate: 'parameters-${fileInfo.relativePath.replace("/","-")}',
            getAliases: function(doc) { return [doc.id]; }
        });
 
        computePathsProcessor.pathTemplates.push({
            docTypes: ['parameters'],
            getPath: function(doc) {
                var docPath = path.dirname(doc.fileInfo.relativePath);
                if ( doc.fileInfo.baseName !== 'index' ) {
                    docPath = path.join(docPath, doc.fileInfo.baseName);
                }
                return docPath;
            },
            getOutputPath: function(doc) {
                return path.join(
                        'partials',
                        path.dirname(doc.fileInfo.relativePath),
                        doc.fileInfo.baseName) + '.html';
            }
        });
    })
    .config(function(generateComponentGroupsProcessor){
        generateComponentGroupsProcessor.$enabled = false;
    });