-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmethod.tmpl
157 lines (129 loc) · 4.38 KB
/
method.tmpl
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
<?js
var data = obj;
var self = this;
// Remove random trailing period from summaries
if (data.summary && data.summary[data.summary.length-1] === '.') {
data.summary = data.summary.slice(0, -1)
}
var removeTrailingHTMLTag = /<\/[A-z0-9]+>$/
var hasMethodSummary = (data.kind !== 'class')
&& data.summary
&& !data.description.includes(data.summary.replace(removeTrailingHTMLTag, ''));
?>
<?js if (data.kind !== 'module' && data.kind !== 'class' ) { ?>
<article class="method">
<?js } ?>
<?js if (data.kind !== 'module') { ?>
<?js
var properties = data.properties;
if (properties && properties.length && properties.forEach) {
?>
<h3 class="subtitle">Properties</h3>
<?js= this.partial('properties.tmpl', data) ?>
<?js } ?>
<?js if (data.kind === 'class' && data.classdesc) { ?>
<h3 class="subtitle">Constructor</h3>
<?js } ?>
<div class="method-type">
<?js= data.attribs ?>
</div>
<h4 class="method-name" id="<?js= id ?>"><?js= (kind === 'class' ? 'new ' : '') +
name + (data.signature || '') ?>
</h4>
<?js } ?>
<?js if (hasMethodSummary) { ?>
<h4 class="method-heading">Summary</h4>
<?js= data.summary ?>
<?js } ?>
<?js if (data.kind !== 'module' && data.description) { ?>
<div class="method-description">
<?js if (hasMethodSummary) { ?><h4 class="method-heading">Description</h4><?js } ?>
<?js= data.description ?>
</div>
<?js } ?>
<?js if (data.augments && data.alias && data.alias.indexOf('module:') === 0) { ?>
<h4 class="method-heading">Extends</h4>
<?js= self.partial('augments.tmpl', data) ?>
<?js } ?>
<?js if (kind === 'event' && data.type && data.type.names) {?>
<h4 class="method-heading">Type</h4>
<ul>
<li>
<?js= self.partial('type.tmpl', data.type.names) ?>
</li>
</ul>
<?js } ?>
<?js if (data['this']) { ?>
<h4 class="method-heading">This</h4>
<ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>
<?js } ?>
<?js if (data.params && params.length) { ?>
<h4 class="method-heading">Parameters</h4>
<?js= this.partial('params.tmpl', params) ?>
<?js } ?>
<?js= this.partial('details.tmpl', data) ?>
<?js if (data.returns ) { ?>
<h4 class="method-heading">Returns</h4>
<ul>
<?js data.returns.forEach(function(r) { ?>
<li class="method-returns">
<?js r.type.names.forEach(function(t) { ?>
<code><?js= self.htmlsafe(t) ?></code>
<?js }); ?>
<?js if (r.description) { ?>
<?js= r.description ?>
<?js }; ?>
</li>
<?js }); ?>
</ul>
<?js } ?>
<?js if (data.examples && examples.length) { ?>
<h4 class="method-heading">Example<?js= examples.length > 1? 's':'' ?></h4>
<?js= this.partial('examples.tmpl', examples) ?>
<?js } ?>
<?js if (data.kind !== 'module' && data.requires && data.requires.length) { ?>
<h4 class="method-heading">Requires</h4>
<ul><?js data.requires.forEach(function(r) { ?>
<li><?js= self.linkto(r) ?></li>
<?js }); ?></ul>
<?js } ?>
<?js if (data.fires && fires.length) { ?>
<h4 class="method-heading">Fires</h4>
<ul><?js fires.forEach(function(f) { ?>
<li><?js= self.linkto(f) ?></li>
<?js }); ?></ul>
<?js } ?>
<?js if (data.listens && listens.length) { ?>
<h4 class="method-heading">Listens to events</h4>
<ul><?js listens.forEach(function(f) { ?>
<li><?js= self.linkto(f) ?></li>
<?js }); ?></ul>
<?js } ?>
<?js if (data.listeners && listeners.length) { ?>
<h4 class="method-heading">Listeners of this event</h4>
<ul><?js listeners.forEach(function(f) { ?>
<li><?js= self.linkto(f) ?></li>
<?js }); ?></ul>
<?js } ?>
<?js if (data.exceptions && exceptions.length) { ?>
<h4 class="method-heading">Throws</h4>
<?js if (exceptions.length > 1) { ?><ul><?js
exceptions.forEach(function(r) { ?>
<li><?js= self.partial('exceptions.tmpl', r) ?></li>
<?js });
?></ul><?js } else {
exceptions.forEach(function(r) { ?>
<?js= self.partial('exceptions.tmpl', r) ?>
<?js });
} } ?>
<?js if (data.meta && self.outputSourceFiles) {?>
<h4 class="method-heading">Source</h4>
<ul>
<li class="method-source">
<?js= self.linkto(meta.shortpath) ?><?js= self.linkto(meta.shortpath, ', line ' + meta.lineno, null, 'source.' + meta.lineno) ?>
</li>
</ul>
<?js } ?>
<?js if (data.kind !== 'module' && data.kind !== 'class' ) { ?>
</article>
<?js } ?>