fix relative references

This commit is contained in:
yggverse 2026-03-19 19:14:50 +02:00
parent 04fd8036e3
commit 1c0df42fb4

View file

@ -228,9 +228,15 @@ fn pre_format(data: &str, uploads: &mut HashSet<PathBuf>) -> String {
.captures(&c[1]) .captures(&c[1])
.unwrap()[1] .unwrap()[1]
.trim_start_matches("/") .trim_start_matches("/")
.replace("d/", "")
.into(), .into(),
); );
format!("<img{}>", c[1].replace(" url=", " src=")) format!(
"<img{}>",
c[1].replace(" url=\"/", " src=\"")
.replace(" url=\"d/", " src=\"")
.replace(" url=", " src=")
)
}), }),
"", "",
), ),
@ -242,6 +248,8 @@ fn pre_format(data: &str, uploads: &mut HashSet<PathBuf>) -> String {
.replace("</LIST>", "</ul>") .replace("</LIST>", "</ul>")
.replace("<URL", "<a") .replace("<URL", "<a")
.replace("</URL>", "</a>") .replace("</URL>", "</a>")
.replace(" url=\"/", " href=\"")
.replace(" url=\"d/", " href=\"")
.replace(" url=", " href=") .replace(" url=", " href=")
.replace("<r>", "") .replace("<r>", "")
.replace("</r>", "") .replace("</r>", "")