Skip to content

Commit

Permalink
fix(templ): escapte titles
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Oct 7, 2024
1 parent 0d6b6ec commit a0cdc7a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/rari-doc/src/html/links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn render_internal_link(
}
if let Some(title) = title {
out.push_str("\" title=\"");
out.push_str(title);
out.push_str(&html_escape::encode_quoted_attribute(title));
}
if modifier.only_en_us {
out.push_str("\" class=\"only-in-en-us")
Expand Down Expand Up @@ -157,7 +157,7 @@ pub fn render_link_via_page(
out.push_str(&url);
if let Some(title) = title {
out.push_str("\" title=\"");
out.push_str(title);
out.push_str(&html_escape::encode_quoted_attribute(title));
}
out.push_str("\">");
if code {
Expand Down
1 change: 1 addition & 0 deletions crates/rari-doc/src/templ/templs/badges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub fn write_badge(
abbreviation: &str,
typ: &str,
) -> std::fmt::Result {
let title = html_escape::encode_quoted_attribute(title);
write!(
out,
r#"<abbr class="icon icon-{typ}" title="{title}">
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/embeds/livesample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn live_sample(
let id = RariApi::anchorize(&id);
let mut out = String::new();
out.push_str(r#"<div class="code-example"><div class="example-header"></div><iframe class="sample-code-frame" title=""#);
out.push_str(&title);
out.push_str(&html_escape::encode_quoted_attribute(&title));
out.push_str(r#" sample" id="frame_"#);
out.push_str(&id);
out.push_str(r#"" "#);
Expand Down

0 comments on commit a0cdc7a

Please sign in to comment.