From f2b35046970c0568892b8f46ec5798180604bb5b Mon Sep 17 00:00:00 2001 From: jsz4n Date: Sat, 3 Aug 2024 19:12:42 +0200 Subject: [PATCH] handle multiple files --- scripts/slides_to_html.sh | 9 ++++++++- scripts/slides_to_pdf.sh | 9 ++++++++- watch_compile.sh | 9 ++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/slides_to_html.sh b/scripts/slides_to_html.sh index 8c189be..4e20d7c 100755 --- a/scripts/slides_to_html.sh +++ b/scripts/slides_to_html.sh @@ -5,4 +5,11 @@ SLIDE_LEVEL=2 my_header=$(<./templates/html_header.md) headEscapedForSed=${my_header//$'\n'/\\$'\n'} -sed -e "s|SLIDEHEAD|$headEscapedForSed|g" slides.md | pandoc -s --mathjax -t revealjs -o html/slides.html --slide-level=$SLIDE_LEVEL --highlight-style=$HIGHLIGHT_STYLE -V revealjs-url=https://unpkg.com/reveal.js@5.0.0 --template=./templates/template.revealjs +for filename in $* +do + echo compiling $filename + file_out=`echo $filename | sed -e 's/\.md/\.html/g'` + sed -e "s|SLIDEHEAD|$headEscapedForSed|g" $filename | pandoc -s --mathjax -t revealjs -o html/$file_out --slide-level=$SLIDE_LEVEL --highlight-style=$HIGHLIGHT_STYLE -V revealjs-url=https://unpkg.com/reveal.js@5.0.0 --template=./templates/template.revealjs + echo output $file_out + +done diff --git a/scripts/slides_to_pdf.sh b/scripts/slides_to_pdf.sh index 6036ca8..513b3ec 100755 --- a/scripts/slides_to_pdf.sh +++ b/scripts/slides_to_pdf.sh @@ -5,4 +5,11 @@ SLIDE_LEVEL=2 my_header=$(<./templates/pdf_header.md) headEscapedForSed=${my_header//$'\n'/\\$'\n'} -sed -e "s|SLIDEHEAD|$headEscapedForSed|g" slides.md | pandoc -t beamer -o slides.pdf --slide-level=$SLIDE_LEVEL --highlight-style=$HIGHLIGHT_STYLE -H ./templates/code-style.tex +for filename in $* +do + echo compiling $filename + file_out=`echo $filename | sed -e 's/\.md/\.pdf/g'` + sed -e "s|SLIDEHEAD|$headEscapedForSed|g" $filename | pandoc -t beamer -o $file_out --slide-level=$SLIDE_LEVEL --highlight-style=$HIGHLIGHT_STYLE -H ./templates/code-style.tex + echo output $file_out + +done diff --git a/watch_compile.sh b/watch_compile.sh index d17db0e..87298b6 100755 --- a/watch_compile.sh +++ b/watch_compile.sh @@ -12,9 +12,12 @@ esac echo using $script -$script +slide_files=("./slides.md" ) # if more files are need add them here + +echo ${slide_files[@]} +$script ${slide_files[@]} while [ 1 -eq 1 ] do - inotifywait ./slides.md - $script + file=$(inotifywait ${slide_files[@]}) + $script ${file%%\ *} done