list

scripts

Repo containing scripts to be used with dovel, and git hooks that powers our web interface.

curl -O https://dovel.email/scripts.tar.gz tar.gz

243a165

Author: brian (git@myr.sh)

Date: Tue Jan 16 00:35:07 2024 -0300

Parent: 9c2981e

Updated shelldown

Diff

aux.sh

diff --git a/aux.sh b/aux.sh
index 985d12a..d5075b6 100755
--- a/aux.sh
+++ b/aux.sh
@@ -78,7 +78,9 @@ type() {
 		then
 			case "$w" in
 			*']('*)
-				alt="$alt ${w%]*}"; w="${w#*](}"
+				alt="$alt ${w%%]*}"; w="${w#*](}"
+				[ "$((img + link))" = "2" ] && ref="${w##*(}" && printf ' <a href="%s"><img src="%s" alt="%s"></a>' "${ref%)}" "${w%%)*}" "$alt"; img="0"; link=0
+
 				[ "$img" = 1 ] && printf '<img src="%s" alt="%s">' "${w%)}" "$alt" && img="0"
 				[ "$link" = 1 ] && printf '<a href="%s">%s</a>' "${w%)}" "$alt" && link="0"
 				;;
@@ -113,21 +115,31 @@ type() {
 		'`'*) printf "<kbd>%s" "${w#\`}" ;;
 		*'`') printf "%s</kbd>" "${w%\`}" ;;
 
-		# images
-		'!['*']('*')') 
-			alt="${w#![}"
-			ref="${w#*(}"
-			printf '<img src="%s" alt="%s">' "${ref%)}" "${alt%]*}"
-			;;
-                '!['*) img="1" && alt="${w#![}" ;;
+		 # one word linked images
+                '[!['*']('*')]('*')'*)
+                        alt="${w#[![}"; iref="${w#*(}"; ref="${w##*(}"
+                        printf ' <a href="%s"><img src="%s" alt="%s"></a>' "${ref%)}" "${iref%%)*}" "${alt%%](*}"
+                        ;;
+
+                # one word images
+                '!['*']('*')'*)
+                        alt="${w#![}"; ref="${w#*(}"
+                        printf ' <img src="%s" alt="%s">' "${ref%)*}" "${alt%]*}"
+                        ;;
+
+                # one word links
+                '['*']('*')'*)
+                        alt="${w#[}"; ref="${w#*(}"
+                        printf ' <a href="%s">%s</a>' "${ref%)*}" "${alt%]*}"
+                        ;;
+
+                # multi word links
+                '[!['*) debug "begin link image"; link=1; img=1
+                        alt="${w#[![}"
+                        ;;
+                '['*) debug "begin link"; link="1" && alt="${w#[}" ;;
+                '!['*) debug "begin img"; img="1" && alt="${w#![}" ;;
 
-                # links
-		'['*']('*')') 
-			alt="${w#[}"
-			ref="${w#*(}"
-			printf '<a href="%s">%s</a>' "${ref%)}" "${alt%]*}"
-			;;
-                '['*) link="1" && alt="${w#[}" ;;
 
 		*) printf "$w" ;;
 		esac