From 06b1b9f137e15e0d78de6b372971a3926403650c Mon Sep 17 00:00:00 2001 From: PocketZ <45301505+pocketdr@users.noreply.github.com> Date: Thu, 12 Aug 2021 12:18:20 +0800 Subject: Update MDN/Structures/Macros and MDN/Yari of l10n-zh (#2024) * Create MDN/Tools/KumaScript * Create MDN/Tools/KumaScript/Troubleshooting * Create MDN/Tools/KumaScript * Create MDN/Tools/KumaScript/Troubleshooting * Update MDN/Structures/Macros * Update MDN/Yari * Update content of Macros and KumaScript * delete no translated articel --- files/zh-cn/mdn/structures/macros/index.html | 34 ++++---- files/zh-cn/mdn/structures/macros/other/index.html | 92 ++++++++++++++++++++++ files/zh-cn/mdn/yari/index.html | 1 - files/zh-tw/mdn/yari/index.html | 24 +++--- 4 files changed, 118 insertions(+), 33 deletions(-) create mode 100644 files/zh-cn/mdn/structures/macros/other/index.html diff --git a/files/zh-cn/mdn/structures/macros/index.html b/files/zh-cn/mdn/structures/macros/index.html index b41123ab3f..4227374bac 100644 --- a/files/zh-cn/mdn/structures/macros/index.html +++ b/files/zh-cn/mdn/structures/macros/index.html @@ -1,5 +1,5 @@ --- -title: Macros +title: 使用宏 slug: MDN/Structures/Macros tags: - Guide @@ -11,36 +11,32 @@ translation_of: MDN/Structures/Macros ---
{{MDNSidebar}}
-

Kuma 平台为 MDN 提供了强大的宏系统——KumaScript,使得 MDN 能够自动地去做各种东西。本文提供一些信息以便大家知道如何使用 MDN 上的文章内的宏。

+

为了自动化执行某些工作,Yari 平台提供了一个强大的宏系统——KumaScript。本文提供了一些相关信息,方便你在参与编辑 MDN 时,使用这些宏。

-

鉴于本文只是 KumaScript 的简介,KumaScript 指南提供了更深入的内容。

+

本文只是简要介绍了 KumaScript,KumaScript 指南提供了更深入的内容,帮助你使用和掌握它。

-

宏是如何实现的

+

宏是如何实现的

-

MDN使用的Macros(宏)是基于Node.js执行环境,并在服务端执行运行。这里包括了大量的代码库,另外对此还提供了丰富的wiki说明文档内容。如果你希望能学习到更多的内容,可以查看 KumaScript 指南KumaScript reference 则提供了更多关于这些代码库和KumaScript的API的实现机理。

+

MDN 使用宏是基于运行于服务器上的 JavaScript 代码实现的,并由 Node.js 解释执行。在此之上,已经实现了一个丰富的工具库,让宏可以与这个平台及其中的内容进行互动。

-

在文章中使用宏

+

在文章中使用宏

-

要实际使用宏,只需将对宏的调用括在一对双括号中,其参数(如果有)括在括号中;如下:

+

要实际使用宏,只需将对宏的调用和可能需要的参数写在一对双括号中,如下:

\{{macroname(parameter-list)}}

关于宏调用的一些注意事项:

-

宏被高度缓存;对于任何一组输入值(参数和环境值,例如运行宏的URL),结果都会被存储和重用。这意味着宏仅在输入发生变化时才实际运行。

+

宏的几乎所有执行结果都会被缓存,以便被重用来加快执行速度。这意味着宏仅在输入发生变化时才实际运行,包括调用时的参数以及环境值(例如这个宏被调用时所在的路径)。

-
-

注意: 您可以通过在浏览器中强制刷新页面(即转移重新加载)来强制重新评估页面上的所有宏。

-
+

宏既可以用来做一些简单的工作,比如插入更大的文本块或从MDN的另一部分交换内容一样简单,也可以通过搜索站点的各个部分,设置输出样式和添加链接来构建整个内容索引。

-

宏可以像插入更大的文本块或从MDN的另一部分交换内容一样简单,也可以通过搜索站点的各个部分,设置输出样式和添加链接来构建整个内容索引。

- -

您可以在Commonly-used macros页面上阅读我们最常用的宏;另外,这里有complete list of all macros。大多数宏都有内置的文档,作为顶部的注释。

+

您可以在常用的宏页面看到一些我们最常用到的宏,还可以在我们 Github 的仓库中,浏览所有可用的宏。大多数宏顶部的注释中,都有内置的文档帮助你了解它的作用。

diff --git a/files/zh-cn/mdn/structures/macros/other/index.html b/files/zh-cn/mdn/structures/macros/other/index.html new file mode 100644 index 0000000000..d9dd6f2ea3 --- /dev/null +++ b/files/zh-cn/mdn/structures/macros/other/index.html @@ -0,0 +1,92 @@ +--- +title: 其他需要注意的宏 +slug: MDN/Structures/Macros/Other +tags: + - Macros + - Reference +--- +
{{MDNSidebar}}
+ +

In contrast to the macros listed in Commonly-used macros, the macros documented in this article are used infrequently or only in specific contexts, or are deprecated.

+ +

Special contexts

+ +

These macros are used only with particular contexts, such as a specific API reference.

+ + + +

Landing page components

+ +

We have an assortment of macros that can be used to automatically generate the contents of landing pages. Here they are.

+ +

Lists of subpages

+ + + + + +

We have some macros specifically designed to create quicklinks:

+ + + +

Transclusion

+ +

Transclusion is the embedding of part or all of one page into another. Exercise caution when using this macro, to ensure that the transcluded content makes sense in the context of the page it is embedded into.

+ +

page lets you embed some or all of a specific page into a document. It accepts five parameters:

+ +
    +
  1. The URI of the page to transclude. For example, "/en-US/docs/MDN/About".
  2. +
  3. The name of the section within the page to transclude. This can be specified either as the title string or as the ID of a block to copy over. If not specified, the entire article is transcluded. {{optional_inline}}
  4. +
  5. The revision number of the page version to transclude. This feature is not currently implemented, but would allow including text from specific versions of an article. {{unimplemented_inline}}
  6. +
  7. A Boolean value indicating whether or not to show the heading of the top-level section being transcluded. This is useful if you wish to specify your own heading. The default value is false, meaning the heading is not included by default. {{optional_inline}}
  8. +
  9. The heading level to use as the top heading level. This adjusts the outermost first-discovered level of the transcluded content to the specified number, and all other headings correspondingly. This lets you include content that has its own headings but adjust them to match the heading level at which you're including them. If you don't specify this value, the headings are not adjusted. {{unimplemented_inline}}
  10. +
+ +

Example without heading

+ +

\{{Page("/en-US/docs/MDN/About", "How you can help")}}

+ +

Result:

+ +

{{Page("/en-US/docs/MDN/About", "How you can help")}}

+ +

Example with heading

+ +

\{{Page("/en-US/docs/MDN/About", "How you can help", 0, 1)}}

+ +

Result:

+ +

{{Page("/en-US/docs/MDN/About", "How you can help", 0, 1)}}

+ +

Deprecated

+ +

These macros have been replace by other ways of doing the same thing, and should no longer be used. If you find them in existing articles, please replace them.

+ +

Linking

+ + diff --git a/files/zh-cn/mdn/yari/index.html b/files/zh-cn/mdn/yari/index.html index c48e06b138..07b623bec6 100644 --- a/files/zh-cn/mdn/yari/index.html +++ b/files/zh-cn/mdn/yari/index.html @@ -5,7 +5,6 @@ tags: - Yari - Landing - MDN Meta -translation_of: MDN/Yari ---
{{MDNSidebar}}
diff --git a/files/zh-tw/mdn/yari/index.html b/files/zh-tw/mdn/yari/index.html index 5d3587a166..07b623bec6 100644 --- a/files/zh-tw/mdn/yari/index.html +++ b/files/zh-tw/mdn/yari/index.html @@ -1,27 +1,25 @@ --- -title: 'Kuma: MDN 的維基平台' +title: "Yari: MDN's rendering platform" slug: MDN/Yari tags: - - Kuma + - Yari - Landing - MDN Meta -translation_of: MDN/Kuma -original_slug: MDN/Kuma ---
{{MDNSidebar}}
-
{{IncludeSubnav("/zh-TW/docs/MDN")}}
+

Yari is the code that renders MDN Web Docs. It takes a JAMStack approach, which involves taking the MDN content stored as flat source files in a GitHub repo (which include front matter and macro calls), rendering them out to static HTML files, and serving those as quickly and efficiently as possible.

-

Kuma 是由 MDN Web Docs 維護的 Django 程式碼。

+

The core MDN platform now actually consists of two GitHub repos:

-

{{SubpagesWithSummaries}}

- -

參與 Kuma

+ -

要參與 Kuma:

+

See also

-- cgit v1.2.3-54-g00ecf