summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
authorMichael Färber <01mf02@gmail.com>2025-01-23 13:18:46 +0100
committerGitHub <noreply@github.com>2025-01-23 12:18:46 +0000
commite61cd6fb9e9a90de8d78f05a43246f08feddcf8f (patch)
treeb3f95e4c603ece4d21be1686b82da909ee1e71f0 /crates/typst-library/src
parentdda486a412b31acbf767087c748a62ccc6b510b6 (diff)
Support `start` attribute for `enum` in HTML export (#5676)
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/model/enum.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/typst-library/src/model/enum.rs b/crates/typst-library/src/model/enum.rs
index eb3c2ea4..2d774cbb 100644
--- a/crates/typst-library/src/model/enum.rs
+++ b/crates/typst-library/src/model/enum.rs
@@ -229,19 +229,19 @@ impl Show for Packed<EnumElem> {
if TargetElem::target_in(styles).is_html() {
let mut elem = HtmlElem::new(tag::ol);
if self.reversed(styles) {
- elem =
- elem.with_attr(const { HtmlAttr::constant("reversed") }, "reversed");
+ elem = elem.with_attr(HtmlAttr::constant("reversed"), "reversed");
}
- return Ok(elem
- .with_body(Some(Content::sequence(self.children.iter().map(|item| {
- let mut li = HtmlElem::new(tag::li);
- if let Some(nr) = item.number(styles) {
- li = li.with_attr(attr::value, eco_format!("{nr}"));
- }
- li.with_body(Some(item.body.clone())).pack().spanned(item.span())
- }))))
- .pack()
- .spanned(self.span()));
+ if let Some(n) = self.start(styles).custom() {
+ elem = elem.with_attr(HtmlAttr::constant("start"), eco_format!("{n}"));
+ }
+ let body = Content::sequence(self.children.iter().map(|item| {
+ let mut li = HtmlElem::new(tag::li);
+ if let Some(nr) = item.number(styles) {
+ li = li.with_attr(attr::value, eco_format!("{nr}"));
+ }
+ li.with_body(Some(item.body.clone())).pack().spanned(item.span())
+ }));
+ return Ok(elem.with_body(Some(body)).pack().spanned(self.span()));
}
let mut realized =