Skip to content

Commit

Permalink
fix(templ): htmlelement/htmlxref don't lowercase
Browse files Browse the repository at this point in the history
This was producing invalid urls in some cases.
  • Loading branch information
fiji-flo committed Feb 13, 2025
1 parent d2930a0 commit 4e331b3
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions crates/rari-doc/src/templ/templs/links/htmlxref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::borrow::Cow;

use rari_templ_func::rari_f;
use rari_types::AnyArg;

Expand All @@ -13,16 +11,11 @@ pub fn htmlxref(
anchor: Option<String>,
_: Option<AnyArg>,
) -> Result<String, DocError> {
let display = display.as_deref().filter(|s| !s.is_empty());
let element_name = element_name.to_lowercase();
let display = display.filter(|s| !s.is_empty());
let mut code = false;
let display = display.map(Cow::Borrowed).unwrap_or_else(|| {
if element_name.contains(' ') {
Cow::Borrowed(element_name.as_str())
} else {
code = true;
Cow::Owned(format!("&lt;{element_name}&gt;"))
}
let display = display.unwrap_or_else(|| {
code = true;
format!("&lt;{element_name}&gt;")
});
let mut url = format!(
"/{}/docs/Web/HTML/Element/{}",
Expand Down

0 comments on commit 4e331b3

Please sign in to comment.