Skip to content

Commit 014c9c7

Browse files
DOC-6013 Augment's lessons learned from this fix
1 parent 7599c53 commit 014c9c7

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

build/tcedocs/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,22 @@ The following example shows the `connect` step of a Python example:
259259
```
260260
{{< clients-example set="set_and_get" step="connect" lang_filter="Python" />}}
261261
```
262+
262263
The programming language name should match the value in the Hugo configuration file.
264+
265+
#### Language Filter Syntax and Matching
266+
267+
The `lang_filter` parameter accepts a **comma-separated list of exact language names**:
268+
269+
```
270+
{{< clients-example set="example_id" lang_filter="C#-Sync,C#-Async" />}}
271+
```
272+
273+
**Important**: Language names must match exactly as they appear in `config.toml`. The matching is **exact**, not substring-based:
274+
275+
-`lang_filter="C#-Sync,C#-Async"` - Shows only C# sync and async tabs
276+
-`lang_filter="C"` - Does NOT match "C#-Sync" or "C#-Async" (exact match only)
277+
-`lang_filter="Python,Node.js"` - Shows Python and Node.js tabs
278+
-`lang_filter="Python,Node"` - Does NOT match "Node.js" (must use exact name)
279+
280+
**Common pitfall**: If you use a language name that is a substring of another language name (e.g., "C" is a substring of "C#-Sync"), the filter will NOT accidentally match the longer name. Each language in the filter list must match exactly.

build/tcedocs/SPECIFICATION.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,26 @@ OK
21402140
{{< /clients-example >}}
21412141
```
21422142

2143+
### Language Filter Matching Behavior
2144+
2145+
The `lang_filter` parameter uses **exact matching** on comma-separated language names:
2146+
2147+
**Matching Logic**:
2148+
1. Split the filter string by commas (e.g., `"C#-Sync,C#-Async"``["C#-Sync", "C#-Async"]`)
2149+
2. Trim whitespace from each language name
2150+
3. For each configured language in `config.toml`, check if it exactly matches any value in the filter list
2151+
4. Only include languages that match exactly
2152+
2153+
**Examples**:
2154+
- `lang_filter="C#-Sync,C#-Async"` → Shows only C# sync and async tabs
2155+
- `lang_filter="Python"` → Shows only Python tab
2156+
- `lang_filter="Python,Node.js"` → Shows Python and Node.js tabs
2157+
- `lang_filter="C"` → Shows only C tab (does NOT match "C#-Sync" or "C#-Async")
2158+
2159+
**Important**: Language names must match exactly as they appear in `config.toml`. This prevents accidental matches when one language name is a substring of another (e.g., "C" is a substring of "C#-Sync", but they are treated as distinct languages).
2160+
2161+
**Implementation**: See `layouts/partials/tabbed-clients-example.html` for the matching logic.
2162+
21432163

21442164
## Lessons Learned: Adding the C (hiredis) Client
21452165

0 commit comments

Comments
 (0)