Skip to content

Commit 7fb6d15

Browse files
DOC-5517 added test file for demo
1 parent 2325423 commit 7fb6d15

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
Title: TCE test
3+
alwaysopen: false
4+
categories:
5+
- docs
6+
- operate
7+
- rs
8+
description: Test for tabbed-clients-example.html
9+
weight: 1
10+
linkTitle: TCE test
11+
---
12+
13+
This page demonstrates the new named parameter syntax for the `clients-example` shortcode while maintaining backward compatibility with positional parameters.
14+
15+
## Basic Usage with Named Parameters
16+
17+
### Example 1: Basic named parameters
18+
Using the new named parameter syntax with just the required parameters:
19+
20+
{{< clients-example set="stream_tutorial" step="xadd" >}}
21+
> XADD race:france * rider Castilla speed 30.2 position 1 location_id 1
22+
"1692632086370-0"
23+
{{< /clients-example >}}
24+
25+
### Example 2: Named parameters with language filter
26+
Filtering to show only specific client languages:
27+
28+
{{< clients-example set="py_home_json" step="query1" lang_filter="Python" >}}
29+
{{< /clients-example >}}
30+
31+
### Example 3: Named parameters with custom max lines
32+
Limiting the number of lines displayed in the Redis CLI tab:
33+
34+
{{< clients-example set="hash_tutorial" step="set_get_all" max_lines="2" >}}
35+
> JSON.SET "bicycle:0" "." "{\"brand\": \"Velorim\", \"model\": \"Jigger\", \"price\": 270}"
36+
OK
37+
> JSON.SET "bicycle:1" "." "{\"brand\": \"Bicyk\", \"model\": \"Hillcraft\", \"price\": 1200}"
38+
OK
39+
{{< /clients-example >}}
40+
41+
### Example 4: Named parameters with custom tab name
42+
Using a custom name for the Redis CLI tab:
43+
44+
{{< clients-example set="cmds_list" step="llen" dft_tab_name="🔧 Redis Commands" >}}
45+
redis> LPUSH mylist "World"
46+
(integer) 1
47+
redis> LPUSH mylist "Hello"
48+
(integer) 2
49+
redis> LLEN mylist
50+
(integer) 2
51+
{{< /clients-example >}}
52+
53+
### Example 5: Named parameters with custom footer links
54+
Adding custom footer links to the Redis CLI tab:
55+
56+
{{< clients-example set="cmds_hash" step="hvals" dft_tab_name="Redis CLI Example" dft_tab_link_title="Learn More" dft_tab_url="https://redis.io/commands/hvals" >}}
57+
redis> HSET myhash field1 "Hello"
58+
(integer) 1
59+
redis> HSET myhash field2 "World"
60+
(integer) 1
61+
redis> HVALS myhash
62+
1) "Hello"
63+
2) "World"
64+
{{< /clients-example >}}
65+
66+
## Backward Compatibility Tests
67+
68+
### Example 6: Original positional parameters (2 params)
69+
This should work exactly as before:
70+
71+
{{< clients-example stream_tutorial xrange >}}
72+
> XRANGE race:france 1692632086370-0 + COUNT 2
73+
{{< /clients-example >}}
74+
75+
### Example 7: Original positional parameters (4 params)
76+
Testing with language filter and max lines:
77+
78+
{{< clients-example search_quickstart add_documents "" 3 >}}
79+
> JSON.SET "bicycle:0" "." "{\"brand\": \"Velorim\", \"model\": \"Jigger\", \"price\": 270}"
80+
OK
81+
> JSON.SET "bicycle:1" "." "{\"brand\": \"Bicyk\", \"model\": \"Hillcraft\", \"price\": 1200}"
82+
OK
83+
{{< /clients-example >}}
84+
85+
## Parameter Reference
86+
87+
### Named Parameters
88+
89+
| Parameter | Type | Description | Default |
90+
|-----------|------|-------------|---------|
91+
| `set` | string | Name of the example set (required) | - |
92+
| `step` | string | Example step name (required) | - |
93+
| `lang_filter` or `language` | string | Language filter to show only specific clients | `""` (all languages) |
94+
| `max_lines` | integer | Maximum number of lines shown in Redis CLI tab | `100` |
95+
| `dft_tab_name` | string | Custom name for the Redis CLI tab | `">_ Redis CLI"` |
96+
| `dft_tab_link_title` | string | Custom footer link title for Redis CLI tab | - |
97+
| `dft_tab_url` | string | Custom footer link URL for Redis CLI tab | - |
98+
99+
### Positional Parameters (Backward Compatibility)
100+
101+
| Position | Type | Description | Default |
102+
|----------|------|-------------|---------|
103+
| 0 | string | Name of the example set (required) | - |
104+
| 1 | string | Example step name (required) | - |
105+
| 2 | string | Language filter | `""` |
106+
| 3 | integer | Maximum number of lines | `100` |
107+
| 4 | string | Custom first tab name | `">_ Redis CLI"` |
108+
| 5 | string | Custom first tab footer link title | - |
109+
| 6 | string | Custom first tab footer link URL | - |
110+
111+
## Migration Guide
112+
113+
### Before (Positional Parameters)
114+
```hugo
115+
{{</* clients-example stream_tutorial xadd */>}}
116+
{{</* clients-example search_quickstart add_documents "" 2 */>}}
117+
{{</* clients-example cmds_list llen "" "" "Custom CLI" */>}}
118+
```
119+
120+
### After (Named Parameters)
121+
```hugo
122+
{{</* clients-example set="stream_tutorial" step="xadd" */>}}
123+
{{</* clients-example set="search_quickstart" step="add_documents" max_lines="2" */>}}
124+
{{</* clients-example set="cmds_list" step="llen" dft_tab_name="Custom CLI" */>}}
125+
```
126+
127+
The named parameter syntax is more readable and self-documenting, making it easier to understand what each parameter does without referring to documentation.

0 commit comments

Comments
 (0)