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() };