Suraj Kurapati - 2006-04-12

Logged In: YES
user_id=315014

Here is an updated version that works for both pages and
entries. Unlike the previous version, this allows you to
embed variables right in your entry, just like you can embed
variables in templates. And of course, you can do command
substitution via $(..) or `..`, just remember to follow the
same escaping rules shown at the bottom of the nanoblogger
user manual when you don't want your writing to be
misinterpreted as shell commands.

$ more plugins/entry/format/bash.sh
plugins/page/format/bash.sh | cat
::::::::::::::
plugins/entry/format/bash.sh
::::::::::::::
# NanoBlogger plugin to filter Bash script content

BASH_HERE="__BASH_HERE:$$$RANDOM$$:BASH_HERE__"

eval "NB_EntryBody=\$( head -n -1 <<\$BASH_HERE
$NB_EntryBody
\$BASH_HERE )"
::::::::::::::
plugins/page/format/bash.sh
::::::::::::::
# NanoBlogger plugin to filter Bash script content

BASH_HERE="__BASH_HERE:$$$RANDOM$$:BASH_HERE__"

eval "MKPAGE_CONTENT=\$( head -n -1 <<\$BASH_HERE
$MKPAGE_CONTENT
\$BASH_HERE )"