From a97111af91a380c2a395f6a4fb736737b67287a2 Mon Sep 17 00:00:00 2001 From: OrangeX4 <318483724@qq.com> Date: Sat, 11 May 2024 16:33:43 +0800 Subject: [PATCH] feat: add list support for touying-outline --- utils/states.typ | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/states.typ b/utils/states.typ index d3e63b797..704b4ca07 100644 --- a/utils/states.typ +++ b/utils/states.typ @@ -65,18 +65,19 @@ callback(sections-state.final(loc)) }) -#let touying-outline(self: none, enum-args: (:), padding: 0pt) = touying-final-sections(sections => { +#let touying-outline(self: none, func: enum, enum-args: (:), list-args: (:), padding: 0pt) = touying-final-sections(sections => { let enum-args = (full: true) + enum-args if self != none and self.numbering != none { enum-args = (numbering: self.numbering) + enum-args } - pad(padding, enum( - ..enum-args, + let args = if func == enum { enum-args } else { list-args } + pad(padding, func( + ..args, ..sections.filter(section => section.loc != none) .map(section => [#link(section.loc, section.title)] + if section.children.filter(it => it.kind != "slide").len() > 0 { let subsections = section.children.filter(it => it.kind != "slide") - enum( - ..enum-args, + func( + ..args, ..subsections.map(subsection => [#link(subsection.loc, subsection.title)]) ) })