Skip to content

Commit 05b6a98

Browse files
committed
Clean templates
1 parent 3ecfad7 commit 05b6a98

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

docs/api/agents.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ curl -X GET http://coder-server:8080/api/v2/workspaceagents/me/coordinate \
192192

193193
`GET /workspaceagents/me/coordinate`
194194

195+
It accepts a WebSocket connection to an agent that listens to
196+
incoming connections and publishes node updates.
197+
195198
### Responses
196199

197200
| Status | Meaning | Description | Schema |

scripts/apidocgen/markdown-template/debug.def

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/apidocgen/markdown-template/main.dot

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@
5353

5454
const countUppercase = words[0].length - words[0].replace(/[A-Z]/g, '').length;
5555
if (countUppercase > 1) {
56-
let displayName = p.displayName.replace(/» \*\*additionalProperties\*\*/g, "It");
56+
let displayName = p.displayName.replace(/» \*\*additionalProperties\*\*/g, "It").replace("» ", "");
5757
displayName = displayName.charAt(0).toUpperCase() + displayName.replace(/_/g, " ").toLowerCase().slice(1);
5858
description = displayName + " " + words.slice(1).join(' ');
5959
}
6060
return correctLetterCase(description);
6161
}
62+
63+
/* Export functions that are used by other template partials. */
64+
data.functions = {};
65+
data.functions.renderDescription = renderDescription;
6266
}}
6367

6468
{{? data.api.components && data.api.components.securitySchemes }}{{#def.security}}{{?}}

scripts/apidocgen/markdown-template/responses.def

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,41 +44,6 @@
4444

4545
return p.safeType;
4646
}
47-
48-
function correctLetterCase(description) {
49-
const dictionary = ["id", "url"];
50-
51-
const words = description.split(' ');
52-
var corrected = [];
53-
words.forEach(word => {
54-
if (dictionary.includes(word.toLowerCase())) {
55-
corrected.push(word.toUpperCase());
56-
return;
57-
}
58-
corrected.push(word);
59-
});
60-
return corrected.join(" ");
61-
}
62-
63-
function renderDescription(p) {
64-
if (!p.description) {
65-
return "";
66-
}
67-
68-
let description = p.description.replace(/<br><br>/g, "\n").replace(/<br>/g, " ");
69-
const words = description.split(' ');
70-
if (words.length == 0) {
71-
return "";
72-
}
73-
74-
const countUppercase = words[0].length - words[0].replace(/[A-Z]/g, '').length;
75-
if (countUppercase > 1) {
76-
let displayName = p.displayName.replace(/» \*\*additionalProperties\*\*/g, "It").replace("» ", "");
77-
displayName = displayName.charAt(0).toUpperCase() + displayName.replace(/_/g, " ").toLowerCase().slice(1);
78-
description = displayName + " " + words.slice(1).join(' ');
79-
}
80-
return correctLetterCase(description);
81-
}
8247
}}
8348
{{ data.responses = data.utils.getResponses(data); }}
8449
{{ data.responseSchemas = false; }}
@@ -132,7 +97,7 @@ Status Code **{{=response.status}}**
13297
{{?}}
13398
|Name|Type|Required|Restrictions|Description|
13499
|---|---|---|---|---|
135-
{{~block.rows :p}}|`{{=renderDisplayName(p)}}`|{{=renderResponsePropertyType(p)}}|{{=p.required}}|{{=p.restrictions||''}}|{{=renderDescription(p)}}|
100+
{{~block.rows :p}}|`{{=renderDisplayName(p)}}`|{{=renderResponsePropertyType(p)}}|{{=p.required}}|{{=p.restrictions||''}}|{{=data.functions.renderDescription(p)}}|
136101
{{~}}
137102
{{~}}
138103
{{?}}

0 commit comments

Comments
 (0)