From 9d0f84051d1280f3c560ce6ba2d2a8c73301ec20 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Mon, 23 Oct 2017 15:54:32 +0200 Subject: [PATCH] Add test for unterminated shortcode# --- components/rendering/tests/markdown.rs | 8 ++++++++ docs/content/documentation/content/shortcodes.md | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/rendering/tests/markdown.rs b/components/rendering/tests/markdown.rs index 3c6d2e63..e7687bc1 100644 --- a/components/rendering/tests/markdown.rs +++ b/components/rendering/tests/markdown.rs @@ -162,6 +162,14 @@ Hello assert!(res.0.contains(r#"//player.vimeo.com/video/210073083""#)); } +#[test] +fn errors_if_unterminated_shortcode() { + let permalinks_ctx = HashMap::new(); + let context = Context::new(&GUTENBERG_TERA, true, "base16-ocean-dark".to_string(), "", &permalinks_ctx, InsertAnchor::None); + let res = markdown_to_html(r#"{{ youtube(id="w7Ft2ym_a"#, &context); + assert!(res.is_err()); +} + #[test] fn doesnt_render_shortcode_in_code_block() { let permalinks_ctx = HashMap::new(); diff --git a/docs/content/documentation/content/shortcodes.md b/docs/content/documentation/content/shortcodes.md index acb2f803..32060c24 100644 --- a/docs/content/documentation/content/shortcodes.md +++ b/docs/content/documentation/content/shortcodes.md @@ -45,7 +45,7 @@ Any shortcodes in code blocks will be ignored. Lastly, a shortcode name (and thus the corresponding `.html` file) as well as the arguments name can only contain numbers, letters and underscores, or in Regex terms the following: `[0-9A-Za-z_]`. -While theoretically an argument name could be a number, it will not be possible to use in the template. +While theoretically an argument name could be a number, it will not be possible to use it in the template in that case. ### Shortcodes without body