parent
e9d59239d6
commit
4571b067ea
|
@ -54,7 +54,7 @@ ignored_sc_body_start = !{ "{%/*" ~ sc_def ~ "*/%}" }
|
||||||
ignored_sc_body_end = !{ "{%/*" ~ "end" ~ "*/%}" }
|
ignored_sc_body_end = !{ "{%/*" ~ "end" ~ "*/%}" }
|
||||||
|
|
||||||
shortcode_with_body = !{ sc_body_start ~ text_in_body_sc ~ sc_body_end }
|
shortcode_with_body = !{ sc_body_start ~ text_in_body_sc ~ sc_body_end }
|
||||||
ignored_shortcode_with_body = !{ ignored_sc_body_start ~ text_in_ignored_body_sc ~ ignored_sc_body_end }
|
ignored_shortcode_with_body = { ignored_sc_body_start ~ text_in_ignored_body_sc ~ ignored_sc_body_end }
|
||||||
|
|
||||||
text_in_body_sc = ${ (!(sc_body_end) ~ any)+ }
|
text_in_body_sc = ${ (!(sc_body_end) ~ any)+ }
|
||||||
text_in_ignored_body_sc = ${ (!(ignored_sc_body_end) ~ any)+ }
|
text_in_ignored_body_sc = ${ (!(ignored_sc_body_end) ~ any)+ }
|
||||||
|
|
|
@ -310,6 +310,16 @@ Hello World
|
||||||
assert_eq!(res, "\nHello World\n{% youtube() %}Some body {{ hello() }}{% end %}");
|
assert_eq!(res, "\nHello World\n{% youtube() %}Some body {{ hello() }}{% end %}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/Keats/gutenberg/issues/383
|
||||||
|
#[test]
|
||||||
|
fn unignore_shortcode_with_body_does_not_swallow_initial_whitespace() {
|
||||||
|
let res = render_shortcodes(r#"
|
||||||
|
Hello World
|
||||||
|
{%/* youtube() */%}
|
||||||
|
Some body {{ hello() }}{%/* end */%}"#, &Tera::default());
|
||||||
|
assert_eq!(res, "\nHello World\n{% youtube() %}\nSome body {{ hello() }}{% end %}");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_parse_shortcode_arguments() {
|
fn can_parse_shortcode_arguments() {
|
||||||
let inputs = vec![
|
let inputs = vec![
|
||||||
|
|
Loading…
Reference in a new issue