#!/bin/sh
#set -x
################################################################################
#"@(#)Strip python from specially-formatted HTML document(1.0 20150113 John S. Urban)"
#
# Make a tool so python source can be maintained as part of a WWW URL in
# html format, using a kludge where only lines between special comments are
# extracted for compilation.
################################################################################
# extract only lines between lines containing
#
#
# or
#
#
#
# NOTE: The trailing end of a pair is NOT optional, lines are case sensitive
################################################################################
# find lines in the delimited blocks
# delete the delimiting lines themselves
# delete any other "HTML comments"
# delete any blank lines and PY comment lines
# BUG: if a ! is used as a continuation character the line will be deleted
exec sed -n -e '\% *%,\%
*%{
\% *%d
\%
*%d
\%%d
s%%!%
s%<%<%
s%>%>%
s%\&%\&%
s%\'%\x27%
s%\"%"%
p
}' -e '\% *%,\% *%{
\% *%d
\% *%d
\%%d
s%%!%
p
}' $* |(
expand|
cat -s
)
################################################################################
exit
################################################################################
Maybe make a fancier interface that takes html to text more generically,
allowing more easily for HTML within the body of the source
################################################################################