# Text to html conversion, adapted to zlin08.txt; by Jenik Hollan.
remblan $1
vlnka2 $1 >/dev/null
hr2par /e $1 /tmp/$1.par
sed -r '
# putting the directory to the hold space
/([^-]|^)(spml04-12_[1-4]|pec200[45]_[1-5])/{
h
x
s/(.*)(spml04-12_[1-4]|pec200[45]_[1-5])(.*)/\1\2@
# putting the directory name at the separate line, before a simple image name
/[oO]br\.[~_][0-9a-zA-Z-]+/{
s/[oO]br\.[~_]/\
&/
P
x
P
x
s|([oO]br)\.[~_]([0-9a-zA-Z-]+\.png)|\
/\2">\1. \2|g
s|([oO]br)\.[~_]([0-9a-zA-Z-]+)|\
/\2.jpg">\1. \2|g
}
# hypertexting full dirname / full filename
s@([oO]br)\.[-]((spml04-12_[1-4]|pec200[45]_[1-5])/[0-9a-zA-Z-]+\.png)@\1. \2@g
# hypertexting full dirname / jpg filename
s@([oO]br)\.[-]((spml04-12_[1-4]|pec200[45]_[1-5])/[0-9a-zA-Z-]+)@\1. \2@g
' /tmp/$1.par > /tmp/hyper2$1
rm /tmp/$1.par
# deleting middle line and newlines
sed -r '
/^\
\
\
\
\
\
\
\
}
/^ \
}
' /tmp/hyper4$1 > /tmp/hyper5$1
sed -r "s/''/\”/g
# ULRs at the end of the sentence (appended by .), inside a line
s|(http://[-a-zA-Z0-9/~_.?='-]+[-a-zA-Z0-9/~_?='-]+)\.([ )])|\1.\2|g
# ULRs at the end of the sentence (appended by .), ending a line
s|(http://[-a-zA-Z0-9/~_.?='-]+[-a-zA-Z0-9/~_?='-]+)\.$|\1.|g
# ULRs inside a sentence, inside a line
s|(http://[-a-zA-Z0-9/~_.?='-]+)([ ,);])|\1\2|g
# ULRs inside a sentence, ending a line
s|(http://[-a-zA-Z0-9/~_.?='+-]+)$|\1|g
" /tmp/hyper5$1