|
1 |
| -{{ $prettier_ignore := ` |
| 1 | +{{/* |
| 2 | + |
| 3 | +IMPORTANT NOTE TO LOCALIZATION TEAMS. ALL LOCALISATIONS SHOULD USE THIS |
| 4 | +SHORTCODE. DO NOT WRITE YOUR OWN VERSION. INSTEAD, LOCALIZE THE INCLUDE FILE |
| 5 | +named by the "_path" field below. |
| 6 | + |
| 7 | +This comment can be deleted once all l10n teams have updated to use this version |
| 8 | +of the intro.md shortcode. |
| 9 | + |
| 10 | +*/ -}} |
| 11 | +{{/* |
| 12 | + |
| 13 | +Usage: [langID] |
| 14 | + |
| 15 | +Argument is an optional language ID (like go or cpp). When omitted, and this |
| 16 | +shortcode is called from a docs/language page, $lang will be set to the language |
| 17 | +ID of that page's section. For example $lang will be "cpp" for |
| 18 | +"docs/languages/cpp/...". |
2 | 19 |
|
3 |
| -<!-- prettier-ignore-start --> |
4 |
| -` -}} |
| 20 | +Note: until https://github.com/open-telemetry/opentelemetry.io/issues/6582 is |
| 21 | +fixed, $lang will be `net` for .Net. After that issue is fixed, we'll be able to |
| 22 | +eliminate $langIdAsPath and just use $lang. |
5 | 23 |
|
6 |
| -{{ $lang := .Get 0 | default "" -}} |
| 24 | +We may also be able to avoid having the `name` in the data file, instead picking |
| 25 | +it up from the language section index file. |
| 26 | + |
| 27 | +*/ -}} |
| 28 | + |
| 29 | +{{ $lang := .Get 0 -}} |
7 | 30 | {{ $langIdAsPath := "" -}}
|
8 |
| -{{ $name := "" -}} |
| 31 | +{{ with findRESubmatch `^docs/languages/(.*?)(?:$|/)` .Page.File.Path 1 -}} |
| 32 | + {{ $langIdAsPath = index (index . 0) 1 -}} |
| 33 | + {{ if not $lang -}} |
| 34 | + {{ $lang = cond (eq $langIdAsPath "net") "dotnet" $langIdAsPath -}} |
| 35 | + {{ end -}} |
| 36 | +{{ end -}} |
9 | 37 |
|
| 38 | +{{ $name := "" -}} |
10 | 39 | {{ if $lang -}}
|
11 |
| - {{ $langIdAsPath = cond (eq $lang "dotnet") "net" $lang }} |
12 | 40 | {{ $name = (index $.Site.Data.instrumentation $lang).name -}}
|
13 | 41 | {{ if not $name -}}
|
14 | 42 | {{ warnf "No name for language '%s' in `instrumentation` data file." $lang -}}
|
15 | 43 | {{ end -}}
|
| 44 | + {{ $langArg := .Get 0 | default "" -}} |
| 45 | + {{ if ne $langArg $lang -}} |
| 46 | + {{ warnf ">> File %s: langArg '%s' != lang '%s' %s" |
| 47 | + .Page.File.Path $langArg $lang |
| 48 | + (.Page) |
| 49 | + -}} |
| 50 | + {{ else -}} |
| 51 | + {{ warnf ">> arg matches $lang = %s, id = %s" $lang $langIdAsPath -}} |
| 52 | + {{ end -}} |
16 | 53 | {{ end -}}
|
17 | 54 |
|
18 | 55 |
|
|
0 commit comments