mirror of
https://github.com/typst/typst
synced 2025-07-11 14:42:53 +08:00
Handle lower
and upper
in HTML export (#6585)
This commit is contained in:
parent
98802dde7e
commit
275012d7c6
@ -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>() {
|
||||
|
10
tests/ref/html/cases-content-html.html
Normal file
10
tests/ref/html/cases-content-html.html
Normal 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>
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user