nimiSlides icon indicating copy to clipboard operation
nimiSlides copied to clipboard

a template for generating slide templates with identifier

Open pietroppeter opened this issue 3 months ago • 3 comments

I am yet again making a new set of slides with nimislides (public soon) and as usual I try to innovate a bit my workflow.

For this feature request it is harder to make a title for this feature (and even harder to understand the title) than an example:

import nimib, nimislides

template slide(ident: untyped, body: untyped) =
  template `slide ident` =
    slide:
      body

# I use this idiom currently
template slideTitleAlt =
  slide:
    nbText: "## My title slide"

# and this is sugar for this idiom
slide(Title):
  nbText: "## My title slide (but using a template)"

when isMainModule:
  nbInit(theme = revealTheme)
  setSlidesTheme(Serif)
  # having slides called here makes it easier to add them and remove them while creating a presentation
  slideTitle
  slideTitleAlt
  nbSave

the proposal is to introduce the template slide(ident: untyped, body: untyped) as above to allow the isMainModule workflow with reduced indentation. Ah in the example above I did not use it but I would probably export the template by default (since it can be used from different sets of slides).

pietroppeter avatar Mar 14 '24 09:03 pietroppeter