Skip to content

Commit

Permalink
feat: add list support for touying-outline
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed May 11, 2024
1 parent 452583a commit a97111a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils/states.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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)<touying-link>] + 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)<touying-link>])
)
})
Expand Down

0 comments on commit a97111a

Please sign in to comment.