new features to markslider

This commit is contained in:
ville rantanen
2014-04-17 09:54:06 +03:00
parent e7d42d706d
commit 1ac9896403

View File

@@ -1,6 +1,6 @@
#!/bin/bash
VERSION=20140416
VERSION=20140417
function display_self {
$0 $0
@@ -24,12 +24,12 @@ function display_slide {
!/^# /{
print $0;
}
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep -v "^$j# " | sed 's,^'$i'\(# .*\),'$H'\1'$Z',' | eval sed $REGEX
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep -v "^$j# " | sed 's,^'$i'\(# .*\),'$H'\1'$Z',' | eval sed $REGEX
}
function slide_exec {
# find executables in the slide
j=$(( $2 + 1 ))
echo -en "$CLS"
#echo -en "$CLS"
while read line
do eval $line > /dev/null 2>&1 &
done < <(
@@ -40,6 +40,19 @@ function slide_exec {
!/^# /{
print $0;
}
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep "^\&( " | sed -e 's,^\&( ,,' -e 's,)$,,' )
# restore cursor position to bottom of slide
echo -ne "${E}u"
while read line
do eval $line
done < <(
awk 'match($0,/^# /){
c++;
print c $0;
}
!/^# /{
print $0;
}
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep "^\$( " | sed -e 's,^\$( ,,' -e 's,)$,,' )
}
@@ -75,7 +88,7 @@ for (( r=0; r<${#CONF_LINE[@]}; r++ ));
replace=$( eval echo ${!value} )
REGEX="$REGEX -e 's/\(${CONF_LINE[$r]}\)/"${replace}"/g'"
done
REGEX="$REGEX -e 's/^\$([^\$]\+)/\$(*)/g'"
REGEX="$REGEX -e 's/^\$(\([^)]\{20\}\).*)/\$(\1...)/g'"
#echo $REGEX
#exit
@@ -86,7 +99,10 @@ do
# print slide $i
NO_SLIDES=$( grep -ce "^# " "$1" )
COLS=$(( $( tput cols ) - 3 ))
[ "$cmd" = "e" ] && read -N 1 foo
display_slide "$1" $i
# save cursor location
echo -ne "${E}s"
# ask for user input
# 1 back, 2 forward, q exit, m menu
echo -ne "${Z}${E}1;${COLS}H"
@@ -141,8 +157,8 @@ exit
## 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
* Move to the next slide with key 1, arrow right, space..
* Move to the previous slide with key 2, arrow left
* Exit with q or x
* Hide menu with m
* The numbers on the right show the current
@@ -201,8 +217,12 @@ Object Area Perimeter
* Get creative with │Ascii!│
└┬────┬┘
* Run any command with pressing "e" on a slide with
syntax beginning a row: "$ ( command )"
$( xeyes )
syntax beginning a row:
* "$ ( command )" to print the output
* "& ( command )" run process in background
&( xeyes )
$( ls )
# Hints: Other tools