Browse Source

Add test for unterminated shortcode#

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
9d0f84051d
2 changed files with 9 additions and 1 deletions
  1. +8
    -0
      components/rendering/tests/markdown.rs
  2. +1
    -1
      docs/content/documentation/content/shortcodes.md

+ 8
- 0
components/rendering/tests/markdown.rs View File

@@ -162,6 +162,14 @@ Hello
assert!(res.0.contains(r#"//player.vimeo.com/video/210073083""#)); 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] #[test]
fn doesnt_render_shortcode_in_code_block() { fn doesnt_render_shortcode_in_code_block() {
let permalinks_ctx = HashMap::new(); let permalinks_ctx = HashMap::new();


+ 1
- 1
docs/content/documentation/content/shortcodes.md View File

@@ -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 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_]`. 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 ### Shortcodes without body




Loading…
Cancel
Save