|
1 |
| -{{ .Scratch.Set "example" (.Get 0) }} |
2 |
| -{{ .Scratch.Set "step" (.Get 1) }} |
3 |
| -{{ .Scratch.Set "lang" (.Get 2) }} |
4 |
| -{{ .Scratch.Set "maxLines" (.Get 3) }} |
5 |
| -{{ .Scratch.Set "cli_tab_name" (.Get 4) }} |
6 |
| -{{ .Scratch.Set "cli_footer_link_text" (.Get 5) }} |
7 |
| -{{ .Scratch.Set "cli_footer_link_url" (.Get 6) }} |
| 1 | +{{/* |
| 2 | + clients-example shortcode - supports both positional and named parameters |
| 3 | + |
| 4 | + Named parameters: |
| 5 | + - set: Name of the example set (required) |
| 6 | + - step: Example step name (required) |
| 7 | + - lang_filter: Language filter (optional, default: "") |
| 8 | + - max_lines: Maximum number of lines shown by default (optional, default: 100) |
| 9 | + - dft_tab_name: Custom first tab name (optional, default: ">_ Redis CLI") |
| 10 | + - dft_tab_link_title: Custom first tab footer link title (optional) |
| 11 | + - dft_tab_url: Custom first tab footer link URL (optional) |
| 12 | + |
| 13 | + Positional parameters (for backward compatibility): |
| 14 | + - 0: example set name |
| 15 | + - 1: step name |
| 16 | + - 2: language filter |
| 17 | + - 3: max lines |
| 18 | + - 4: custom first tab name |
| 19 | + - 5: custom first tab footer link title |
| 20 | + - 6: custom first tab footer link URL |
| 21 | +*/}} |
| 22 | + |
| 23 | +{{/* Determine if we're using named or positional parameters */}} |
| 24 | +{{ $usingNamedParams := false }} |
| 25 | +{{ if .Get "set" }} |
| 26 | + {{ $usingNamedParams = true }} |
| 27 | +{{ end }} |
| 28 | + |
| 29 | +{{/* Set parameters based on whether we're using named or positional */}} |
| 30 | +{{ if $usingNamedParams }} |
| 31 | + {{/* Named parameters */}} |
| 32 | + {{ .Scratch.Set "example" (.Get "set") }} |
| 33 | + {{ .Scratch.Set "step" (.Get "step") }} |
| 34 | + {{ .Scratch.Set "lang" (or (.Get "lang_filter") (.Get "language") "") }} |
| 35 | + {{ .Scratch.Set "maxLines" (.Get "max_lines") }} |
| 36 | + {{ .Scratch.Set "cli_tab_name" (.Get "dft_tab_name") }} |
| 37 | + {{ .Scratch.Set "cli_footer_link_text" (.Get "dft_tab_link_title") }} |
| 38 | + {{ .Scratch.Set "cli_footer_link_url" (.Get "dft_tab_url") }} |
| 39 | +{{ else }} |
| 40 | + {{/* Positional parameters (backward compatibility) */}} |
| 41 | + {{ .Scratch.Set "example" (.Get 0) }} |
| 42 | + {{ .Scratch.Set "step" (.Get 1) }} |
| 43 | + {{ .Scratch.Set "lang" (.Get 2) }} |
| 44 | + {{ .Scratch.Set "maxLines" (.Get 3) }} |
| 45 | + {{ .Scratch.Set "cli_tab_name" (.Get 4) }} |
| 46 | + {{ .Scratch.Set "cli_footer_link_text" (.Get 5) }} |
| 47 | + {{ .Scratch.Set "cli_footer_link_url" (.Get 6) }} |
| 48 | +{{ end }} |
| 49 | + |
8 | 50 | {{ .Scratch.Set "redisCommands" .Inner }}
|
9 | 51 | {{ partial "tabbed-clients-example.html" . }}
|
0 commit comments