#!/bin/sh
#
# convert_man_to_html.sh - ts A61214 , B50802
#
# Generates a HTML version of man page cdrskin.1
#
# To be executed within the libburn toplevel directory (like ./libburn-0.2.7)
#
# set -x
man_dir=$(pwd)"/cdrskin"
export MANPATH="$man_dir"
manpage="cdrskin"
raw_html=$(pwd)/"cdrskin/raw_man_1_cdrskin.html"
htmlpage=$(pwd)/"cdrskin/man_1_cdrskin.html"
if test -r "$man_dir"/"$manpage".1
then
dummy=dummy
else
echo "Cannot find readable man page source $1" >&2
exit 1
fi
if test -e "$man_dir"/man1
then
dummy=dummy
else
ln -s . "$man_dir"/man1
fi
if test "$1" = "-work_as_filter"
then
# set -x
sed \
-e 's///' \
-e 's///' \
-e 's/
CDRSKIN<\/title>/man 1 cdrskin<\/title>/' \
-e 's/CDRSKIN<\/h1>/man 1 cdrskin<\/h1>/' \
-e 's///' \
-e 's/Overview of features:<\/b>/Overview of features:<\/b>
/' \
-e 's/General information paragraphs:<\/b>/General information paragraphs:<\/b>
/' \
-e 's/Track recording model:<\/b>/\
Track recording model:<\/b>
/' \
-e 's/^In general there are two types of tracks: data and audio./\
In general there are two types of tracks: data and audio./' \
-e 's/^While audio tracks just contain a given/\
While audio tracks just contain a given/' \
-e 's/Write mode selection:<\/b>/Write mode selection:<\/b>
/' \
-e 's/Recordable CD Media:<\/b>/Recordable CD Media:<\/b>
/' \
-e 's/Overwriteable DVD or BD Media:<\/b>/Overwriteable DVD or BD Media:<\/b>
/' \
-e 's/Sequentially Recordable DVD or BD Media:<\/b>/Sequentially Recordable DVD or BD Media:<\/b>
/' \
-e 's/^The write modes for DVD+R/\
The write modes for DVD+R/' \
-e 's/Drive preparation and addressing:<\/b>/Drive preparation and addressing:<\/b>
/' \
-e 's/^If you only got one CD capable drive/\
If you only got one CD capable drive/' \
-e 's/Emulated drives:<\/b>/Emulated drives:<\/b>
/' \
-e 's/for normal use:
/for normal use:
/' \
-e 's/original cdrecord by Joerg Schilling:<\/p>/original cdrecord by Joerg Schilling:<\/p>
/' \
-e 's/<\/body>/
(HTML generated from '"$manpage"'.1 on '"$(date)"' by '$(basename "$0")' )<\/CENTER><\/FONT><\/body>/' \
-e 's/See section FILES/See section FILES<\/A>/' \
-e 's/See section EXAMPLES/See section EXAMPLES<\/A>/' \
-e 's/−/-/g' \
<"$2" >"$htmlpage"
set +x
chmod u+rw,go+r,go-w "$htmlpage"
echo "Emerged file:"
ls -lL "$htmlpage"
else
# export BROWSER='cp "%s" '"$raw_html"
export BROWSER=$(pwd)/'cdrskin/unite_html_b_line "%s" '"$raw_html"
man -H "$manpage"
# cp "$raw_html" /tmp/x.html
"$0" -work_as_filter "$raw_html"
rm "$raw_html"
rm "$man_dir"/man1
fi