Skip to content

Commit

Permalink
docs: fix styles and escape
Browse files Browse the repository at this point in the history
  • Loading branch information
harttle committed Aug 19, 2024
1 parent b1f0260 commit 5b1658c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/source/tutorials/parse-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ engine.registerTag('random', {
})
```

Rendering `{% random from:2, to:max %}` in scope `{ max: 10 }` will generate a random number in the range [2, 10]. See this JSFiddle: <https://jsfiddle.net/ctj364up/4/>
Rendering `{% raw %}{% random from:2, to:max %}{% endraw %}` in scope `{ max: 10 }` will generate a random number in the range [2, 10]. See this JSFiddle: <https://jsfiddle.net/ctj364up/4/>


[register-tags]: /tutorials/register-filters-tags.html
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorials/render-tag-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Expected output:

Firstly, [register][register-tags] a tag with name `wrap` and parse the content into `this.tpls`. Here in `parse(tagToken, remainTokens)`,

- `tagToken` is current token `{% wrap %}`, and
- `remainTokens` is an array of all tokens following `{% wrap %}` until the end of this template file.
- `tagToken` is current token `{%raw%}{% wrap %}{%endraw%}`, and
- `remainTokens` is an array of all tokens following `{%raw%}{% wrap %}{%endraw%}` until the end of this template file.

Basically, what we need to do is take/`.shift()` enough tags from `remainTokens` until we got a `endwrap` token (the name can be arbitrary, but in convention, we need it to be `endwrap`). And if there's no `endwrap` until the end of template file, we need to throw an tag-not-closed `Error`.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/parse-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ engine.registerTag('random', {
})
```

`{ max: 10 }` 上下文上渲染 `{% random from:2, to:max %}` 将会得到 [2, 10] 范围内的随机数。见这个 JSFiddle:<http://jsfiddle.net/ctj364up/4/>
`{ max: 10 }` 上下文上渲染 `{% raw %}{% random from:2, to:max %}{% endraw %}` 将会得到 [2, 10] 范围内的随机数。见这个 JSFiddle:<http://jsfiddle.net/ctj364up/4/>

[register-tags]: /tutorials/register-filters-tags.html
[Tokenizer]: /api/classes/Tokenizer.html
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/render-tag-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ title: 渲染标签内容

首先 [注册][register-tags] 一个名为 `wrap` 的标签,把内容解析到 `this.tpls` 数组里。`parse(tagToken, remainTokens)` 中,

- `tagToken` 是当前 *Token* `{% wrap %}`
- `tagToken` 是当前 *Token* `{%raw%}{% wrap %}{%endraw%}`
- `remainTokens` 是当前模板中后续所有 *Token* 的数组。

我们要做的是从 `remainTokens` 里拿出来/`.shift()` 足够的标签直到遇到 `endwrap`(其实可以是任意名字,但按照惯例应该叫 `endwrap`)。如果到模板结尾都没遇到 `endwrap`,需要抛出一个标签未关闭的 `Error`
Expand Down
5 changes: 4 additions & 1 deletion docs/themes/navy/source/css/_partial/highlight.styl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ pre
table
margin: 0 !important
border: 0
th, td
.gutter, .code
padding: 0
.gutter
padding-right: 12px
figcaption
clearfix()
margin: -5px 0 5px
Expand All @@ -53,6 +55,7 @@ pre
margin: 0
padding: 0
background: none
white-space: pre
.line
height: 22px

Expand Down
3 changes: 2 additions & 1 deletion docs/themes/navy/source/css/_partial/page.styl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ note-warn = hsl(0, 100%, 50%)
margin: 40px auto
.sidebar-title
border-top: none

.toc-item
list-style: none
.toc-link
@extend .sidebar-link

Expand Down

0 comments on commit 5b1658c

Please sign in to comment.