Handle lower and upper in HTML export (#6585)

This commit is contained in:
Laurenz 2025-07-10 12:54:06 +02:00 committed by GitHub
parent 98802dde7e
commit 275012d7c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View File

@ -86,7 +86,12 @@ fn handle(
} else if child.is::<SpaceElem>() {
output.push(HtmlNode::text(' ', child.span()));
} else if let Some(elem) = child.to_packed::<TextElem>() {
output.push(HtmlNode::text(elem.text.clone(), elem.span()));
let text = if let Some(case) = styles.get(TextElem::case) {
case.apply(&elem.text).into()
} else {
elem.text.clone()
};
output.push(HtmlNode::text(text, elem.span()));
} else if let Some(elem) = child.to_packed::<LinebreakElem>() {
output.push(HtmlElement::new(tag::br).spanned(elem.span()).into());
} else if let Some(elem) = child.to_packed::<SmartQuoteElem>() {

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>my <strong>lower</strong> a<br>MY <strong>UPPER</strong> A<br></p>
</body>
</html>

View File

@ -14,6 +14,10 @@
// Check that cases are applied to symbols nested in content
#lower($H I !$.body)
--- cases-content-html html ---
#lower[MY #html.strong[Lower] #symbol("A")] \
#upper[my #html.strong[Upper] #symbol("a")] \
--- upper-bad-type ---
// Error: 8-9 expected string or content, found integer
#upper(1)