-
Notifications
You must be signed in to change notification settings - Fork 1
/
init-slides.sh
executable file
·42 lines (32 loc) · 1.2 KB
/
init-slides.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
DEST=slides.scala
if [ -f "$DEST" ]; then
echo "File $DEST already exists. Exit and delete it if you want to re-generate."
read -p "Enter another file name (or just enter to exit): " DEST
if test -z "$DEST"; then
echo "No file given. Exiting without creating anything."
exit 0
fi
echo "Creating $DEST"
fi
cat > "$DEST" << EOF
//> using scala 3.5.0
//> using dep "taggy:taggy:1.0.1,url=https://github.com/bjornregnell/taggy/releases/download/v1.0.1/taggy_3-1.0.1.jar"
// Above 2 "magic" comments: just copy-paste them, bump Scala version if Latest is newer.
// Latest Scala release here: https://www.scala-lang.org/
// run this command with at least Scala 3.5 in terminal to create slides in target/out.pdf
// scala run .
import taggy.*
@main def run = slides.toPdf()
def slides = document("Taggy Slide Example", author = "Oddput Clementine"):
frame("Greetings in two languages"):
p("Nice greetings:")
itemize:
p("English: Hello world!")
p("Swedish: Hej världen!")
p("By micro-lib https://github.com/bjornregnell/taggy and awesome Scala")
EOF
echo "Compiling and running $DEST using scala"
scala run "$DEST"
echo "Opening pdf-file in target"
xdg-open target/out.pdf