andreasKroepelin / polylux

A package for creating slides in Typst
https://polylux.dev/book
MIT License
1.18k stars 55 forks source link

line-by-line support for non tight lists #50

Closed ModProg closed 1 year ago

ModProg commented 1 year ago

a non tight list like:

#line-by-line[
-  a

- b

- c
]

doesn't seam to work corrrectly, this seems to fix it, but feels a bit hacky:

    let idx = start
    let parbreak = none
    for item in items {
        if repr(item.func()) == "parbreak" {
            parbreak = item
        } else if repr(item.func()) != "space" {
            uncover((beginning: idx), mode: mode, {parbreak; item})
            idx += 1
        } else {
            item
        }
    }
andreasKroepelin commented 1 year ago

Well, #line-by-line is kinda hacky anyways :sweat_smile: Maybe we should have something like #polylux-enum, #polylux-list and #polylux-terms kinda like this:

#let polylux-list(start: 1, mode: "invisible", ..args) = {
  let list-kwargs = args.named()
  let items = args.pos()
  list(
    ..list-kwargs,
    ..items.enumerate().map(((idx, item)) => uncover((beginning: idx + start), mode: mode, item))
  )
}
ModProg commented 1 year ago

might make sense