From 664cb14ffd22bad6e0073eb27cd4dd85f4f599f0 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Wed, 23 Sep 2020 19:21:21 +0200 Subject: [PATCH] Add test for continue reading after shortcode --- components/rendering/tests/markdown.rs | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/components/rendering/tests/markdown.rs b/components/rendering/tests/markdown.rs index 3b1c6499..e37f9212 100644 --- a/components/rendering/tests/markdown.rs +++ b/components/rendering/tests/markdown.rs @@ -937,7 +937,7 @@ Bla bla"#;

Bla bla

"#; - tera.add_raw_template(&format!("shortcodes/{}.md", "quote"), shortcode).unwrap(); + tera.add_raw_template("shortcodes/quote.md", shortcode).unwrap(); let config = Config::default(); let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); @@ -1003,3 +1003,36 @@ fn can_render_commented_out_shortcodes_fine() { let res = render_content(markdown_string, &context).unwrap(); assert_eq!(res.body, expected); } + + +// https://zola.discourse.group/t/zola-12-issue-with-continue-reading/590/7 +#[test] +fn can_render_read_more_after_shortcode() { + let permalinks_ctx = HashMap::new(); + let mut tera = Tera::default(); + tera.extend(&ZOLA_TERA).unwrap(); + + let shortcode = r#"

Quote: {{body}}

"#; + let markdown_string = r#" +# Title + +Some text +{{ quote(body="Nothing is impossible. The word itself says - I'm Possible" author="Audrey Hepburn")}} + + +Again more text"#; + + let expected = r#"

Title

+

Some text

+

Quote: Nothing is impossible. The word itself says - I'm Possible

+ +

Again more text

+"#; + + tera.add_raw_template("shortcodes/quote.md", shortcode).unwrap(); + let config = Config::default(); + let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); + + let res = render_content(markdown_string, &context).unwrap(); + assert_eq!(res.body, expected); +}