Skip to content

Commit

Permalink
Add test files for text block tests. (#3726)
Browse files Browse the repository at this point in the history
  • Loading branch information
geeknoid committed Mar 17, 2019
1 parent a1c8aa7 commit b322ba1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 454 deletions.
8 changes: 4 additions & 4 deletions content/about/contribute/creating-and-editing-pages/index.md
Expand Up @@ -410,12 +410,12 @@ $ kubectl apply -f @samples/bookinfo/networking/virtual-service-reviews-v3.yaml@
It is often useful to display a file or a portion of a file. You can annotate a text file to create named snippets within the file by
using the `$snippet` and `$endsnippet` annotations. For example, you could have a text file that looks like this:

{{< text_file file="examples/snippet_example.txt" syntax="plain" >}}
{{< text_file file="test/snippet_example.txt" syntax="plain" >}}

and in your markdown file, you can then reference a particular snippet with:

{{< text markdown >}}
{{</* text_file file="examples/snippet_example.txt" syntax="plain" snippet="SNIP1" */>}}
{{</* text_file file="test/snippet_example.txt" syntax="plain" snippet="SNIP1" */>}}
{{< /text >}}

where `file` specifies the relative path of the text file within the documentation repo, `syntax` specifies
Expand All @@ -424,15 +424,15 @@ snippet.

The above snippet produces this output:

{{< text_file file="examples/snippet_example.txt" syntax="plain" snippet="SNIP1" >}}
{{< text_file file="test/snippet_example.txt" syntax="plain" snippet="SNIP1" >}}

If you don't specify a snippet name, then the whole file will be inserted instead.

You can specify an optional `downloadas` attribute to control the name that the browser
will use when the user chooses to download the file. For example:

{{< text markdown >}}
{{</* text_file file="examples/snippet_example.txt" syntax="plain" downloadas="foo.txt" */>}}
{{</* text_file file="test/snippet_example.txt" syntax="plain" downloadas="foo.txt" */>}}
{{< /text >}}

If you don't specify the `downloadas` attribute, then the download name is taken from the `file`
Expand Down
Expand Up @@ -375,27 +375,27 @@ $ kubectl apply -f @samples/bookinfo/networking/virtual-service-reviews-v3.yaml@
显示文件或文件的一部分通常很有用。您可以注释文本文件以在文件中创建命名片段
使用 `$snippet``$endsnippet` 注释。例如,您可以使用如下所示的文本文件:

{{< text_file file="examples/snippet_example.txt" syntax="plain" >}}
{{< text_file file="test/snippet_example.txt" syntax="plain" >}}

然后,在您的 markdown 文件中,您可以使用以下内容引用特定代码段:

{{< text markdown >}}
{{</* text_file file="examples/snippet_example.txt" syntax="plain" snippet="SNIP1" */>}}
{{</* text_file file="test/snippet_example.txt" syntax="plain" snippet="SNIP1" */>}}
{{< /text >}}

其中 `file` 指定文档仓库中文本文件的相对路径,`syntax` 指定
用于语法着色的语法(使用 `plain` 表示通用文本),`snippet` 指定的名称片段。

上面的代码片段产生了这个输出:

{{< text_file file="examples/snippet_example.txt" syntax="plain" snippet="SNIP1" >}}
{{< text_file file="test/snippet_example.txt" syntax="plain" snippet="SNIP1" >}}

如果您未指定代码段名称,则会插入整个文件。

您可以指定可选的 `downloadas` 属性来控制浏览器的名称将在用户选择下载文件时使用。例如:

{{< text markdown >}}
{{</* text_file file="examples/snippet_example.txt" syntax="plain" downloadas="foo.txt" */>}}
{{</* text_file file="test/snippet_example.txt" syntax="plain" downloadas="foo.txt" */>}}
{{< /text >}}

如果未指定 `downloadas` 属性,则下载名称取自 `file` 属性。
Expand Down

0 comments on commit b322ba1

Please sign in to comment.