parent
7c75232a74
commit
b4158921dd
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
- Gutenberg has changed name to REPLACE_ME!
|
- Gutenberg has changed name to REPLACE_ME!
|
||||||
- Update dependencies, fixing a few bugs with templates
|
- 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
|
- 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)
|
## 0.4.2 (2018-09-03)
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,9 @@ pub fn markdown_to_html(content: &str, context: &RenderContext) -> Result<Render
|
||||||
} else if is_colocated_asset_link(&link) {
|
} else if is_colocated_asset_link(&link) {
|
||||||
format!("{}{}", context.current_page_permalink, link)
|
format!("{}{}", context.current_page_permalink, link)
|
||||||
} else {
|
} else {
|
||||||
if context.config.check_external_links && !link.starts_with('#') {
|
if context.config.check_external_links
|
||||||
|
&& !link.starts_with('#')
|
||||||
|
&& !link.starts_with("mailto:") {
|
||||||
let res = check_url(&link);
|
let res = check_url(&link);
|
||||||
if res.is_valid() {
|
if res.is_valid() {
|
||||||
link.to_string()
|
link.to_string()
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn can_highlight_code_block_no_lang() {
|
||||||
let res = render_content("```\n$ gutenberg server\n$ ping\n```", &context).unwrap();
|
let res = render_content("```\n$ gutenberg server\n$ ping\n```", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.body,
|
res.body,
|
||||||
"<pre style=\"background-color:#2b303b\">\n<span style=\"background-color:#2b303b;color:#c0c5ce;\">$ gutenberg server\n</span><span style=\"background-color:#2b303b;color:#c0c5ce;\">$ ping\n</span></pre>"
|
"<pre style=\"background-color:#2b303b\">\n<span style=\"color:#c0c5ce;\">$ gutenberg server\n</span><span style=\"color:#c0c5ce;\">$ ping\n</span></pre>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ fn can_highlight_code_block_with_lang() {
|
||||||
let res = render_content("```python\nlist.append(1)\n```", &context).unwrap();
|
let res = render_content("```python\nlist.append(1)\n```", &context).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.body,
|
res.body,
|
||||||
"<pre style=\"background-color:#2b303b\">\n<span style=\"background-color:#2b303b;color:#c0c5ce;\">list.</span><span style=\"background-color:#2b303b;color:#bf616a;\">append</span><span style=\"background-color:#2b303b;color:#c0c5ce;\">(</span><span style=\"background-color:#2b303b;color:#d08770;\">1</span><span style=\"background-color:#2b303b;color:#c0c5ce;\">)\n</span></pre>"
|
"<pre style=\"background-color:#2b303b\">\n<span style=\"color:#c0c5ce;\">list.</span><span style=\"color:#bf616a;\">append</span><span style=\"color:#c0c5ce;\">(</span><span style=\"color:#d08770;\">1</span><span style=\"color:#c0c5ce;\">)\n</span></pre>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ fn can_higlight_code_block_with_unknown_lang() {
|
||||||
// defaults to plain text
|
// defaults to plain text
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
res.body,
|
res.body,
|
||||||
"<pre style=\"background-color:#2b303b\">\n<span style=\"background-color:#2b303b;color:#c0c5ce;\">list.append(1)\n</span></pre>"
|
"<pre style=\"background-color:#2b303b\">\n<span style=\"color:#c0c5ce;\">list.append(1)\n</span></pre>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,6 +564,32 @@ fn can_show_error_message_for_invalid_external_links() {
|
||||||
assert!(err.description().contains("Link http://google.comy is not valid"));
|
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,
|
||||||
|
"<p>Email: <a href=\"mailto:foo@bar.baz\">foo@bar.baz</a></p>\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: <foo@bar.baz>", &context).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
res.body,
|
||||||
|
"<p>Email: <a href=\"mailto:foo@bar.baz\">foo@bar.baz</a></p>\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_handle_summaries() {
|
fn can_handle_summaries() {
|
||||||
let tera_ctx = Tera::default();
|
let tera_ctx = Tera::default();
|
||||||
|
|
|
@ -454,5 +454,5 @@ fn can_build_with_extra_syntaxes() {
|
||||||
assert!(&public.exists());
|
assert!(&public.exists());
|
||||||
assert!(file_exists!(public, "posts/extra-syntax/index.html"));
|
assert!(file_exists!(public, "posts/extra-syntax/index.html"));
|
||||||
assert!(file_contains!(public, "posts/extra-syntax/index.html",
|
assert!(file_contains!(public, "posts/extra-syntax/index.html",
|
||||||
r#"<span style="background-color:#2b303b;color:#d08770;">test</span>"#));
|
r#"<span style="color:#d08770;">test</span>"#));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue