Change continue-reading to use a span with id instead of a named anchor in a paragraph (#941)

* Change continue-reading to use a span element instead of named anchor

* Fix all tests
This commit is contained in:
Aphek 2020-02-07 17:07:10 -03:00 committed by GitHub
parent ac3ced828b
commit cc67bf0c88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View file

@ -17,8 +17,7 @@ use utils::vec::InsertMany;
use self::cmark::{Event, LinkType, Options, Parser, Tag}; use self::cmark::{Event, LinkType, Options, Parser, Tag};
const CONTINUE_READING: &str = const CONTINUE_READING: &str = "<span id=\"continue-reading\"></span>";
"<p id=\"zola-continue-reading\"><a name=\"continue-reading\"></a></p>\n";
const ANCHOR_LINK_TEMPLATE: &str = "anchor-link.html"; const ANCHOR_LINK_TEMPLATE: &str = "anchor-link.html";
#[derive(Debug)] #[derive(Debug)]

View file

@ -757,7 +757,7 @@ Bla bla
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
res.body, res.body,
"<p>Hello <a href=\"https://vincentprouillet.com\">My site</a></p>\n<p id=\"zola-continue-reading\"><a name=\"continue-reading\"></a></p>\n<p>Bla bla</p>\n" "<p>Hello <a href=\"https://vincentprouillet.com\">My site</a></p>\n<span id=\"continue-reading\"></span>\n<p>Bla bla</p>\n"
); );
assert_eq!( assert_eq!(
res.summary_len, res.summary_len,

View file

@ -239,11 +239,11 @@ fn can_build_site_with_live_reload_and_drafts() {
// no live reload code // no live reload code
assert!(file_contains!(public, "index.html", "/livereload.js")); assert!(file_contains!(public, "index.html", "/livereload.js"));
// the summary anchor link has been created // the summary target has been created
assert!(file_contains!( assert!(file_contains!(
public, public,
"posts/python/index.html", "posts/python/index.html",
r#"<a name="continue-reading"></a>"# r#"<span id="continue-reading"></span>"#
)); ));
// Drafts are included // Drafts are included

View file

@ -141,6 +141,5 @@ where you want the summary to end. The content up to that point will be
available separately in the available separately in the
[template](@/documentation/templates/pages-sections.md#page-variables). [template](@/documentation/templates/pages-sections.md#page-variables).
An anchor link to this position named `continue-reading` is created, wrapped in a paragraph A span element in this position with a `continue-reading` id is created, so you can link directly to it if needed. For example:
with a `zola-continue-reading` id, so you can link directly to it if needed. For example:
`<a href="{{ page.permalink }}#continue-reading">Continue Reading</a>`. `<a href="{{ page.permalink }}#continue-reading">Continue Reading</a>`.