From 2022ef9d1809214a58af19de6cbca8bd32b94819 Mon Sep 17 00:00:00 2001 From: Mastermay Date: Sat, 27 Feb 2021 11:23:32 +0800 Subject: [PATCH 1/4] doc: remove zero-width space character --- content/zh/docs/contribute/style/hugo-shortcodes/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/index.md b/content/zh/docs/contribute/style/hugo-shortcodes/index.md index b2567f0771..4139e413bc 100644 --- a/content/zh/docs/contribute/style/hugo-shortcodes/index.md +++ b/content/zh/docs/contribute/style/hugo-shortcodes/index.md @@ -236,7 +236,7 @@ Parameter | Description | Default {{< /table >}} --> -​```go-html-template +```go-html-template {{}} 参数 | 描述 | 默认值 :---------|:------------|:------- From 9d5b88861e680da85cc7250ee60f6b0e338acf0d Mon Sep 17 00:00:00 2001 From: mastermay <986492616@qq.com> Date: Mon, 1 Mar 2021 17:28:58 +0800 Subject: [PATCH 2/4] docs: Synchronize Chinese localization with upstream --- .../contribute/style/hugo-shortcodes/index.md | 216 ++++++++++++------ 1 file changed, 142 insertions(+), 74 deletions(-) diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/index.md b/content/zh/docs/contribute/style/hugo-shortcodes/index.md index 4139e413bc..fba8d98258 100644 --- a/content/zh/docs/contribute/style/hugo-shortcodes/index.md +++ b/content/zh/docs/contribute/style/hugo-shortcodes/index.md @@ -9,8 +9,8 @@ content_type: concept - -本页面将介绍定制 Hugo 短代码,可以用于 Kubernetes markdown 文档书写。 + +本页面将介绍 Hugo 自定义短代码,可以用于 Kubernetes Markdown 文档书写。 关于短代码的更多信息可参见 [Hugo 文档](https://gohugo.io/content-management/shortcodes)。 @@ -20,31 +20,31 @@ content_type: concept ## 功能状态 -在本站的 markdown 页面中,你可以加入短代码来展示所描述的功能特性的版本和状态。 +在本站的 Markdown 页面中,你可以加入短代码来展示所描述的功能特性的版本和状态。 ### 功能状态示例 -下面是一个功能状态代码段的演示,表明这个功能已经在 Kubernetes v1.10 时就已经稳定了。 +下面是一个功能状态代码段的演示,表明这个功能已经在最新版 Kubernetes 中稳定了。 ``` -{{}} +{{}} ``` - + 会转换为: -{{< feature-state for_k8s_version="v1.10" state="stable" >}} +{{< feature-state state="stable" >}} `state` 的可选值如下: @@ -57,91 +57,42 @@ in Kubernetes version 1.10. ### 功能状态代码 所显示的 Kubernetes 默认为该页或站点版本。 -可以通过修改 for_k8s_version 短代码参数来调整要显示的版本。 +修改 for_k8s_version 短代码参数可以调整要显示的版本。例如 ``` -{{}} +{{}} ``` 会转换为: -{{< feature-state for_k8s_version="v1.11" state="stable" >}} - - -#### Alpha 功能 - -``` -{{}} -``` - - -会转换为: - -{{< feature-state state="alpha" >}} - - -#### Beta 功能 - -``` -{{}} -``` - - -会转换为: - -{{< feature-state state="beta" >}} - - -#### 稳定功能 - -``` -{{}} -``` - - -会转换为: - -{{< feature-state state="stable" >}} - - -#### 废弃功能 - -``` -{{}} -``` - - -会转换为: - -{{< feature-state state="deprecated" >}} +{{< feature-state for_k8s_version="v1.10" state="beta" >}} ## 词汇 -有两种词汇表提示。 +有两种词汇表提示:glossary_tooltipglossary_definition。 你可以通过加入术语词汇的短代码,来自动更新和替换相应链接中的内容 ([我们的词汇库](/zh/docs/reference/glossary/)) -这样,在浏览在线文档,鼠标移到术语上时,术语解释就会显示在提示框中。 +在浏览在线文档时,术语会显示为超链接的样式,当鼠标移到术语上时,其解释就会显示在提示框中。 除了包含工具提示外,你还可以重用页面内容中词汇表中的定义。 ### 词汇演示 -例如,下面的代码在 markdown 中将会转换为 `{{< glossary_tooltip text="cluster" term_id="cluster" >}}`, +例如,下面的代码在 Markdown 中将会转换为 `{{< glossary_tooltip text="cluster" term_id="cluster" >}}`, 然后在提示框中显示。 ``` @@ -191,7 +142,6 @@ You can also include a full definition: 呈现为: {{< glossary_definition term_id="cluster" length="all" >}} @@ -278,7 +228,7 @@ The `tabs` shortcode takes these parameters: --> ## 标签页 -在本站的 markdown 页面(`.md` 文件)中,你可以加入一个标签页集来显示 +在本站的 Markdown 页面(`.md` 文件)中,你可以加入一个标签页集来显示 某解决方案的不同形式。 标签页的短代码包含以下参数: @@ -398,6 +348,124 @@ println "This is tab 2." {{< tab name="JSON File" include="podtemplate.json" />}} {{< /tabs >}} + +## 版本号信息 + +文档中的版本号信息可以通过短代码的方式生成。在配置文件 `config.toml` 中,定义了一些版本号信息,通过短代码及版本号参数可以从配置文件中提取并展示指定的版本号信息。 +最常见的版本号短代码参数包括 `latest` 和 `version`。 + + +### `{{}}` + +`{{}}` 短代码可以转换为 Kubernetes 文档的当前版本,具体的版本号来源于配置文件中的 `version` 参数。 +短代码 `param` 允许传入一个配置参数,例子里的参数为 `version`。 + + +{{< note >}} +在先前已经发布的文档中,`latest` 和 `version` 参数转换得到的版本号并不相同。 +新版本文档发布后,参数 `latest` 会增加,而 `version` 则保持不变。例如,在上一版本的文档中使用 `version` 会得到 `v1.19`,而使用 `latest` 则会得到 `v1.20`。 +{{< /note >}} + + +转换为: + +{{< param "version" >}} + + +### `{{}}` + +`{{}}` 会转换为配置文件中参数 `latest` 对应的值。每当有新版本文档发布时,该参数均会更新。 +因此,参数 `latest` 与 `version` 并不总是相同。 + +转换为: + +{{< latest-version >}} + + +### `{{}}` + +`{{}}` 会转换为配置文件中参数 `latest` 对应的值,并且会删除前缀 `v`。 + +转换为: + +{{< latest-semver >}} + + +### `{{}}` + +`{{}}` 会检查是否设置了页面参数 `min-kubernetes-server-version` 并将其与 `version` 进行比较。 + +转换为: + +{{< version-check >}} + + +### `{{}}` + +`{{}}` 会转换为 `latest` 版本的更新日志的超链接。 + +转换为: + +{{< latest-release-notes >}} + ## {{% heading "whatsnext" %}} -* 了解 [Hugo](https://gohugo.io/)。 +* 了解[Hugo](https://gohugo.io/)。 * 了解[撰写新的话题](/zh/docs/contribute/style/write-new-topic/)。 * 了解[使用页面内容类型](/zh/docs/contribute/style/page-content-types/)。 * 了解[发起 PR](/zh/docs/contribute/new-content/open-a-pr/)。 From b5a83d8d3c539632eea187af236799a0a348b56b Mon Sep 17 00:00:00 2001 From: mastermay <986492616@qq.com> Date: Tue, 2 Mar 2021 18:41:06 +0800 Subject: [PATCH 3/4] docs: improve chinese translation --- .../contribute/style/hugo-shortcodes/index.md | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/index.md b/content/zh/docs/contribute/style/hugo-shortcodes/index.md index fba8d98258..b1d156951b 100644 --- a/content/zh/docs/contribute/style/hugo-shortcodes/index.md +++ b/content/zh/docs/contribute/style/hugo-shortcodes/index.md @@ -358,36 +358,37 @@ The two most commonly used version parameters are `latest` and `version`. --> ## 版本号信息 -文档中的版本号信息可以通过短代码的方式生成。在配置文件 `config.toml` 中,定义了一些版本号信息,通过短代码及版本号参数可以从配置文件中提取并展示指定的版本号信息。 -最常见的版本号短代码参数包括 `latest` 和 `version`。 +要在文档中生成版本号信息,可以从以下几种短代码中选择。每个短代码可以基于站点配置文件 +`config.toml` 中的版本参数生成一个版本号取值。最常用的参数为 `latest` 和 `version`。 ### `{{}}` -`{{}}` 短代码可以转换为 Kubernetes 文档的当前版本,具体的版本号来源于配置文件中的 `version` 参数。 -短代码 `param` 允许传入一个配置参数,例子里的参数为 `version`。 +`{{}}` 短代码可以基于站点参数 `version` 生成 Kubernetes +文档的当前版本号取值。短代码 `param` 允许传入一个站点参数名称,在这里是 `version`。 {{< note >}} -在先前已经发布的文档中,`latest` 和 `version` 参数转换得到的版本号并不相同。 -新版本文档发布后,参数 `latest` 会增加,而 `version` 则保持不变。例如,在上一版本的文档中使用 `version` 会得到 `v1.19`,而使用 `latest` 则会得到 `v1.20`。 +在先前已经发布的文档中,`latest` 和 `version` 参数值并不完全等价。新版本文档发布后,参数 +`latest` 会增加,而 `version` 则保持不变。例如,在上一版本的文档中使用 `version` 会得到 +`v1.19`,而使用 `latest` 则会得到 `v1.20`。 {{< /note >}} 转换为: @@ -401,12 +402,10 @@ The `latest` site parameter is updated when a new version of the documentation i This parameter does not always match the value of `version` in a documentation set. Renders to: - -{{< latest-version >}} --> ### `{{}}` -`{{}}` 会转换为配置文件中参数 `latest` 对应的值。每当有新版本文档发布时,该参数均会更新。 +`{{}}` 返回站点参数 `latest` 的取值。每当新版本文档发布时,该参数均会被更新。 因此,参数 `latest` 与 `version` 并不总是相同。 转换为: @@ -419,12 +418,10 @@ Renders to: The `{{}}` shortcode generates the value of `latest` without the "v" prefix. Renders to: - -{{< latest-semver >}} --> ### `{{}}` -`{{}}` 会转换为配置文件中参数 `latest` 对应的值,并且会删除前缀 `v`。 +`{{}}` 短代码可以生成站点参数 `latest` 不含前缀 `v` 的版本号取值。 转换为: @@ -437,12 +434,11 @@ The `{{}}` shortcode checks if the `min-kubernetes-server-v page parameter is present and then uses this value to compare to `version`. Renders to: - -{{< version-check >}} --> ### `{{}}` -`{{}}` 会检查是否设置了页面参数 `min-kubernetes-server-version` 并将其与 `version` 进行比较。 +`{{}}` 会检查是否设置了页面参数 `min-kubernetes-server-version` +并将其与 `version` 进行比较。 转换为: @@ -452,15 +448,15 @@ Renders to: ### `{{}}` The `{{}}` shortcode generates a version string from `latest` and removes -the "v" prefix. The shortcode prints a new URL for the release note CHANGELOG page with the modified version string. +the "v" prefix. The shortcode prints a new URL for the release note CHANGELOG page with the modified +version string. Renders to: - -{{< latest-release-notes >}} --> ### `{{}}` -`{{}}` 会转换为 `latest` 版本的更新日志的超链接。 +`{{}}` 短代码基于站点参数 `latest` 生成不含前缀 `v` +的版本号取值,并输出该版本更新日志的超链接地址。 转换为: From e56f6634419cf61e620572ab8a47a62df0c7a263 Mon Sep 17 00:00:00 2001 From: Mastermay Date: Tue, 2 Mar 2021 20:01:42 +0800 Subject: [PATCH 4/4] Update content/zh/docs/contribute/style/hugo-shortcodes/index.md Co-authored-by: Qiming Teng --- content/zh/docs/contribute/style/hugo-shortcodes/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/index.md b/content/zh/docs/contribute/style/hugo-shortcodes/index.md index b1d156951b..d95dfe011a 100644 --- a/content/zh/docs/contribute/style/hugo-shortcodes/index.md +++ b/content/zh/docs/contribute/style/hugo-shortcodes/index.md @@ -88,7 +88,7 @@ page content. --> ## 词汇 -有两种词汇表提示:glossary_tooltipglossary_definition。 +有两种词汇表提示:`glossary_tooltip` 和 `glossary_definition`。 你可以通过加入术语词汇的短代码,来自动更新和替换相应链接中的内容 ([我们的词汇库](/zh/docs/reference/glossary/)) @@ -477,4 +477,3 @@ Renders to: * 了解[使用页面内容类型](/zh/docs/contribute/style/page-content-types/)。 * 了解[发起 PR](/zh/docs/contribute/new-content/open-a-pr/)。 * 了解[高级贡献](/zh/docs/contribute/advanced/)。 -