mirror of
https://github.com/YGGverse/flarumdown.git
synced 2026-03-31 16:55:29 +00:00
use main image instead of thumb
This commit is contained in:
parent
666a9ce3c4
commit
666b57dffc
1 changed files with 5 additions and 5 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -266,22 +266,22 @@ fn pre_format(data: &str, uploads: &mut HashSet<PathBuf>) -> String {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.replace_all(
|
.replace_all(
|
||||||
&Regex::new(r"<s>[^<]+</s>").unwrap().replace_all(
|
&Regex::new(r"<s>[^<]+</s>").unwrap().replace_all(
|
||||||
&Regex::new(r"(?s)<UPL-IMAGE-PREVIEW([^>]+)>\[[^\]]+\]</UPL-IMAGE-PREVIEW>")
|
&Regex::new(r"(?s)<UPL-IMAGE-PREVIEW[^>]+>([^<]+)</UPL-IMAGE-PREVIEW>")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.replace_all(data, |c: &Captures| {
|
.replace_all(data, |c: &Captures| {
|
||||||
uploads.insert(
|
uploads.insert(
|
||||||
Regex::new(r#"url="([^"]+)""#)
|
Regex::new(r#"url="?([^\s]+)"?"#)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.captures(&c[1])
|
.captures(&c[1])
|
||||||
.unwrap()[1]
|
.unwrap()[1]
|
||||||
.trim_start_matches("/")
|
.trim_start_matches("/")
|
||||||
.replace("d/", "")
|
.trim_start_matches("d/")
|
||||||
.into(),
|
.into(),
|
||||||
);
|
);
|
||||||
format!(
|
format!(
|
||||||
"<img{}>",
|
"<img{}>",
|
||||||
c[1].replace(" url=\"/", " src=\"")
|
c[1].replace(" url=d/", " url=")
|
||||||
.replace(" url=\"d/", " src=\"")
|
.replace(" url=/", " url=")
|
||||||
.replace(" url=", " src=")
|
.replace(" url=", " src=")
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue