diff --git a/reporting/markslider b/reporting/markslider index edb8f1e..7741a23 100755 --- a/reporting/markslider +++ b/reporting/markslider @@ -1,6 +1,6 @@ #!/bin/bash -VERSION=20140416 +VERSION=20140417 function display_self { $0 $0 @@ -24,14 +24,14 @@ 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 & + do eval $line > /dev/null 2>&1 & done < <( awk 'match($0,/^# /){ c++; @@ -40,7 +40,20 @@ function slide_exec { !/^# /{ print $0; } -' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep "^\$( " | sed -e 's,^\$( ,,' -e 's,)$,,' ) +' "$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 )) - display_slide "$1" $i + [ "$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