markdown slide presenter
This commit is contained in:
215
reporting/markslider
Executable file
215
reporting/markslider
Executable file
@@ -0,0 +1,215 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=20140416
|
||||
|
||||
function display_self {
|
||||
$0 $0
|
||||
exit 0
|
||||
}
|
||||
[ -z "$1" ] && display_self
|
||||
[ "$1" = "-h" ] && display_self
|
||||
|
||||
[ -f "$1" ] || {
|
||||
echo Cannot find file: $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
E='\x1b['
|
||||
H="${E}1m"
|
||||
Z="${E}0m"
|
||||
CLS="${E}2J${E}H"
|
||||
#list of text colors:
|
||||
BLACK="${E}30m"
|
||||
R="${E}31m"
|
||||
G="${E}32m"
|
||||
B="${E}34m"
|
||||
Y="${E}33m"
|
||||
M="${E}35m"
|
||||
C="${E}36m"
|
||||
W="${E}37m"
|
||||
#list of BG colors:
|
||||
BGR="${E}41m"
|
||||
BGG="${E}42m"
|
||||
BGB="${E}44m"
|
||||
BGY="${E}43m"
|
||||
BGM="${E}45m"
|
||||
BGC="${E}46m"
|
||||
BGW="${E}47m"
|
||||
|
||||
CONF_LINE=( \${H} \${Z} \${R} \${G} \${B} \${Y} \${M} \${C} \${W}
|
||||
\${BLACK} \${BGR} \${BGG} \${BGB} \${BGY} \${BGM} \${BGC} \${BGW} )
|
||||
|
||||
for (( r=0; r<${#CONF_LINE[@]}; r++ ));
|
||||
do value=CONF_LINE[$r]
|
||||
replace=$( eval echo ${!value} )
|
||||
REGEX="$REGEX -e 's/\(${CONF_LINE[$r]}\)/"${replace}"/g'"
|
||||
done
|
||||
#echo $REGEX
|
||||
#exit
|
||||
|
||||
i=1
|
||||
MENU=1
|
||||
while true
|
||||
do
|
||||
# print slide $i
|
||||
NO_SLIDES=$( grep -ce "^# " "$1" )
|
||||
COLS=$(( $( tput cols ) - 3 ))
|
||||
j=$(( $i + 1 ))
|
||||
echo -en "$CLS"
|
||||
awk 'match($0,/^# /){
|
||||
c++;
|
||||
print c $0;
|
||||
}
|
||||
!/^# /{
|
||||
print $0;
|
||||
}
|
||||
' "$1" | sed -n '/^'$i'# /,/^'$j'# /p' | grep -v "^$j# " | sed 's,^'$i'\(# .*\),'$H'\1'$Z',' | eval sed $REGEX
|
||||
# ask for user input
|
||||
# 1 back, 2 forward, q exit, h help
|
||||
echo -ne "${Z}${E}1;${COLS}H"
|
||||
[ -z "$MENU" ] || {
|
||||
echo -ne "${i}/${NO_SLIDES}"
|
||||
echo -ne "${E}1B${E}3D1:▶"
|
||||
echo -ne "${E}1B${E}3D2:◀"
|
||||
echo -ne "${E}1B${E}3Dq:x"
|
||||
echo -ne "${E}1B${E}3Dh:▲${E}4A"
|
||||
}
|
||||
read -s -N 1 cmd
|
||||
|
||||
case "$cmd" in
|
||||
2)
|
||||
i=$(( $i - 1 ))
|
||||
[ $i -lt 1 ] && i=1
|
||||
;;
|
||||
1)
|
||||
i=$(( $i + 1 ))
|
||||
[ $i -gt $NO_SLIDES ] && i=$NO_SLIDES
|
||||
;;
|
||||
h)
|
||||
[ -z "$MENU" ] && {
|
||||
MENU=1
|
||||
} || {
|
||||
unset MENU
|
||||
}
|
||||
;;
|
||||
x|q)
|
||||
echo -ne "${E}1E"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
done
|
||||
exit
|
||||
"
|
||||
# Markdown Slide Presenter: MarkSlider
|
||||
|
||||
* This tool prints a text file as slides,
|
||||
retaining the formatting. Consider
|
||||
using markdown syntax.
|
||||
* Syntax ref: http://daringfireball.net/projects/markdown/syntax
|
||||
* The only parsed syntax is the new slide syntax:
|
||||
A row starting with '# '
|
||||
|
||||
## How to use ##
|
||||
* Give the markdown file as argument
|
||||
* Move to the next slide with key 1
|
||||
* Move to the previous slide with key 2
|
||||
* Exit with q or x
|
||||
* Hide menu with h
|
||||
* The numbers on the right show the current
|
||||
and number of slides in this presentation
|
||||
|
||||
# Hints: Tables
|
||||
|
||||
* Create tables with "ncsv -m"
|
||||
|
||||
Object Area Perimeter
|
||||
------- ----- ----------
|
||||
1 358 68.28
|
||||
2 444 77.36
|
||||
3 507 92.18
|
||||
4 1026 118.6
|
||||
5 539 84.18
|
||||
|
||||
# Hints: Plots
|
||||
* Create plots with gnuplot:
|
||||
set term dumb 60 15 enhanced
|
||||
set parametric; set trange [0:10*pi]; set yrange[-5*pi:5*pi]
|
||||
set xrange[-10*pi:10*pi]; plot t*cos(t), t*sin(t)
|
||||
15 ++-----*-+---**--+--------+-------+**-----*-------++
|
||||
|+ ** + ** + *****t*cos(t), t*sin(t)*******+|
|
||||
| * ** *** *** ** * |
|
||||
10 ++ * ** *** ** ** * ++
|
||||
| ** * ** ******** ** * * |
|
||||
5 ++ * ** * *** ** * ** ** ++
|
||||
| * * * ** ** ** * * |
|
||||
0 ++ * * * * **** * * * * ++
|
||||
| * * * * * ** ** * * *
|
||||
| * * * * ** *** * ** ** *
|
||||
-5 ++ * * * ** ***** ** * * **
|
||||
| * ** * ** *** ** * *|
|
||||
-10 ++ ** * ** *** **** ** * *+
|
||||
| * ** ** ****** ** ** * |
|
||||
|+ * + * *** + *** ** * +|
|
||||
-15 ++----*--+--*----+-**-----+-----**+------*+----*--++
|
||||
-30 -20 -10 0 10 20 30
|
||||
|
||||
# Hints: ${R}Co${Y}lo${G}rs
|
||||
|
||||
* Use ANSI codes for colors, or shortcuts:
|
||||
${R}red: ${ [1DR}, ${G}green: ${ [1DG}, ${B}blue: ${ [1DB}${Z}
|
||||
Other colors: C M Y W BLACK = cyan magenta yellow white black
|
||||
${H}Bright modifier: ${ [1DH}, ex: ${H}${Y}yellow ${ [1DH}${ [1DY}${Z}
|
||||
Background colors:${H}${C}${BGM} bright cyan on magenta ${ [1DH}${ [1DC}${ [1DBGM} ${Z}
|
||||
Other background colors: BGR BGG BGB BGC BGM BGY BGW
|
||||
Reset colors with ${ [1DZ}
|
||||
|
||||
|
||||
# Hints: Presenting
|
||||
|
||||
* Use a terminal with large font, maybe 80 x 30 characters
|
||||
* Fullscreen often with F11
|
||||
┌──────┐
|
||||
* Get creative with │Ascii!│
|
||||
└┬────┬┘
|
||||
|
||||
# Hints: Other tools
|
||||
|
||||
* Check out tools like:
|
||||
* toilet
|
||||
m " ""# m
|
||||
mm#mm mmm mmm # mmm mm#mm
|
||||
# #" "# # # #" # #
|
||||
# # # # # #"""" #
|
||||
"mm "#m#" mm#mm "mm "#mm" "mm
|
||||
* boxes
|
||||
_ ._ _ , _ ._
|
||||
(_ ' ( ` )_ .__)
|
||||
( ( ( ) `) ) _)
|
||||
(__ (_ (_ . _) _) ,__)
|
||||
`~~`\ ' . /`~~`
|
||||
,::: ; ; :::,
|
||||
':::::::::::::::'
|
||||
_jgs______/_ __ \__________
|
||||
| |
|
||||
| MarkSlider |
|
||||
|___________________________|
|
||||
|
||||
# Hints: More tools
|
||||
* JPEG to ascii: jp2a
|
||||
MMMMMNNNNNMNkkk0MMWdll0MMMMMOc,,;cllc;,,
|
||||
MMMMNNNNNMNOkOXMMKolkNMMW0ocdOXWMMMMMMWX
|
||||
MMMNNNNNMNOkONMMkldNMMWx:dXMMMMWKOxxxOKW
|
||||
MMWNNNNMWOkkNMMxlxWMMK;oWMMMXoloOXNWNXOd
|
||||
MMNNNNWM0kkKMMOldMMM0,OMMMNclNMMMMM:WMMM
|
||||
MWNNNNMNkkOWMNllNMMN,xMMMN'KMMMMMMM NMMM
|
||||
MWNNNNMXkk0MM0ldMMMx,WMMM;kMMMMMMMW XMMM
|
||||
MWNNNWMKkk0MMOlxMMMl:MMMM.NMMMMMMMO.xMMM
|
||||
MWNNNNMXkk0MM0ldMMMx,WMMM;kMMMMMMN.; KMM
|
||||
MWNNNNMNkkOWMNllNMMN,xMMMN'KMMMMK..,. 0M
|
||||
MMNNNNWM0kkKMMOldMMM0,OMMMNclNMN:;NMW:;K
|
||||
MMWNNNNMWOkkNMMxlxWMMK;oWMMMXoloOXNWNXOd
|
||||
MMMNNNNNMNOkONMMkldNMMWx:dXMMMMWKOxxxOKW
|
||||
MMMMNNNNNMNOkOXMMKolkNMMW0ocdOXWMMMMMMWX
|
||||
MMMMMNNNNNMNkkkKMMWdll0MMMMMOc,,;cllc;,,
|
||||
Reference in New Issue
Block a user