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