Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter more than 1 footnote in summary #2017

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/content/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl Page {
self.summary = res
.summary_len
.map(|l| &res.body[0..l])
.map(|s| FOOTNOTES_RE.replace(s, "").into_owned());
.map(|s| FOOTNOTES_RE.replace_all(s, "").into_owned());
self.content = res.body;
self.toc = res.toc;
self.external_links = res.external_links;
Expand Down Expand Up @@ -515,13 +515,17 @@ Hello world
+++
This page use <sup>1.5</sup> and has footnotes, here's one. [^1]

Here's another. [^2]

<!-- more -->

And here's another. [^2]
And here's another. [^3]

[^1]: This is the first footnote.

[^2]: This is the second footnote."#
[^2]: This is the secund footnote.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the spelling error in "second" intentional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secund is a word... but it doesn't fit in that sentence. Maybe auto correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, likely just a typo in my patch, sorry. i was more focused on the Rust code than the text.


[^3]: This is the third footnote."#
.to_string();
let res = Page::parse(Path::new("hello.md"), &content, &config, &PathBuf::new());
assert!(res.is_ok());
Expand All @@ -536,7 +540,7 @@ And here's another. [^2]
.unwrap();
assert_eq!(
page.summary,
Some("<p>This page use <sup>1.5</sup> and has footnotes, here\'s one. </p>\n".to_string())
Some("<p>This page use <sup>1.5</sup> and has footnotes, here\'s one. </p>\n<p>Here's another. </p>\n".to_string())
);
}

Expand Down