Compare commits
3 commits
d9528d5895
...
8bf1be32fe
Author | SHA1 | Date | |
---|---|---|---|
8bf1be32fe | |||
73c28e5e76 | |||
e9441dba46 |
4 changed files with 465 additions and 512 deletions
20
.forgejo/workflows/pr-check.yml
Normal file
20
.forgejo/workflows/pr-check.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: PR Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
lint-and-format:
|
||||
container:
|
||||
image: rust:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run format check
|
||||
run: cargo fmt --check
|
||||
|
||||
- name: Run Clippy
|
||||
run: cargo clippy
|
874
Cargo.lock
generated
874
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -21,12 +21,12 @@ serde_json = "1.0"
|
|||
minify-html = "0.15"
|
||||
minify-js = "0.6"
|
||||
glob = "0.3"
|
||||
comrak = "0.28"
|
||||
comrak = "0.29"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
chrono = { version = "0.4.38", default-features = false, features = ["clock"]}
|
||||
chrono-tz = "0.10"
|
||||
rss = { version = "2.0", features = ["atom"] }
|
||||
lol_html = "1.2"
|
||||
lol_html = "2.0"
|
||||
base64 = "0.22"
|
||||
mime_guess = "2.0"
|
||||
urlencoding = "2.1"
|
||||
|
|
|
@ -230,8 +230,10 @@ fn fix_images_and_integration(path: &str, html: &str) -> (String, Metadata) {
|
|||
mail_obfsucated: false,
|
||||
};
|
||||
|
||||
(
|
||||
rewrite_str(
|
||||
// Collection of any additional metadata
|
||||
let mut additional_metadata = Vec::new();
|
||||
|
||||
let result = rewrite_str(
|
||||
html,
|
||||
RewriteStrSettings {
|
||||
element_content_handlers: vec![element!("img", |el| {
|
||||
|
@ -252,24 +254,29 @@ fn fix_images_and_integration(path: &str, html: &str) -> (String, Metadata) {
|
|||
Some(options),
|
||||
);
|
||||
el.replace(&data.content, ContentType::Html);
|
||||
metadata.merge(&data.metadata);
|
||||
|
||||
// Store the metadata for later merging
|
||||
additional_metadata.push(data.metadata);
|
||||
} else {
|
||||
let image = general_purpose::STANDARD.encode(file);
|
||||
|
||||
el.set_attribute("src", &format!("data:{mime};base64,{image}"))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})],
|
||||
..RewriteStrSettings::default()
|
||||
},
|
||||
)
|
||||
.unwrap(),
|
||||
metadata,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Merge all collected metadata
|
||||
for additional in additional_metadata {
|
||||
metadata.merge(&additional);
|
||||
}
|
||||
|
||||
(result, metadata)
|
||||
}
|
||||
|
||||
/// Transform markdown string to File structure
|
||||
|
|
Loading…
Reference in a new issue