+22
-9
shlide
+22
-9
shlide
···
5
6
# Color definitions
7
8
-
BLK="\e[30m"
9
-
RED="\e[31m"
10
-
GRN="\e[32m"
11
-
YLW="\e[33m"
12
-
BLU="\e[34m"
13
-
PUR="\e[35m"
14
-
CYN="\e[36m"
15
RST="\e[0m"
16
17
lines() {
···
27
printf '%s\n' "$max"
28
}
29
30
display() {
31
# 1 - slide contents
32
# 2 - slide name
···
62
reduce=0
63
# Print the contents of the slide file,
64
# line by line.
65
-
printf "%s" "$line"
66
case $line in
67
"" | *"\n"*)
68
((++reduce));;
69
esac
70
# Move down and back after each print.
71
-
printf '\e[%sD\e[B' "$((${#line} - $reduce))"
72
done <<< "$slide_contents"
73
74
}
···
5
6
# Color definitions
7
8
+
BLK="\e[38;5;30m"
9
+
RED="\e[38;5;31m"
10
+
GRN="\e[38;5;32m"
11
+
YLW="\e[38;5;33m"
12
+
BLU="\e[38;5;34m"
13
+
PUR="\e[38;5;35m"
14
+
CYN="\e[38;5;36m"
15
RST="\e[0m"
16
17
lines() {
···
27
printf '%s\n' "$max"
28
}
29
30
+
colorify() {
31
+
eval "declare dummy=\"$1\""
32
+
printf '%b' "$dummy"
33
+
}
34
+
35
+
shopt -s extglob
36
+
ansi_filter() {
37
+
local IFS=
38
+
echo "${1//$'\e'[\[(]*([0-9;])[@-n]/}"
39
+
}
40
+
41
display() {
42
# 1 - slide contents
43
# 2 - slide name
···
73
reduce=0
74
# Print the contents of the slide file,
75
# line by line.
76
+
l=$(colorify "$line")
77
+
printf '%s' "$l"
78
case $line in
79
"" | *"\n"*)
80
((++reduce));;
81
esac
82
# Move down and back after each print.
83
+
l=$(ansi_filter "$l")
84
+
printf '\e[%sD\e[B' "$((${#l} - $reduce))"
85
done <<< "$slide_contents"
86
87
}