Allow rel attribute in local & footer blurb

Patch from Jaehong Kang <sinoru@me.com>
This commit is contained in:
asonix 2023-07-16 22:32:55 -05:00
parent 7a00229508
commit 9779518dc1

View file

@ -291,7 +291,15 @@ impl Config {
pub(crate) fn footer_blurb(&self) -> Option<crate::templates::Html<String>> { pub(crate) fn footer_blurb(&self) -> Option<crate::templates::Html<String>> {
if let Some(blurb) = &self.footer_blurb { if let Some(blurb) = &self.footer_blurb {
if !blurb.is_empty() { if !blurb.is_empty() {
return Some(crate::templates::Html(ammonia::clean(blurb))); return Some(crate::templates::Html(
ammonia::Builder::new()
.add_tag_attributes("a", &["rel"])
.add_tag_attributes("area", &["rel"])
.add_tag_attributes("link", &["rel"])
.link_rel(None)
.clean(blurb)
.to_string()
));
} }
} }
@ -301,7 +309,15 @@ impl Config {
pub(crate) fn local_blurb(&self) -> Option<crate::templates::Html<String>> { pub(crate) fn local_blurb(&self) -> Option<crate::templates::Html<String>> {
if let Some(blurb) = &self.local_blurb { if let Some(blurb) = &self.local_blurb {
if !blurb.is_empty() { if !blurb.is_empty() {
return Some(crate::templates::Html(ammonia::clean(blurb))); return Some(crate::templates::Html(
ammonia::Builder::new()
.add_tag_attributes("a", &["rel"])
.add_tag_attributes("area", &["rel"])
.add_tag_attributes("link", &["rel"])
.link_rel(None)
.clean(blurb)
.to_string()
));
} }
} }