Skip to content

Commit a5fde63

Browse files
committed
Improve d.ts comments generation
- Remove " - " after @param paramname, and @return because it is useless. - Improve alignement of multiline param comments.
1 parent af41e99 commit a5fde63

3 files changed

Lines changed: 4320 additions & 4299 deletions

File tree

tasks/buildtsdoc.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,15 @@ var TypeScriptDocGenerator = (function () {
121121
if ((p.default != null) && (p.default !== "")) {
122122
def = " - Default: " + p.default;
123123
}
124-
comments.push("@param " + p.name + " - " + p.description + def);
124+
var paramComments = p.description.split("\n");
125+
for (var k = 0; k < paramComments.length; k++) {
126+
if (k === 0) {
127+
comments.push("@param " + p.name + " " + paramComments[k].trim() + ((k === paramComments.length - 1) ? def : ""));
128+
}
129+
else {
130+
comments.push(this.repeatSpaces(("@param " + p.name + " ").length) + paramComments[k].trim() + ((k === paramComments.length - 1) ? def : ""));
131+
}
132+
}
125133
}
126134
return comments;
127135
}
@@ -149,10 +157,23 @@ var TypeScriptDocGenerator = (function () {
149157
if ((p.default != null) && (p.default !== "")) {
150158
def = " - Default: " + p.default;
151159
}
152-
comments.push("@param " + p.name + " - " + p.description + def);
160+
161+
var paramComments = p.description.split("\n");
162+
for (var k = 0; k < paramComments.length; k++)
163+
{
164+
if (k === 0)
165+
{
166+
comments.push("@param " + p.name + " " + paramComments[k].trim() + ((k === paramComments.length - 1) ? def : ""));
167+
}
168+
else
169+
{
170+
comments.push(this.repeatSpaces(("@param " + p.name + " ").length) + paramComments[k].trim() + ((k === paramComments.length - 1) ? def : ""));
171+
}
172+
}
173+
153174
}
154175
if (f.returns != null) {
155-
comments.push("@return - " + f.returns.description);
176+
comments.push("@return " + f.returns.description);
156177
}
157178
return comments;
158179
}

0 commit comments

Comments
 (0)