From 88a45f5d586ad38d79f9cee23b350d2a6455ef1d Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 8 Nov 2026 06:10:10 +0100 Subject: [PATCH] Apply typographic quotes when xref format has an unterminated '<' Found while testing crates/doc/src/xref.rs:~100 (expand, early `return out` in the `tag_end` None branch) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/doc/src/xref.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/doc/src/xref.rs b/crates/doc/src/xref.rs index 080112c2f..cd518c02c 100644 --- a/crates/doc/src/xref.rs +++ b/crates/doc/src/xref.rs @@ -101,7 +101,8 @@ pub fn expand(definition: &str, v: &XrefValues) -> String { out.push_str(&rest[..i]); let Some(j) = tag_end(&rest[i..]) else { out.push_str(&rest[i..]); - return out; + rest = ""; + break; }; let tag = rest[i + 1..i + j].trim().trim_end_matches('/').trim(); let name = tag.split_whitespace().next().unwrap_or(""); @@ -452,6 +453,12 @@ mod tests { assert_eq!(expand("\" includeDelim=\"false\" />|", &v), "Intro |"); } + #[test] + fn unterminated_lt_still_gets_typographic_quotes() { + let v = XrefValues { para: "Intro".into(), ..Default::default() }; + assert_eq!(expand("\"\" <", &v), "\u{201C}Intro\u{201D} <"); + } + #[test] fn unterminated_quote_only_affects_its_own_tag() { let v = XrefValues { para: "Intro > the start".into(), ..Default::default() };