Merge pull request #2464 from Silvertree2010/fix/h10935-cross-reference-format-with-an-u

Apply typographic quotes when xref format has an unterminated '<'
This commit is contained in:
aiongg authored and GitHub committed 2026-11-08 00:24:05 -05:00
commit d848948b11
1 file changed
+8 -1
+8 -1
View File
@@ -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("<partialPara delim=\">\" includeDelim=\"false\" />|", &v), "Intro |");
}
#[test]
fn unterminated_lt_still_gets_typographic_quotes() {
let v = XrefValues { para: "Intro".into(), ..Default::default() };
assert_eq!(expand("\"<paraText />\" <", &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() };