liudong
2023-05-29 340f156319b863525e50e900c58e59b86ecb3d5e
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?js
    var self = this;
    var isGlobalPage;
 
    docs.forEach(function(doc, i) {
?>
 
<?js
    // we only need to check this once
    if (typeof isGlobalPage === 'undefined') {
        isGlobalPage = (doc.kind === 'globalobj');
    }
?>
<?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
    <?js= self.partial('mainpage.tmpl', doc) ?>
<?js } else if (doc.kind === 'source') { ?>
    <?js= self.partial('source.tmpl', doc) ?>
<?js } else { ?>
 
<section>
 
<header>
        <h2><?js if (doc.ancestors && doc.ancestors.length) { ?>
            <span class="ancestors"><?js= doc.ancestors.join('') ?></span><?js } ?><?js= (doc.name||"").replace(/_/g,".") ?>
        <?js if (doc.variation) { ?>
            <sup class="variation"><?js= doc.variation ?></sup>
        <?js } ?></h2>
        <?js if (doc.classdesc) { ?>
            <div class="class-description"><?js= doc.classdesc ?></div>
        <?js } ?>
</header>
 
<article>
    <div class="container-overview"  style="padding-bottom: 40px; border-bottom: 1px solid #ccc;">
    <?js if (doc.kind === 'module' && doc.modules) { ?>
        <?js if (doc.description) { ?>
            <div class="description"><?js= doc.description ?></div>
        <?js } ?>
 
        <?js doc.modules.forEach(function(module) { ?>
            <?js= self.partial('method.tmpl', module) ?>
        <?js }) ?>
    <?js } else if (doc.kind === 'class') { ?>
        <?js= self.partial('method.tmpl', doc) ?>
    <?js } else { ?>
        <?js if (doc.description) { ?>
            <div class="description"><?js= doc.description ?></div>
        <?js } ?>
 
        <?js= self.partial('details.tmpl', doc) ?>
 
        <?js if (doc.examples && doc.examples.length) { ?>
            <h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>
            <?js= self.partial('examples.tmpl', doc.examples) ?>
        <?js } ?>
    <?js } ?>
    </div>
 
 
<div class="widget" style="padding-bottom: 40px; border-bottom: 1px solid #eee;">
    <div class="col-6-12">
        <?js
            var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
            if (methods && methods.length && methods.forEach) {
        ?>
        <h4>Functions</h4>
        <table>
            <tbody>
                    <?js methods.forEach(function(m) { ?>
                        <tr><td><?js var sig = m.name+' <span class="type-signature">( ';
                        if (m.params) {
                            sig += m.params.filter(function(a) { return !/\./.test(a.name) }).map(function(a) { return a.name }).join(", ")
                        }
                        sig += " )</span>";?><?js=
                        self.linkto(m.longname, sig)
                        ?></td></tr>
                    <?js }); ?>
            </tbody>
         </table>
         <?js } ?>
     </div>
     <div class="col-6-12">
                <?js
                    var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
 
                    // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
                    if (isGlobalPage && members && members.length && members.forEach) {
                        members = members.filter(function(m) {
                            return m.longname && m.longname.indexOf('module:') !== 0;
                        });
                    }
                    if (members && members.length && members.forEach) {
                        members.sort(function(A,B) {
                            if ((A.see||A.mixes) && !(B.see||B.mixes)) {
                                return 1;
                            } else if (!(A.see||A.mixes) && (B.see||B.mixes)) {
                                return -1;
                            }
                            return A.name.localeCompare(B.name);
                        })
                    ?>
                <h4>Members</h4>
                <table>
                    <tbody>
                    <?js members.forEach(function(p) { ?>
                        <tr><td><?js= self.linkto(p.longname, p.name) ?> <?js= p.signature?p.signature:"" ?><?js
                            if (p.see) {?><span class="type-signature"> : { <?js= self.linkto(p.see[0],'...') ?> }</span><?js
                    }?><script>console.log(<?js= JSON.stringify(p) ?>)</script></td></tr>
                    <?js }); ?>
            </tbody>
         </table>
         <?js } ?>
    </div>
    <br style="clear:both" />
</div>
 
    <?js
        var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
 
        // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
        if (isGlobalPage && members && members.length && members.forEach) {
            members = members.filter(function(m) {
                return m.longname && m.longname.indexOf('module:') !== 0;
            });
        }
        if (members && members.length && members.forEach) {
    ?>
        <?js members.forEach(function(p) { ?>
            <?js= self.partial('members.tmpl', p) ?>
        <?js }); ?>
    <?js } ?>
 
    <?js
        var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
        if (methods && methods.length && methods.forEach) {
    ?>
        <?js methods.forEach(function(m) { ?>
            <?js= self.partial('method.tmpl', m) ?>
        <?js }); ?>
    <?js } ?>
 
    <?js
        var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
        if (typedefs && typedefs.length && typedefs.forEach) {
    ?>
        <h3 class="subsection-title">Type Definitions</h3>
 
        <?js typedefs.forEach(function(e) {
                if (e.signature) {
            ?>
                <?js= self.partial('method.tmpl', e) ?>
            <?js
                }
                else {
            ?>
                <?js= self.partial('members.tmpl', e) ?>
            <?js
                }
            }); ?>
    <?js } ?>
 
    <?js
        var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
        if (events && events.length && events.forEach) {
    ?>
        <h3 class="subsection-title">Events</h3>
 
        <?js events.forEach(function(e) { ?>
            <?js= self.partial('method.tmpl', e) ?>
        <?js }); ?>
    <?js } ?>
</article>
 
</section>
<?js } ?>
 
<?js }); ?>