From a69a00dd847cc7f96bfc89cbd192741f142b94c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Di=20Biase?= Date: Wed, 29 May 2024 17:52:25 -0300 Subject: [PATCH 1/2] Feature: use text generated by cmds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Luis Di Biase --- example | 12 ++++++++---- slides | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/example b/example index 8a1c7d4..59316dd 100644 --- a/example +++ b/example @@ -2,7 +2,7 @@ center ================================================================= ___ _ ___ _ _ _ | _ ) __ _ __| |_ / __| (_)__| |___ ___ -| _ \/ _` (_-< ' \ \__ \ | / _` / -_|_-< +| _ \/ _' (_-< ' \ \__ \ | / _' / -_|_-< |___/\__,_/__/_||_| |___/_|_\__,_\___/__/ @@ -38,7 +38,7 @@ Supported slide styles are: • Section – Chapter / section division slide code bash ============================================================== -# Uses `highlight` for code highlighting +# Uses 'highlight' for code highlighting for (( i = 0; i < nr_lines; i++ )); do for (( j = 0; j < filler; j++ )); do @@ -75,15 +75,19 @@ ASCII art ¯\_(ツ)_/¯ Also not to forget FontAwesome!    block ================================================================== -`figlet` and `showfigfonts` are good commands +'figlet' and 'showfigfonts' are good commands to create a nice looking ASCII art headings. ___ __ ___________ __ / _ )___ ____ / / / __/_ __/ | /| / / - / _ / _ `(_-$ figlet -f smslant $ figlet -f small +block ================================================================== +# Generated text by cmd +`ls -l` + section ================================================================ That's all folks! diff --git a/slides b/slides index 8e170b9..bb03e7a 100755 --- a/slides +++ b/slides @@ -28,8 +28,18 @@ for (( i = 0; i < NR_FORMATTING; i += 2 )); do SED_REPLACE+=" -e s/${FORMATTING[i]}/${FORMATTING[i + 1]}/g" done -file="${1:-example}" +SED_REPLACE_CMD="s/\`\(.*\)\`/\1/e" +TMP_FILE="/tmp/file_replace_cmd" + +replace_commands() { + sed ${SED_REPLACE_CMD} $file > $TMP_FILE + if [ $? == 0 ]; then + file=$TMP_FILE + fi +} +file="${1:-example}" +replace_commands prepare_terminal() { # Get terminal values, clean terminal and remove cursor @@ -46,6 +56,9 @@ restore_terminal() { tput cnorm } +remove_tmp_files() { + rm $TMP_FILE +} read_slides() { local i=0 @@ -369,5 +382,6 @@ while true; do fi done +remove_tmp_files show_mouse_cursor restore_terminal From 1e6ca5b9d308bae20ed41f91db18e9dcb55506c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Di=20Biase?= Date: Mon, 3 Jun 2024 17:38:37 -0300 Subject: [PATCH 2/2] Quoting file to support several file names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Luis Di Biase --- slides | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slides b/slides index bb03e7a..5997438 100755 --- a/slides +++ b/slides @@ -32,7 +32,7 @@ SED_REPLACE_CMD="s/\`\(.*\)\`/\1/e" TMP_FILE="/tmp/file_replace_cmd" replace_commands() { - sed ${SED_REPLACE_CMD} $file > $TMP_FILE + sed ${SED_REPLACE_CMD} "$file" > $TMP_FILE if [ $? == 0 ]; then file=$TMP_FILE fi