about summary refs log tree commit diff stats
path: root/ht.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ht.sh')
-rwxr-xr-xht.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/ht.sh b/ht.sh index 9c3302f..e874e3c 100755 --- a/ht.sh +++ b/ht.sh
@@ -27,7 +27,7 @@ htt() { # htt FILES...
27 27
28ht_build_env() { # ht_build_env FILE... 28ht_build_env() { # ht_build_env FILE...
29 print "body() { cat \"$HTBOD\"; }" > "$HTENV" 29 print "body() { cat \"$HTBOD\"; }" > "$HTENV"
30 : > "$HTBOD"; # clear out body 30 : > "$HTBOD"; # clear
31 while read -r line; do 31 while read -r line; do
32 case "$line" in 32 case "$line" in
33 *@@*:*@@*) # "simple" metadata; just a string 33 *@@*:*@@*) # "simple" metadata; just a string
@@ -38,7 +38,8 @@ ht_build_env() { # ht_build_env FILE...
38 print "$line" | 38 print "$line" |
39 sed 's/.*@@\([^:]*\):: \?\(.*\)@@.*/\1() { \2 ; }/' 39 sed 's/.*@@\([^:]*\):: \?\(.*\)@@.*/\1() { \2 ; }/'
40 ;; 40 ;;
41 esac >> "$HTENV" 41 esac |
42 sed '/%s() {.*}/d' >> "$HTENV"
42 # Still print the line to the body (no need to escape or w/e) 43 # Still print the line to the body (no need to escape or w/e)
43 print "$line" >> "$HTBOD" 44 print "$line" >> "$HTBOD"
44 done 45 done
@@ -53,7 +54,7 @@ ht_main() { # main TEMPLATE < INPUT
53 exit 1 54 exit 1
54 fi 55 fi
55 56
56 eval "ht_build_env; . \"$HTENV\"; print \"\$(htt \"\$@\")\";"; 57 eval "ht_build_env; . \"$HTENV\"; htt \"\$@\";";
57} 58}
58 59
59# To keep this POSIX-compliant, we can't use a bashism like 60# To keep this POSIX-compliant, we can't use a bashism like