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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
{{!--~ shape_traits
-- display Traits table for a shape
~--}}{{#*inline "shape_traits" }}
{{#if (traits this)}}
<div class="ml-12">
<p class="font-medium mt-4">Traits
<p>
<table>
{{~#each (traits this) }}
<tr>
{{#if @key }}
<td>{{ typ @key ../ns }}</td>
<td>{{ this }}</td>
{{else}}
<td>{{ this }}</td>
<td>{{ this }}</td>
{{/if}}
</tr>
{{~/each}}
</table>
</div>
{{/if ~}}
{{/inline }}
{{!--~ toc
-- display row in TOC grouped by type
~--}}{{#*inline "toc" }}
{{~#with (filter_shapes kind (filter_namespace namespace model.shapes)) as |shapes| }}
{{~#if shapes }}
<div class="table-row">
<div class="table-cell align-top pr-6 w-28">
{{../title}}
</div>
<div class="table-cell align-top">
<ul>
{{#each shapes ~}}
<li class="font-light"><a href="#{{to_snake_case _key}}">{{ typ _key ../../namespace }}</a></li>
{{~/each }}
</ul>
</div>
</div>
{{~/if }}
{{~/with }}
{{/inline }}
{{!--~ type_head
-- begin output for shape's definition: heading and doc
~--}}{{#*inline "type_head" }}
<h2 id="{{ to_snake_case (shape_name _key) }}" class="mt-8 border-t-2 border-gray-300">
{{ typ _key ../namespace }}<span class="text-lg pl-4">({{this.type}})</span>
</h2>
{{~#if (doc this)}}<p class="font-light ml-6">{{ doc this }}</p>{{/if}}
{{/inline }}
{{!--~ display_trait
-- output trait object html
~--}}{{#*inline "display_trait" }}
{{~> type_head }}
{{!-- fixme - this only handles traits that are structures --}}
<div class="ml-12">
<table>
<thead>
<tr>
<th class="w-48"></th>
<th class="w-48"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
{{~#each members }}
<tr>
<td>{{member_name @key}}:</td>
<td>{{ typ target ../../namespace }}</td>
<td> </td>
<!--
<td><span class="font-light">{{../this}} </span> </td>
-->
</tr>
{{~/each }}
</tbody>
</table>
</div>
{{ >shape_traits ns=../namespace }}
{{/inline }}
{{!--~ display_simple
-- output simple type definition
~--}}{{#*inline "display_simple" }}
{{~> type_head }}
{{ >shape_traits ns=../namespace }}
{{/inline }}
{{!--~ main
-- main page for namespace documentation
~--}}{{#*inline "main" }}
{{!-- <p class="text-4xl font-extrabold text-gray-900">{{title}}</p> --}}
<div id="content">
<div class="p-4 overflow-y-auto">
<h1 id="{{to_snake_case namespace }}" class="text-2xl font-serif">Namespace {{ namespace }}</h1>
<div class="table m-4 ml-12">
{{~> toc title="Services" kind="service"}}
{{~> toc title="Operations" kind="operation"}}
{{~> toc title="Structures" kind="structure"}}
{{~> toc title="Traits" kind="trait"}}
{{~> toc title="Simple" kind="simple"}}
{{~> toc title="Lists" kind="list"}}
{{~> toc title="Maps" kind="map"}}
</div>
{{#each (filter_namespace namespace model.shapes) ~}}
{{#if (is_trait this) ~}}
{{~> display_trait }}
{{else ~}}
{{#if (is_simple this.type) ~}}
{{~> display_simple }}
{{/if ~}}
{{#if (eq this.type "list") ~}}
{{~> type_head}}
<div class="ml-12">
<table>
<thead>
<tr>
<th class="w-48"></th>
<th class="w-48"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
<tr>
<td>member:</td>
<td>{{ typ member.target ../namespace }}</td>
<td><span class="font-light"> </span></td>
</tr>
</tbody>
</table>
</div>
{{ >shape_traits ns=../namespace }}
{{~/if }}
{{#if (eq this.type "set") ~}}
{{~> type_head}}
<div class="ml-12">
<table>
<thead>
<tr>
<th class="w-48"></th>
<th class="w-48"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
<tr>
<td>member:</td>
<td>{{ typ member.target ../namespace }}</td>
<td><span class="font-light">{{ doc member }}</span></td>
</tr>
</tbody>
</table>
</div>
{{ >shape_traits ns=../namespace }}
{{~/if }}
{{#if (eq type "map") ~}}
{{~> type_head}}
<div class="ml-12">
<table>
<thead>
<tr>
<th class="w-48"></th>
<th class="w-48"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
<tr>
<td>key:</td>
<td>{{ typ this.key.target ../namespace }}</td>
<td><span class="font-light">{{ doc this.key }}</span></td>
</tr>
<tr>
<td>value:</td>
<td>{{ typ value.target ../namespace}}</td>
<td><span class="font-light">{{ doc value }}</span></td>
</tr>
</tbody>
</table>
</div>
{{ >shape_traits ns=../namespace }}
{{~/if }}
{{#if (eq type "operation") ~}}
{{~> type_head}}
<div class="ml-12">
<table>
<thead>
<tr>
<th class="w-48"></th>
<th class="w-48"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
{{~#if input }}
<tr>
<td>input:</td>
<td>{{ typ input.target ../namespace }}</td>
<td><span class="font-light">{{ doc input }}</span></td>
</tr>
{{~/if}}
{{~#if output }}
<tr>
<td>output:</td>
<td>{{ typ output.target ../namespace }}</td>
<td><span class="font-light">{{ doc output }}</span></td>
</tr>
{{~/if}}
{{~#if errors }}
<tr>
<td>errors:</td>
<td>
<ul>{{#each errors}}
<li>{{ typ target }}</li>{{/each}}
</ul>
</td>
<td><span class="font-light">{{ doc errors }}</span></td>
</tr>
{{~/if}}
</tbody>
</table>
</div>
{{ >shape_traits ns=../namespace }}
{{~/if }}
{{~#if (eq type "structure") }}
{{~> type_head }}
<div class="ml-12">
<table>
<thead>
<tr>
<th class="w-48"></th>
<th class="w-48"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
{{~#each members }}
<tr>
<td>{{member_name @key}}:</td>
<td>{{ typ target ../../namespace }}</td>
<td><span class="font-light">{{ doc
this }}</span></td>
</tr>
{{~/each }}
</tbody>
</table>
</div>
{{~ >shape_traits ns=../namespace }}
{{~/if }}
{{#if (eq type "service") }}
{{~> type_head}}
<div class="ml-12">
{{~#if operations }}
<div class="table my-4">
<div class="table-row">
<div class="table-cell align-top pr-6 w-48">
<span class="font-medium my-4">
Operations
</span>
</div>
<div class="table-cell align-top">
<ul>
{{~#each operations}}
<li class="font-light">
<a href="#{{to_snake_case target}}">
{{ typ target ../../namespace }}
</a>
</li>
{{~/each }}
</ul>
</div>
</div>
</div>
{{~/if}}
</div>
{{~ >shape_traits ns=../namespace }}
{{~/if }}
{{~/if }}
{{~/each }}
</div>
</div>
{{~/inline }}
{{~> page_base ~}}