#!/bin/bash ############# # DESCRIPTION ############# # Evaluates inline bash snippets when building pages. # # This functionality is currently disabled for initial release because even though it "works". When called by build_page, the parsing isn't very good and the syntax for calling an inline evaluation could use some work. # ############# # Function Usage: # evaluate_inline index.html # # Inline Snippet Usage: #
sh# echo "Hello World!" 
evaluate_inline() ( evaluation_source=$(basename $1) cd $(dirname $1) while grep "
sh#" $evaluation_source
do
        replacement=$(bash <<< $(sed -n -e s$'\001''
sh#\(.*\)
'$'\001''\1'$'\001''p' < $evaluation_source | head -1)) awk 'NR==1,/
sh#.*<\/pre>/{sub(/
sh#.*<\/pre>/, "'"$replacement"'")}{print >"'"$evaluation_source"'"}' $evaluation_source || break
done
)