Repo containing scripts to be used with dovel, and git hooks that powers our web interface.
Author: brian (git@myr.sh)
Date: Tue Jan 16 00:35:07 2024 -0300
Parent: 9c2981e
Updated shelldown
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%]*}"
- ;;
- ']('*')'*)
+ alt="${w#['*)
+ 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
+ '[')
- alt="${w#[}"
- ref="${w#*(}"
- printf '<a href="%s">%s</a>' "${ref%)}" "${alt%]*}"
- ;;
- '['*) link="1" && alt="${w#[}" ;;
*) printf "$w" ;;
esac