Skip to content

Commit c21be2b

Browse files
committed
Auto merge of #13168 - leonzchang:handlebars-v4, r=epage
chore(deps): update rust crate handlebars to `v4.5.0` In the latest version of `handlebars`, rules for whitespace auto elimination is to check if the directive `{{# xxx}}`` and ``{{/ xxx}}` is holding a whole line, with leading and trailing whitespaces counted, and then remove the trailing NEWLINE (See [`template.rs`](https://github.com/sunng87/handlebars-rust/blob/9d7d5556287e31e4148841a56e0981b64a679fb6/src/template.rs#L568-L889)). ```md {{#options}} <--- this newline will be removed after a standalone block {{#option "`-o` _outdir_"}} <--- this newline will be removed Some content {{/option}} <--- this newline will be removed {{/options}} <--- this newline will be removed ``` This PR changes includes (fixes #13162): 1. update `handlebars` crate to `v4.5.0`. 2. add extra NEWLINE to helper blocks `options`, `option` to align with the new strip rules, preserving the original behavior. 3. update doc(the rest handlebars expression) to align with the new strip rules..
2 parents 9a77459 + b96b244 commit c21be2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+68
-441
lines changed

Cargo.lock

Lines changed: 56 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ git2-curl = "0.19.0"
4848
gix = { version = "0.56.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
4949
gix-features-for-configuration-only = { version = "0.35.0", package = "gix-features", features = [ "parallel" ] }
5050
glob = "0.3.1"
51-
handlebars = { version = "3.5.5", features = ["dir_source"] }
51+
handlebars = { version = "4.5.0", features = ["dir_source"] }
5252
hex = "0.4.3"
5353
hmac = "0.12.1"
5454
home = "0.5.5"

crates/mdman/doc/out/mdman.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ man page:
4949
- Other helpers include:
5050
- `{{lower value}}` Converts the given value to lowercase.
5151

52-
5352
## OPTIONS
5453

5554
<dl>

crates/mdman/src/format/md.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ impl super::Formatter for MdFormatter {
3030
}
3131

3232
fn render_options_start(&self) -> &'static str {
33-
"<dl>"
33+
"<dl>\n"
3434
}
3535

3636
fn render_options_end(&self) -> &'static str {
37-
"</dl>"
37+
"</dl>\n"
3838
}
3939

4040
fn render_option(&self, params: &[&str], block: &str, man_name: &str) -> Result<String, Error> {
@@ -67,7 +67,7 @@ impl super::Formatter for MdFormatter {
6767
let rendered_block = self.render_html(block)?;
6868
write!(
6969
result,
70-
"<dd class=\"option-desc\">{}</dd>\n",
70+
"<dd class=\"option-desc\">{}</dd>\n\n",
7171
unwrap_p(&rendered_block)
7272
)?;
7373
Ok(result)

crates/mdman/src/format/text.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ impl super::Formatter for TextFormatter {
2626
fn render_options_start(&self) -> &'static str {
2727
// Tell pulldown_cmark to ignore this.
2828
// This will be stripped out later.
29-
"<![CDATA["
29+
"<![CDATA[\n"
3030
}
3131

3232
fn render_options_end(&self) -> &'static str {
33-
"]]>"
33+
"]]>\n"
3434
}
3535

3636
fn render_option(
@@ -46,7 +46,7 @@ impl super::Formatter for TextFormatter {
4646
let trimmed: Vec<_> = rendered_options.iter().map(|o| o.trim()).collect();
4747
// Wrap in HTML tags, they will be stripped out during rendering.
4848
Ok(format!(
49-
"<dt>{}</dt>\n<dd>{}</dd>\n<br>\n",
49+
"<dt>{}</dt>\n<dd>\n{}</dd>\n<br>\n",
5050
trimmed.join(", "),
5151
block
5252
))

crates/mdman/tests/compare/links.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Shortcut unknown: [shortcut unknown]
3232

3333
{{> links-include}}
3434

35+
3536
## OPTIONS
3637

3738
{{#options}}

crates/mdman/tests/compare/options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ A named argument.
4646

4747
{{> options-common}}
4848

49+
4950
## EXAMPLES
5051

5152
1. An example

crates/mdman/tests/compare/vars.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
{{*set foo="Bar"}}
44

5+
56
{{foo}}
67

78
{{lower foo}}

src/doc/man/cargo-rustc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ See <https://doc.rust-lang.org/rustc/index.html> for documentation on rustc
2424
flags.
2525

2626
{{> description-one-target }}
27+
2728
To pass flags to all compiler processes spawned by Cargo, use the `RUSTFLAGS`
2829
[environment variable](../reference/environment-variables.html) or the
2930
`build.rustflags` [config value](../reference/config.html).

src/doc/man/cargo-rustdoc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ See <https://doc.rust-lang.org/rustdoc/index.html> for documentation on rustdoc
2424
flags.
2525

2626
{{> description-one-target }}
27+
2728
To pass flags to all rustdoc processes spawned by Cargo, use the
2829
`RUSTDOCFLAGS` [environment variable](../reference/environment-variables.html)
2930
or the `build.rustdocflags` [config value](../reference/config.html).

0 commit comments

Comments
 (0)