Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add column-gap parameter #36

Merged
merged 8 commits into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/nimiSlides.nim
Original file line number Diff line number Diff line change
Expand Up @@ -541,16 +541,28 @@ template align*(text: string, body: untyped) =
body
nbRawHtml: "</div>"

template columns*(body: untyped) =
nbRawHtml: """<div style="display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow-wrap: break-word;">"""
#templates can't have default args and untyped args at the same time
#so we use overloading to get the same effect

template columns*(columnGap: float, body: untyped) =
#tempted to use fmt"", but strformat doesn't support template args in the format string
quimt marked this conversation as resolved.
Show resolved Hide resolved
nbRawHtml: """<div style="display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow-wrap: break-word; column-gap: $1 em;">
""" % $columnGap
body
nbRawHtml: "</div>"

quimt marked this conversation as resolved.
Show resolved Hide resolved
template adaptiveColumns*(body: untyped) =
nbRawHtml: """<div style="display: grid; grid-auto-flow: column; overflow-wrap: break-word;">"""
template columns*(body: untyped) =
columns(1.0,body)

template adaptiveColumns*(columnGap: float, body: untyped) =
nbRawHtml: """<div style="display: grid; grid-auto-flow: column; overflow-wrap: break-word; column-gap: $1 em;">
""" % $columnGap
body
nbRawHtml: "</div>"

template adaptiveColumns*(body: untyped) =
adaptiveColumns(1.0,body)

template column*(bodyInner: untyped) =
## column should always be used inside a `columns` block
nbRawHtml: "<div>"
Expand Down
Loading