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

Fix HTML encoding bug with inline metadata #758

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Character Tests > Pagefind handles HTML entities in inline meta
steps:
- ref: ./background.toolproof.yml
- step: I have a "public/apiary/index.html" file with the content {html}
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><h1
data-pagefind-meta="title:The &quot;bees&quot;">the bees</h1></body></html>
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
- step: In my browser, I load "/"
- step: In my browser, I evaluate {js}
js: >-
let pagefind = await import("/pagefind/pagefind.js");


let search = await pagefind.search("bees");


let pages = await Promise.all(search.results.map(r => r.data()));

document.querySelector('[data-result]').innerText = pages.map(p =>
p.meta.title).join(", ");
- step: In my browser, the console should be empty
- step: In my browser, I evaluate {js}
js: |-
let val = await toolproof.querySelector("[data-result]");
toolproof.assert_eq(val.innerHTML, `The "bees"`);
2 changes: 1 addition & 1 deletion pagefind/src/fossick/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ fn parse_attr_string(input: String, el: &Element) -> Vec<String> {
impl DomParsingNode {
fn get_attribute_pair(&self, input: &str) -> Option<(String, String)> {
match input.split_once(':') {
Some((filter, value)) => Some((filter.to_owned(), value.to_owned())),
Some((filter, value)) => Some((filter.to_owned(), normalize_content(&value))),
None => {
if self.current_value.is_empty() {
None
Expand Down
Loading