diff --git a/CHANGELOG.md b/CHANGELOG.md index d23b6559..b950bce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,9 @@ - Gutenberg has changed name to REPLACE_ME! - Update dependencies, fixing a few bugs with templates -- Make Gutenberg load only .html files in themes from the templates folder +- Load only .html files in themes from the templates folder - Background colour is set fewer times when highlighting syntaxes - +- Link checker will not try to validate email links anymore ## 0.4.2 (2018-09-03) diff --git a/components/rendering/src/markdown.rs b/components/rendering/src/markdown.rs index 9a9095b9..f512bd99 100644 --- a/components/rendering/src/markdown.rs +++ b/components/rendering/src/markdown.rs @@ -160,7 +160,9 @@ pub fn markdown_to_html(content: &str, context: &RenderContext) -> Result\n$ gutenberg server\n$ ping\n" + "
\n$ gutenberg server\n$ ping\n
" ); } @@ -61,7 +61,7 @@ fn can_highlight_code_block_with_lang() { let res = render_content("```python\nlist.append(1)\n```", &context).unwrap(); assert_eq!( res.body, - "
\nlist.append(1)\n
" + "
\nlist.append(1)\n
" ); } @@ -75,7 +75,7 @@ fn can_higlight_code_block_with_unknown_lang() { // defaults to plain text assert_eq!( res.body, - "
\nlist.append(1)\n
" + "
\nlist.append(1)\n
" ); } @@ -564,6 +564,32 @@ fn can_show_error_message_for_invalid_external_links() { assert!(err.description().contains("Link http://google.comy is not valid")); } +#[test] +fn doesnt_try_to_validate_email_links_mailto() { + let permalinks_ctx = HashMap::new(); + let mut config = Config::default(); + config.check_external_links = true; + let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None); + let res = render_content("Email: [foo@bar.baz](mailto:foo@bar.baz)", &context).unwrap(); + assert_eq!( + res.body, + "

Email: foo@bar.baz

\n" + ); +} + +#[test] +fn doesnt_try_to_validate_email_links_angled_brackets() { + let permalinks_ctx = HashMap::new(); + let mut config = Config::default(); + config.check_external_links = true; + let context = RenderContext::new(&GUTENBERG_TERA, &config, "https://vincent.is/about/", &permalinks_ctx, Path::new("something"), InsertAnchor::None); + let res = render_content("Email: ", &context).unwrap(); + assert_eq!( + res.body, + "

Email: foo@bar.baz

\n" + ); +} + #[test] fn can_handle_summaries() { let tera_ctx = Tera::default(); diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs index aebcb269..a1c79735 100644 --- a/components/site/tests/site.rs +++ b/components/site/tests/site.rs @@ -454,5 +454,5 @@ fn can_build_with_extra_syntaxes() { assert!(&public.exists()); assert!(file_exists!(public, "posts/extra-syntax/index.html")); assert!(file_contains!(public, "posts/extra-syntax/index.html", - r#"test"#)); + r#"test"#)); }