Skip to content

Commit 7046ffe

Browse files
Adapt to refactoring of nimib (#52)
1 parent 2fe737b commit 7046ffe

12 files changed

Lines changed: 1239 additions & 335 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v2
15-
- uses: iffy/install-nim@v4
15+
- name: apt install
16+
run: sudo apt install -y libpcre3 libblas-dev liblapack-dev
17+
- uses: iffy/install-nim@v5
1618
- name: Generate
1719
run: |
18-
nimble install -y
19-
nimble docsDeps
20+
set -e
21+
nimble install -g nimble
22+
nimble install -y -g https://github.com/zetashift/fontim
23+
nimble install -y -g https://github.com/HugoGranstrom/cdt@0.1.1
24+
nimble sync -y
25+
nimble setup
2026
nimble docs
2127
nimble buildDocs
2228
nimble buildBook

‎.github/workflows/valid.yml‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,28 @@ jobs:
1111
strategy:
1212
matrix:
1313
nim:
14-
- '1.6.x'
1514
- 'stable'
1615
- 'devel'
1716
fail-fast: false
1817
name: Nim ${{ matrix.nim }}
1918
steps:
2019
- uses: actions/checkout@v2
21-
- uses: jiro4989/setup-nim-action@v1
20+
- uses: jiro4989/setup-nim-action@v2.2.2
2221
with:
2322
nim-version: ${{ matrix.nim }}
2423
repo-token: ${{ secrets.GITHUB_TOKEN }}
24+
- run: sudo apt install libpcre3 libpcre3-dev liblapack-dev
25+
- run: nimble install nimble -g
26+
- name: Pre-Install deps
27+
run: |
28+
set -e
29+
nimble install -y https://github.com/zetashift/fontim -g
30+
nimble install -y -g https://github.com/HugoGranstrom/cdt@0.1.1
2531
- name: Install deps
2632
run: |
27-
nimble install -y
28-
nimble docsDeps
33+
set -e
34+
nimble sync -y
35+
nimble setup
2936
- name: Build compiler-docs
3037
run: nimble docs
3138
- name: Build slideshows

‎changelog.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## v0.4.0
4+
- Adapted the code to work with Nimib v0.4.0.
5+
36
## v0.2.2
47
- `columns` now create equally sized columns, no matter the content. (A empty column takes up as much width as one full of content).
58
- `adaptiveColumns` has the behavior of the old `columns` where columns only are as big as their content needs.

‎config.nims‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# begin Nimble config (version 2)
2+
when withDir(thisDir(), system.fileExists("nimble.paths")):
3+
include "nimble.paths"
4+
# end Nimble config

‎docsrc/nimconf2022.nim‎

Lines changed: 17 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,6 @@ import nimiSlides
66
nbInit(theme = revealTheme)
77
nb.useLatex
88

9-
template nbCodeDontRun*(body: untyped) =
10-
newNbCodeBlock("nbCodeDontRun", body):
11-
discard
12-
13-
template nimibCode*(body: untyped) =
14-
#nbText: "Nimib code:"
15-
newNbCodeBlock("nimibCode", body):
16-
discard
17-
fragmentFadeIn:
18-
nbRawHtml: "<hr/>"
19-
#nbText: "Output:"
20-
body
21-
22-
template nimibCodeAnimate*(lines: varargs[seq[HSlice[int, int]]], body: untyped) =
23-
## Shows code and its output just like nbCode, but highlights different lines of the code in the order specified in `lines`.
24-
## lines: Specify which lines to highlight and in which order. (Must be specified as a seq[HSlice])
25-
## Ex:
26-
## ```nim
27-
## animateCode(@[1..1], @[3..4, 6..6]): body
28-
## ```
29-
## This will first highlight line 1, then lines 3, 4 and 6.
30-
newNbCodeBlock("nimibCodeAnimate", body):
31-
var linesString: string
32-
if lines.len > 0:
33-
linesString &= "|"
34-
for lineBundle in lines:
35-
for line in lineBundle:
36-
linesString &= $line.a & "-" & $line.b & ","
37-
linesString &= "|"
38-
if lines.len > 0:
39-
linesString = linesString[0 .. ^3]
40-
nb.blk.context["highlightLines"] = linesString
41-
fragmentFadeIn:
42-
nbRawHtml: "<hr/>"
43-
body
44-
45-
template nimibCodeAnimate*(lines: varargs[HSlice[int, int], toHSlice], body: untyped) =
46-
## Shows code and its output just like nbCode, but highlights different lines of the code in the order specified in `lines`.
47-
## lines: Specify which lines to highlight and in which order. (Must be specified as a HSlice)
48-
## Ex:
49-
## ```nim
50-
## animateCode(1..1, 2..3, 5..5, 4..4): body
51-
## ```
52-
## This will first highlight line 1, then lines 2 and 3, then line 5 and last line 4.
53-
var s: seq[seq[HSlice[int, int]]]
54-
for line in lines:
55-
s.add @[line]
56-
nimibCodeAnimate(s):
57-
body
58-
59-
nb.partials["nimibCode"] = nb.partials["nbCode"]
60-
nb.renderPlans["nimibCode"] = nb.renderPlans["nbCode"]
61-
nb.partials["nimibCodeAnimate"] = nb.partials["animateCode"]
62-
nb.renderPlans["nimibCodeAnimate"] = nb.renderPlans["animateCode"]
63-
64-
template nbCodeDontRunAnimateImpl(body: untyped) =
65-
discard
66-
67-
newAnimateCodeBlock(nbCodeDontRunAnimate, nbCodeDontRunAnimateImpl)
68-
69-
nb.partials["nbCodeDontRun"] = nb.partials["nbCode"]
70-
nb.renderPlans["nbCodeDontRun"] = nb.renderPlans["nbCode"]
71-
nb.partials["nimibCode"] = nb.partials["nbCode"]
72-
nb.renderPlans["nimibCode"] = nb.renderPlans["nbCode"]
73-
749
template nimConfSlide(body: untyped) =
7510
slide:
7611
cornerImage("https://github.com/nim-lang/assets/raw/master/Art/logo-crown.png", UpperRight, size=100, animate=false)
@@ -252,12 +187,12 @@ Text can be *italic*, **bold** or ~~crossed over~~.
252187
nimConfSlide:
253188
nbText: """### Installation"""
254189

255-
nbCodeDontRun:
190+
nbCodeSkip:
256191
nimble install nimiSlides
257192

258193
nimConfSlide:
259194
nbText: "### Setting up"
260-
nbCodeDontRun:
195+
nbCodeSkip:
261196
import nimib, nimiSlides
262197
nbInit(theme = revealTheme)
263198

@@ -273,7 +208,7 @@ Text can be *italic*, **bold** or ~~crossed over~~.
273208
columns:
274209
column:
275210
fragmentFadeIn:
276-
nbCodeDontRunAnimate(1..4, 1..2, 3..4, 6..12, 6, 7..8, 9..10, 11..12):
211+
animateCodeSkip(1..4, 1..2, 3..4, 6..12, 6, 7..8, 9..10, 11..12):
277212
slide:
278213
nbText: "1"
279214
slide:
@@ -431,7 +366,7 @@ slide:
431366
listItem: nbText: "Back again"
432367

433368
nimConfSlide:
434-
nimibCodeAnimate(1, 2..3, 4, 5..6, 7, 9):
369+
animateCode(1, 2..3, 4, 5..6, 7, 9):
435370
unorderedList:
436371
listItem:
437372
nbText: "First item"
@@ -460,7 +395,7 @@ slide:
460395

461396
nimConfAutoSlide:
462397
nbText: "## Columns"
463-
nimibCodeAnimate(1, 2..3, 4..5, 6..7):
398+
animateCode(1, 2..3, 4..5, 6..7):
464399
columns:
465400
column:
466401
nbText: "Left"
@@ -509,7 +444,7 @@ slide:
509444

510445
slide(slideOptions(colorBackground = "darkviolet")):
511446
nbText: "## Color Background"
512-
nbCodeDontRun:
447+
nbCodeSkip:
513448
slide(slideOptions(colorBackground = "darkviolet")):
514449
nbText: "## Color Background"
515450

@@ -518,7 +453,7 @@ slide:
518453

519454
nimConfSlide:
520455
nbText: "## Image Background"
521-
nbCodeDontRun:
456+
nbCodeSkip:
522457
slide(slideOptions(imageBackground = "https://github.com/nim-lang/assets/raw/master/Art/logo-crown.png")):
523458
discard
524459

@@ -527,13 +462,13 @@ slide:
527462

528463
nimConfSlide:
529464
nbText: "## Iframe Background"
530-
nbCodeDontRun:
465+
nbCodeSkip:
531466
slide(slideOptions(iframeBackground = "https://nim-lang.org/")):
532467
discard
533468

534469
nimConfSlide:
535470
nbText: "## Video Background"
536-
nbCodeDontRun:
471+
nbCodeSkip:
537472
slide(slideOptions(videoBackground = "link/to/videofile.mp4")):
538473
discard
539474
fragmentFadeIn:
@@ -575,7 +510,7 @@ slide:
575510
"""
576511

577512
nimConfSlide:
578-
nbCodeDontRunAnimate(1..4, 6..10, 12..17):
513+
animateCodeSkip(1..4, 6..10, 12..17):
579514
slide(slideOptions(autoAnimate=true)):
580515
nbText: """
581516
- First
@@ -639,7 +574,7 @@ slide:
639574
nbText: "## Using Templates"
640575
nimConfAutoSlide:
641576
nbText: "## Using Templates"
642-
nbCodeDontRunAnimate({1, 3, 6}):
577+
animateCodeSkip({1, 3, 6}):
643578
slide(slideOptions(autoAnimate=true)):
644579
nbText: "## Animate header"
645580
slide(slideOptions(autoAnimate=true)):
@@ -654,7 +589,7 @@ slide:
654589

655590
nimConfAutoSlide:
656591
nbText: "## Using Templates"
657-
nbCodeDontRunAnimate(1, 2..3, 3, 5..6):
592+
animateCodeSkip(1, 2..3, 3, 5..6):
658593
template slideAutoAnimate(body: untyped) =
659594
slide(slideOptions(autoAnimate=true)):
660595
body
@@ -667,7 +602,7 @@ slide:
667602
stackElements:
668603
fragment(fadeInThenOut):
669604
nbText: "#### Without template"
670-
nbCodeDontRun:
605+
nbCodeSkip:
671606
slide(slideOptions(autoAnimate=true)):
672607
nbText: "## Animate header"
673608
slide(slideOptions(autoAnimate=true)):
@@ -679,7 +614,7 @@ slide:
679614
nbText: "And this"
680615
fragmentFadeIn:
681616
nbText: "#### With template"
682-
nbCodeDontRun:
617+
nbCodeSkip:
683618
slideAutoAnimate:
684619
nbText: "## Animate header"
685620
slideAutoAnimate:
@@ -698,10 +633,10 @@ slide:
698633
nbText: "Example: Histogram of Gaussian for different N"
699634
nimConfAutoSlide:
700635
nbText: "## Loops ♻️ + Generate images 🖼️"
701-
nbCodeDontRunAnimate(1, 2, 3, 4..7, 9, 10, 11):
636+
animateCodeSkip(1, 2, 3, 4..7, 9, 10, 11):
702637
for n in [50, 100, 1000, 10000]:
703638
let filename = &"images/gauss-{n}.png"
704-
let samples = newSeqWith[float](n, gauss(0.0, 1.0))
639+
let samples = newSeqWith(n, gauss(0.0, 1.0))
705640
let df = toDf(samples)
706641
ggplot(df, aes("samples")) +
707642
geom_histogram(fillColor="green") +
@@ -714,7 +649,7 @@ slide:
714649
slide:
715650
for n in [50, 100, 1000, 10000]:
716651
let filename = &"images/gauss-{n}.png"
717-
let samples = newSeqWith[float](n, gauss(0.0, 1.0))
652+
let samples = newSeqWith(n, gauss(0.0, 1.0))
718653
let df = toDf(samples)
719654
ggplot(df, aes("samples")) +
720655
geom_histogram(fillColor="green") +

0 commit comments

Comments
 (0)