Skip to content

Commit 397b597

Browse files
add table of contents to html
1 parent d02f3b5 commit 397b597

File tree

5 files changed

+184
-1
lines changed

5 files changed

+184
-1
lines changed

content/en/synthetics/notifications/template_variables.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,21 @@ Template variables allow you to insert dynamic values from your test results and
2121

2222
## Available variables
2323

24-
{{< partial name="synthetics/template-variables.html" >}}
24+
### Test execution variables
25+
26+
{{< partial name="synthetics/template-variables-execution.html" >}}
27+
28+
### Result variables
29+
30+
{{< partial name="synthetics/template-variables-result.html" >}}
31+
32+
### Variables extracted by steps
33+
34+
{{< partial name="synthetics/template-variables-steps.html" >}}
35+
36+
### Step summary
37+
38+
{{< partial name="synthetics/template-variables-summary.html" >}}
2539

2640
## Further Reading
2741

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{/*
2+
Renders Test Execution Variables from data/synthetics/template_variables.yaml
3+
Usage: {{ partial "synthetics/template-variables-execution.html" . }}
4+
*/}}
5+
6+
{{ $data := .Site.Data.synthetics.template_variables }}
7+
8+
{{ with $data.test_execution }}
9+
<p>{{ .description | markdownify }}</p>
10+
11+
<div class="code-tabs">
12+
<ul class="nav nav-tabs d-flex"></ul>
13+
<div class="tab-content">
14+
{{ range $idx, $cat := .categories }}
15+
<div data-lang="{{ $cat.name | lower | anchorize | replace "-" "" }}" class="tab-pane fade" role="tabpanel" title="{{ $cat.name }}">
16+
{{ with $cat.note }}<p><em>{{ . | markdownify }}</em></p>{{ end }}
17+
<dl class="template-variables">
18+
{{ range $cat.variables }}
19+
<dt><code>{{ printf "{{%s}}" .path }}</code></dt>
20+
<dd>{{ .description | markdownify }}</dd>
21+
{{ end }}
22+
</dl>
23+
</div>
24+
{{ end }}
25+
</div>
26+
</div>
27+
{{ end }}
28+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{/*
2+
Renders Result Variables from data/synthetics/template_variables.yaml
3+
Usage: {{ partial "synthetics/template-variables-result.html" . }}
4+
*/}}
5+
6+
{{ $data := .Site.Data.synthetics.template_variables }}
7+
8+
{{ with $data.result_variables }}
9+
<p>{{ .description | markdownify }}</p>
10+
11+
<div class="code-tabs">
12+
<ul class="nav nav-tabs d-flex"></ul>
13+
<div class="tab-content">
14+
{{ range $idx, $cat := .categories }}
15+
<div data-lang="{{ $cat.name | lower | anchorize | replace "-" "" }}" class="tab-pane fade" role="tabpanel" title="{{ $cat.name }}">
16+
{{ with $cat.note }}<p>{{ . | markdownify }}</p>{{ end }}
17+
{{ with $cat.location }}<p>Located at <code>{{ printf "{{%s}}" . }}</code>:</p>{{ end }}
18+
<dl class="template-variables">
19+
{{ range $cat.variables }}
20+
<dt><code>{{ .path }}</code></dt>
21+
<dd>{{ .description | markdownify }}</dd>
22+
{{ end }}
23+
</dl>
24+
</div>
25+
{{ end }}
26+
</div>
27+
</div>
28+
{{ end }}
29+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{/*
2+
Renders Step Extracted Variables from data/synthetics/template_variables.yaml
3+
Usage: {{ partial "synthetics/template-variables-steps.html" . }}
4+
*/}}
5+
6+
{{ $data := .Site.Data.synthetics.template_variables }}
7+
8+
{{ with $data.step_extracted_variables }}
9+
<p>{{ .description | markdownify }}</p>
10+
11+
<div class="code-tabs">
12+
<ul class="nav nav-tabs d-flex"></ul>
13+
<div class="tab-content">
14+
{{ range $idx, $cat := .categories }}
15+
<div data-lang="{{ $cat.name | lower | anchorize | replace "-" "" }}" class="tab-pane fade" role="tabpanel" title="{{ $cat.name }}">
16+
17+
{{ with $cat.note }}<p><em>{{ . | markdownify }}</em></p>{{ end }}
18+
19+
{{/* Handle categories with groups */}}
20+
{{ with $cat.groups }}
21+
{{ range . }}
22+
<h4>{{ .name }}</h4>
23+
{{ with .note }}<p><em>{{ . | markdownify }}</em></p>{{ end }}
24+
<dl class="template-variables">
25+
{{ range .variables }}
26+
<dt><code>{{ .path }}</code></dt>
27+
<dd>{{ .description | markdownify }}</dd>
28+
{{ end }}
29+
</dl>
30+
{{ end }}
31+
{{ end }}
32+
33+
{{/* Handle categories with direct variables (no groups) */}}
34+
{{ with $cat.variables }}
35+
<dl class="template-variables">
36+
{{ range . }}
37+
<dt><code>{{ .path }}</code></dt>
38+
<dd>{{ .description | markdownify }}</dd>
39+
{{ end }}
40+
</dl>
41+
{{ end }}
42+
43+
{{/* Handle categories with subtypes (Network tests, Protocol tests) */}}
44+
{{ with $cat.subtypes }}
45+
{{ range . }}
46+
<details class="collapse-content">
47+
<summary><h4 style="display: inline;">{{ .name }}</h4></summary>
48+
<dl class="template-variables">
49+
{{ range .variables }}
50+
<dt><code>{{ .path }}</code></dt>
51+
<dd>{{ .description | markdownify }}</dd>
52+
{{ end }}
53+
</dl>
54+
</details>
55+
{{ end }}
56+
{{ end }}
57+
58+
</div>
59+
{{ end }}
60+
</div>
61+
</div>
62+
{{ end }}
63+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{{/*
2+
Renders Step Summary from data/synthetics/template_variables.yaml
3+
Usage: {{ partial "synthetics/template-variables-summary.html" . }}
4+
*/}}
5+
6+
{{ $data := .Site.Data.synthetics.template_variables }}
7+
8+
{{ with $data.step_summary }}
9+
<p>{{ .description | markdownify }}</p>
10+
11+
<p>Each step exposes the following properties:
12+
{{ range $idx, $prop := .step_properties }}{{ if $idx }}, {{ end }}<code>{{ $prop }}</code>{{ end }}.
13+
</p>
14+
15+
<p>You can reference steps in three ways:</p>
16+
17+
{{ range .reference_methods }}
18+
<h4>{{ .name }}</h4>
19+
<p>{{ .description | markdownify }}{{ if .example }}: <code>{{ .example }}</code>{{ end }}</p>
20+
21+
{{ with .examples }}
22+
<table>
23+
<thead>
24+
<tr>
25+
<th>Syntax</th>
26+
<th>Description</th>
27+
</tr>
28+
</thead>
29+
<tbody>
30+
{{ range . }}
31+
<tr>
32+
<td><code>{{ .syntax }}</code></td>
33+
<td>{{ .description | markdownify }}</td>
34+
</tr>
35+
{{ end }}
36+
</tbody>
37+
</table>
38+
{{ end }}
39+
{{ end }}
40+
41+
<h4>Accessing step properties</h4>
42+
<p>Combine any reference method with a property:</p>
43+
<ul>
44+
{{ range .usage_examples }}
45+
<li><code>{{ printf "{{%s}}" .path }}</code> - {{ .description | markdownify }}</li>
46+
{{ end }}
47+
</ul>
48+
{{ end }}
49+

0 commit comments

Comments
 (0)