|
6 | 6 | < script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity= "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin= "anonymous"></ script> |
7 | 7 | < script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity= "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin= "anonymous"></ script> |
8 | 8 |
|
| 9 | +<%def name="clip_button(clip_text)"> |
| 10 | + <button class="btn" onclick="navigator.clipboard.writeText('${clip_text}');"> |
| 11 | + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16"> |
| 12 | + <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/> |
| 13 | + <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/> |
| 14 | + </svg> |
| 15 | + </button> |
| 16 | +</%def> |
| 17 | + |
9 | 18 | <%def name="render_pointer(pointer_name)"> |
10 | 19 | ${make_rules(rs = ijson.rules_from_pointer(pointer_name))} |
11 | 20 | </%def> |
|
15 | 24 | attributes['count'] = attributes['count'] + 1 |
16 | 25 | local_count = attributes['count'] |
17 | 26 | %> |
| 27 | + <% |
| 28 | + if len(rs) > 0: |
| 29 | + rs[0]['pointer_last'] = rs[0]['pointer'].rsplit('/', 1)[-1] |
| 30 | + if rs[0]['pointer_last'] == '*': |
| 31 | + tmp = rs[0]['pointer'].replace('/*','') |
| 32 | + rs[0]['pointer_last'] = tmp.rsplit('/', 1)[-1] |
| 33 | + %> |
| 34 | +
|
18 | 35 | % if len(rs) == 1: ## single rules for a pointer use a cell |
19 | 36 | ${make_rule(r=rs[0])} |
20 | 37 | % endif |
|
23 | 40 | <div class="card"> |
24 | 41 | <div class="card-header" id="heading${local_count}"> |
25 | 42 | <h5 class="mb-0"> |
| 43 | + ${clip_button(clip_text=rs[0]['pointer_last'])} |
26 | 44 | <button class="btn btn-link" data-toggle="collapse" data-target="#collapse${local_count}" aria-expanded="true" aria-controls="collapse${local_count}"> |
27 | 45 | <h4>${rs[0]['pointer']}</h4> |
28 | 46 | </button> |
|
45 | 63 | local_count = attributes['count'] |
46 | 64 | if not 'doc' in r: |
47 | 65 | r['doc'] = 'FIXME: Missing documentation in the specification' |
48 | | - r['pointer_short'] = '/' + r['pointer'].rsplit('/', 1)[-1] or s |
49 | | - if r['pointer_short'] == '/*': |
| 66 | + r['pointer_last'] = r['pointer'].rsplit('/', 1)[-1] |
| 67 | + if r['pointer_last'] == '*': |
50 | 68 | tmp = r['pointer'].replace('/*','') |
51 | | - r['pointer_short'] = ('/' + tmp.rsplit('/', 1)[-1] or s) + '/*' |
| 69 | + r['pointer_last'] = tmp.rsplit('/', 1)[-1] |
52 | 70 | r['pointer_short'] = r['pointer'] |
53 | 71 | %> |
54 | 72 | % if r['type'] == "object": ## Object |
55 | 73 | <div id="accordion${local_count}"> |
56 | 74 | <div class="card"> |
57 | 75 | <div class="card-header" id="heading${local_count}"> |
58 | 76 | <h5 class="mb-0"> |
| 77 | + ${clip_button(clip_text=r['pointer_last'])} |
59 | 78 | <button class="btn btn-link" data-toggle="collapse" data-target="#collapse${local_count}" aria-expanded="true" aria-controls="collapse${local_count}"> |
60 | 79 | <h4>${r['pointer_short']}</h4> |
61 | 80 | </button> |
62 | | - Object |
| 81 | + <code>Object</code> |
63 | 82 | ${"(Type: " + r["type_name"] + ")" if "type_name" in r else ""} |
64 | 83 | % if "default" in r: |
65 | | - [${r["default"]}] |
| 84 | + = ${r["default"]} |
66 | 85 | % endif |
67 | 86 | </h5> |
68 | 87 | ${r['doc']} |
69 | 88 | </div> |
70 | 89 | <div id="collapse${local_count}" class="collapse hide" aria-labelledby="heading${local_count}" data-parent="#accordion${local_count}"> |
71 | 90 | |
72 | 91 | % if 'required' in r: |
| 92 | + |
73 | 93 | <div class="container"> |
| 94 | + |
74 | 95 | <div class="row"> |
| 96 | + <h5 class=".text-success">Required</h5> |
75 | 97 | <div class="col-1"> |
76 | | - <p class=".text-success">Required</p> |
77 | 98 | </div> |
78 | 99 | <div class="col-11"> |
79 | 100 | % for fname in r['required']: |
|
85 | 106 | % endif |
86 | 107 | % if 'optional' in r: |
87 | 108 | <div class="container"> |
| 109 | + |
88 | 110 | <div class="row"> |
| 111 | + <h5>Optional</h5> |
89 | 112 | <div class="col-1"> |
90 | | - <p class=".text-success">Optional</p> |
| 113 | + |
91 | 114 | </div> |
92 | 115 | <div class="col-11"> |
93 | 116 | % for fname in r['optional']: |
|
115 | 138 | <p class="text-primary">${r['pointer_short']}</p> |
116 | 139 | </div> |
117 | 140 | <div class="col-sm"> |
118 | | - Float |
| 141 | + <code>Float</code> |
119 | 142 | % if "min" in r or "max" in r: |
120 | 143 | (${r["min"] if "min" in r else "-inf"}, ${r["max"] if "max" in r else "inf"}) |
121 | 144 | % endif |
122 | 145 | % if "default" in r: |
123 | | - [${r["default"]}] |
| 146 | + = ${r["default"]} |
124 | 147 | % endif |
125 | 148 | </div> |
| 149 | + <div class="auto"> |
| 150 | + ${clip_button(clip_text=r['pointer_last'])} |
| 151 | + </div> |
126 | 152 | </div> |
127 | 153 | </h5> |
128 | 154 | </div> |
|
142 | 168 | <p class="text-primary">${r['pointer_short']}</p> |
143 | 169 | </div> |
144 | 170 | <div class="col-sm"> |
145 | | - Integer |
| 171 | + <code>Integer</code> |
146 | 172 | % if "min" in r or "max" in r: |
147 | 173 | (${r["min"] if "min" in r else "-inf"}, ${r["max"] if "max" in r else "inf"}) |
148 | 174 | % endif |
149 | 175 | % if "default" in r: |
150 | | - [${r["default"]}] |
| 176 | + = ${r["default"]} |
151 | 177 | % endif |
152 | 178 | </div> |
| 179 | + <div class="auto"> |
| 180 | + ${clip_button(clip_text=r['pointer_last'])} |
| 181 | + </div> |
153 | 182 | </div> |
154 | 183 | </h5> |
155 | 184 | </div> |
|
169 | 198 | <p class="text-primary">${r['pointer_short']}</p> |
170 | 199 | </div> |
171 | 200 | <div class="col-sm"> |
172 | | - File |
| 201 | + <code>File</code> |
173 | 202 | % if "extensions" in r: |
174 | 203 | (${r["extensions"]}) |
175 | 204 | % endif |
176 | 205 | % if "default" in r: |
177 | | - [${r["default"]}] |
| 206 | + = "${r["default"]}" |
178 | 207 | % endif |
179 | 208 | </div> |
| 209 | + <div class="auto"> |
| 210 | + ${clip_button(clip_text=r['pointer_last'])} |
| 211 | + </div> |
| 212 | +
|
180 | 213 | </div> |
181 | 214 | </h5> |
182 | 215 | </div> |
|
196 | 229 | <p class="text-primary">${r['pointer_short']}</p> |
197 | 230 | </div> |
198 | 231 | <div class="col-sm"> |
199 | | - Folder |
| 232 | + <code>Folder</code> |
200 | 233 | % if "default" in r: |
201 | | - [${r["default"]}] |
| 234 | + = "${r["default"]}" |
202 | 235 | % endif |
203 | 236 | </div> |
| 237 | + <div class="auto"> |
| 238 | + ${clip_button(clip_text=r['pointer_last'])} |
| 239 | + </div> |
204 | 240 | </div> |
205 | 241 | </h5> |
206 | 242 | </div> |
|
220 | 256 | <p class="text-primary">${r['pointer_short']}</p> |
221 | 257 | </div> |
222 | 258 | <div class="col-sm"> |
223 | | - Boolean |
| 259 | + <code>Boolean</code> |
224 | 260 | % if "default" in r: |
225 | | - [${r["default"]}] |
| 261 | + = ${r["default"]} |
226 | 262 | % endif |
227 | 263 | </div> |
| 264 | + <div class="auto"> |
| 265 | + ${clip_button(clip_text=r['pointer_last'])} |
| 266 | + </div> |
228 | 267 | </div> |
229 | 268 | </h5> |
230 | 269 | </div> |
|
244 | 283 | <p class="text-primary">${r['pointer_short']}</p> |
245 | 284 | </div> |
246 | 285 | <div class="col-sm"> |
247 | | - String |
| 286 | + <code>String</code> |
248 | 287 | % if "options" in r: |
249 | 288 | (${r["options"]}) |
250 | 289 | % endif |
251 | 290 | % if "default" in r: |
252 | | - [${r["default"]}] |
| 291 | + = "${r["default"]}" |
253 | 292 | % endif |
254 | 293 | </div> |
| 294 | + <div class="auto"> |
| 295 | + ${clip_button(clip_text=r['pointer_last'])} |
| 296 | + </div> |
255 | 297 | </div> |
256 | 298 | </h5> |
257 | 299 | </div> |
|
0 commit comments