Skip to content

Commit f75e710

Browse files
committed
Compute lang ID from page
1 parent 25d9776 commit f75e710

File tree

16 files changed

+74
-31
lines changed

16 files changed

+74
-31
lines changed

.prettierignore

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44
/themes
55

66
/layouts/*
7-
!/layouts/shortcodes
8-
/layouts/shortcodes/*
9-
!/layouts/shortcodes/docs
10-
!/layouts/shortcodes/es
11-
!/layouts/shortcodes/pt
127

138
/content/en/blog/2019
149
/content/en/blog/202[23]
15-
# TEMPORARY:
16-
/content/en/docs/languages/_includes/exporters/intro.md
10+
# TEMPORARY until the PR introducing this file is merged:
11+
/content/en/docs/_includes/exporters/intro.md
1712

1813
/content/ja
1914
/content/zh

content/en/docs/_includes/exporters/intro.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ visualize your telemetry, export it to a backend such as
66
[Prometheus](https://prometheus.io/), or a
77
[vendor-specific](/ecosystem/vendors/) backend.
88

9-
{{ if $lang }}
9+
{{ if $name }}
1010

1111
## Available exporters
1212

1313
The registry contains a [list of exporters for {{ $name }}][reg].
1414

1515
{{ end }}
16-
{{ if not $lang }}
16+
{{ if not $name }}
1717

1818
The registry contains the [list of language specific exporters][reg].
1919

@@ -30,11 +30,10 @@ Specification][OTLP].
3030
[OTLP]: /docs/specs/otlp/
3131
[Prometheus]:
3232
https://prometheus.io/docs/prometheus/2.55/feature_flags/#otlp-receiver
33+
[reg]: </ecosystem/registry/?component=exporter&language={{ $lang }}>
3334
[vendors]: /ecosystem/vendors/
3435

35-
[reg]: /ecosystem/registry/?component=exporter&language={{ $lang }}
36-
37-
{{ if $lang }}
36+
{{ if $name }}
3837

3938
This page covers the main OpenTelemetry {{ $name }} exporters and how to set
4039
them up.

content/en/docs/languages/cpp/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cSpell:ignore: DWITH
66

77
<!-- markdownlint-disable no-duplicate-heading -->
88

9-
{{% docs/languages/exporters/intro cpp %}}
9+
{{% docs/languages/exporters/intro %}}
1010

1111
### Dependencies {#otlp-dependencies}
1212

content/en/docs/languages/erlang/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ weight: 50
44
cSpell:ignore: rebar relx
55
---
66

7-
{{% docs/languages/exporters/intro erlang %}}
7+
{{% docs/languages/exporters/intro %}}
88

99
## Exporting to the OpenTelemetry Collector
1010

content/en/docs/languages/go/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ weight: 50
66
cSpell:ignore: otlplog otlploggrpc otlploghttp otlpmetric otlpmetricgrpc otlpmetrichttp otlptrace otlptracegrpc otlptracehttp stdoutlog stdouttrace
77
---
88

9-
{{% docs/languages/exporters/intro go %}}
9+
{{% docs/languages/exporters/intro %}}
1010

1111
## Console
1212

content/en/docs/languages/js/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ weight: 50
44
description: Process and export your telemetry data
55
---
66

7-
{{% docs/languages/exporters/intro js %}}
7+
{{% docs/languages/exporters/intro %}}
88

99
### Dependencies {#otlp-dependencies}
1010

content/en/docs/languages/net/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Exporters
33
weight: 50
44
---
55

6-
{{% docs/languages/exporters/intro dotnet %}}
6+
{{% docs/languages/exporters/intro %}}
77

88
### Dependencies {#otlp-dependencies}
99

content/en/docs/languages/php/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ weight: 50
44
cSpell:ignore: fastcgi pecl
55
---
66

7-
{{% docs/languages/exporters/intro php %}}
7+
{{% docs/languages/exporters/intro %}}
88

99
{{% alert title="Note" color="info" %}}
1010

content/en/docs/languages/python/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cSpell:ignore: LOWMEMORY
77

88
<!-- markdownlint-disable no-duplicate-heading -->
99

10-
{{% docs/languages/exporters/intro python %}}
10+
{{% docs/languages/exporters/intro %}}
1111

1212
### Dependencies {#otlp-dependencies}
1313

content/en/docs/languages/ruby/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Exporters
33
weight: 50
44
---
55

6-
{{% docs/languages/exporters/intro ruby %}}
6+
{{% docs/languages/exporters/intro %}}
77

88
## OTLP endpoint
99

content/en/docs/languages/rust/exporters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Exporters
33
weight: 50
44
---
55

6-
{{% docs/languages/exporters/intro rust %}}
6+
{{% docs/languages/exporters/intro %}}
77

88
## OTLP endpoint
99

content/es/docs/concepts/components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Componentes
33
description: Componentes que forman OpenTelemetry
44
aliases: [data-collection]
55
weight: 20
6-
default_lang_commit: 9b7da35fd7abd77d867177902b36d95e5f322182 # patched
6+
default_lang_commit: 9b7da35fd7abd77d867177902b36d95e5f322182
77
drifted_from_default: true
88
---
99

content/pt/docs/languages/python/exporters.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Exporters
33
weight: 50
44
description: Processar e exportar seus dados de telemetria
5-
cSpell:ignore: LOWMEMORY
65
default_lang_commit: 546f3e88ca3673de8aad69358d416256d1fe6411 # patched
6+
cSpell:ignore: LOWMEMORY
77
---
88

99
<!-- markdownlint-disable no-duplicate-heading -->
1010

11-
{{% docs/languages/exporters/intro python %}}
11+
{{% docs/languages/exporters/intro %}}
1212

1313
### Dependências {#otlp-dependencies}
1414

content/zh/docs/concepts/components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 组件
33
description: 构成 OpenTelemetry 的主要组件
44
aliases: [data-collection]
55
weight: 20
6-
default_lang_commit: 1ca30b4d # patched
6+
default_lang_commit: 1ca30b4d
77
drifted_from_default: true
88
---
99

layouts/shortcodes/docs/languages/exporters/intro.md

+43-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,55 @@
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/...".
219

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.
523

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 -}}
730
{{ $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 -}}
937

38+
{{ $name := "" -}}
1039
{{ if $lang -}}
11-
{{ $langIdAsPath = cond (eq $lang "dotnet") "net" $lang }}
1240
{{ $name = (index $.Site.Data.instrumentation $lang).name -}}
1341
{{ if not $name -}}
1442
{{ warnf "No name for language '%s' in `instrumentation` data file." $lang -}}
1543
{{ 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 -}}
1653
{{ end -}}
1754

1855

layouts/shortcodes/include.html

+12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
occurrences of '{{ $key }}' in the included content, where 'key' is the name of
1212
the argument or its position in the list of positional arguments.
1313

14+
The following syntax of if-blocks is supported, so you can include content
15+
conditionally:
16+
17+
```
18+
{{ if [not] $key }}
19+
...
20+
{{ end }}
21+
```
22+
23+
Note that the `{{ if ... }}` and `{{ end }}` directives must appear at the
24+
beginning of a line.
25+
1426
*/ -}}
1527

1628
{{ $path := .Get (cond .IsNamedParams "file" 0) -}}

0 commit comments

Comments
 (0)