From 8344dda2f6a7f09bdd1f47302c5e8ac0ec851f71 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Sun, 11 Aug 2019 20:53:10 -0400 Subject: [PATCH] Use literals in jsonpath examples (#15775) It's very difficult to figure out e.g. the correct quotes to use from regular text that is subject to being converted for typographers quotes. Use code literals instead to ensure that nothing is modified, and to distinguish literals from accompanying text. Signed-off-by: Zane Bitter --- content/en/docs/reference/kubectl/jsonpath.md | 26 +++++++++---------- content/fr/docs/reference/kubectl/jsonpath.md | 26 +++++++++---------- content/zh/docs/reference/kubectl/jsonpath.md | 24 ++++++++--------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/content/en/docs/reference/kubectl/jsonpath.md b/content/en/docs/reference/kubectl/jsonpath.md index 1eed8c22be..457129e315 100644 --- a/content/en/docs/reference/kubectl/jsonpath.md +++ b/content/en/docs/reference/kubectl/jsonpath.md @@ -65,18 +65,18 @@ Given the JSON input: } ``` -Function | Description | Example | Result -------------------|---------------------------|---------------------------------------------------------------|------------------ -text | the plain text | kind is {.kind} | kind is List -@ | the current object | {@} | the same as input -. or [] | child operator | {.kind} or {['kind']} | List -.. | recursive descent | {..name} | 127.0.0.1 127.0.0.2 myself e2e -\* | wildcard. Get all objects | {.items[*].metadata.name} | [127.0.0.1 127.0.0.2] -[start:end :step] | subscript operator | {.users[0].name} | myself -[,] | union operator | {.items[*]['metadata.name', 'status.capacity']} | 127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8] -?() | filter | {.users[?(@.name=="e2e")].user.password} | secret -range, end | iterate list | {range .items[*]}[{.metadata.name}, {.status.capacity}] {end} | [127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]] -'' | quote interpreted string | {range .items[*]}{.metadata.name}{'\t'}{end} | 127.0.0.1 127.0.0.2 +Function | Description | Example | Result +--------------------|---------------------------|-----------------------------------------------------------------|------------------ +`text` | the plain text | `kind is {.kind}` | `kind is List` +`@` | the current object | `{@}` | the same as input +`.` or `[]` | child operator | `{.kind}` or `{['kind']}` | `List` +`..` | recursive descent | `{..name}` | `127.0.0.1 127.0.0.2 myself e2e` +`*` | wildcard. Get all objects | `{.items[*].metadata.name}` | `[127.0.0.1 127.0.0.2]` +`[start:end :step]` | subscript operator | `{.users[0].name}` | `myself` +`[,]` | union operator | `{.items[*]['metadata.name', 'status.capacity']}` | `127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]` +`?()` | filter | `{.users[?(@.name=="e2e")].user.password}` | `secret` +`range`, `end` | iterate list | `{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}` | `[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]]` +`''` | quote interpreted string | `{range .items[*]}{.metadata.name}{'\t'}{end}` | `127.0.0.1 127.0.0.2` Examples using `kubectl` and JSONPath expressions: @@ -95,4 +95,4 @@ C:\> kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.stat C:\> kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.startTime}{\"\n\"}{end}" ``` -{{% /capture %}} \ No newline at end of file +{{% /capture %}} diff --git a/content/fr/docs/reference/kubectl/jsonpath.md b/content/fr/docs/reference/kubectl/jsonpath.md index 5ec93be569..c77167e62e 100644 --- a/content/fr/docs/reference/kubectl/jsonpath.md +++ b/content/fr/docs/reference/kubectl/jsonpath.md @@ -67,18 +67,18 @@ En plus de la syntaxe de modèle JSONPath originale, les fonctions et syntaxes s } ``` -Fonction | Description | Exemple | Résultat -------------------|----------------------------|---------------------------------------------------------------|------------------ -text | le texte en clair | le type est {.kind} | le type est List -@ | l'objet courant | {@} | identique à l'entrée -. or [] | opérateur fils | {.kind} ou {['kind']} | List -.. | descente récursive | {..name} | 127.0.0.1 127.0.0.2 myself e2e -\* | joker. Tous les objets | {.items[*].metadata.name} | [127.0.0.1 127.0.0.2] -[start:end :step] | opérateur d'indice | {.users[0].name} | myself -[,] | opérateur d'union | {.items[*]['metadata.name', 'status.capacity']} | 127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8] -?() | filtre | {.users[?(@.name=="e2e")].user.password} | secret -range, end | itération de liste | {range .items[*]}[{.metadata.name}, {.status.capacity}] {end} | [127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]] -'' | protège chaîne interprétée | {range .items[*]}{.metadata.name}{'\t'}{end} | 127.0.0.1 127.0.0.2 +Fonction | Description | Exemple | Résultat +--------------------|----------------------------|-----------------------------------------------------------------|------------------ +`text` | le texte en clair | `le type est {.kind}` | `le type est List` +`@` | l'objet courant | `{@}` | identique à l'entrée +`.` ou `[]` | opérateur fils | `{.kind}` ou `{['kind']}` | `List` +`..` | descente récursive | `{..name}` | `127.0.0.1 127.0.0.2 myself e2e` +`*` | joker. Tous les objets | `{.items[*].metadata.name}` | `[127.0.0.1 127.0.0.2]` +`[start:end :step]` | opérateur d'indice | `{.users[0].name}` | `myself` +`[,]` | opérateur d'union | `{.items[*]['metadata.name', 'status.capacity']}` | `127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]` +`?()` | filtre | `{.users[?(@.name=="e2e")].user.password}` | `secret` +`range`, `end` | itération de liste | `{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}` | `[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]]` +`''` | protège chaîne interprétée | `{range .items[*]}{.metadata.name}{'\t'}{end}` | `127.0.0.1 127.0.0.2` Exemples utilisant `kubectl` et des expressions JSONPath : @@ -97,4 +97,4 @@ C:\> kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.stat C:\> kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.startTime}{\"\n\"}{end}" ``` -{{% /capture %}} \ No newline at end of file +{{% /capture %}} diff --git a/content/zh/docs/reference/kubectl/jsonpath.md b/content/zh/docs/reference/kubectl/jsonpath.md index e85041951c..3d202ca567 100644 --- a/content/zh/docs/reference/kubectl/jsonpath.md +++ b/content/zh/docs/reference/kubectl/jsonpath.md @@ -49,15 +49,15 @@ JSONPath 模板由 {} 包起来的 JSONPath 表达式组成。 ] } ``` -| 函数 | 描述 | 示例 | 结果 | -| ----------------- | ---------- | ---------------------------------------- | ---------------------------------------- | -| text | 纯文本 | kind is {.kind} | kind is List | -| @ | 当前对象 | {@} | 与输入相同 | -| . or [] | 子运算符 | {.kind} 或者 {['kind']} | List | -| .. | 递归下降 | {..name} | 127.0.0.1 127.0.0.2 myself e2e | -| * | 通配符,获取所有对象 | {.items[*].metadata.name} | [127.0.0.1 127.0.0.2] | -| [start:end :step] | 下标运算符 | {.users[0].name} | myself | -| [,] | 并集运算符 | {.items[*]['metadata.name', 'status.capacity']} | 127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8] | -| ?() | 过滤 | {.users[?(@.name=="e2e")].user.password} | secret | -| range, end | 迭代列表 | {range .items[*]}[{.metadata.name}, {.status.capacity}] {end} | [127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]] | -| "" | 引用解释执行字符串 | {range .items[*]}{.metadata.name}{"\t"}{end} | 127.0.0.1 127.0.0.2 | \ No newline at end of file +| 函数 | 描述 | 示例 | 结果 | +| ------------------- | ---------- | ------------------------------------------ | ------------------------------------------ | +| `text` | 纯文本 | `kind is {.kind}` | `kind is List` | +| `@` | 当前对象 | `{@}` | 与输入相同 | +| `.` 或者 `[]` | 子运算符 | `{.kind}` 或者 `{['kind']}` | `List` | +| `..` | 递归下降 | `{..name}` | `127.0.0.1 127.0.0.2 myself e2e` | +| `*` | 通配符,获取所有对象 | `{.items[*].metadata.name}` | `[127.0.0.1 127.0.0.2]` | +| `[start:end :step]` | 下标运算符 | `{.users[0].name}` | `myself` | +| `[,]` | 并集运算符 | `{.items[*]['metadata.name', 'status.capacity']}` | `127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]` | +| `?()` | 过滤 | `{.users[?(@.name=="e2e")].user.password}` | `secret` | +| `range`, `end` | 迭代列表 | `{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}` | `[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]]` | +| `''` | 引用解释执行字符串 | `{range .items[*]}{.metadata.name}{'\t'}{end}` | `127.0.0.1 127.0.0.2` |