mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-11 16:30:16 -06:00
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:
@@ -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() };
|
||||
|
||||
Reference in New Issue
Block a user