blob: ef9a53a885bd9e423a9b1483a8f2d84e60b2c3f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#!/bin/sh
#
# $FML: sgml_compile.sh,v 1.1 2005/06/25 10:03:38 fukachan Exp $
#
#
# initialize variables
#
mode=html
fml_dir=`dirname $0`/../..
gnu_dir=`dirname $0`/../../../gnu
cur_dir=`pwd`
out_dir=$cur_dir/book
out_html=$cur_dir/book.html
out_txt=$cur_dir/book.txt
out_rtf=$cur_dir/book.rtf
tmp_dir=/var/tmp
tmp_file=$tmp_dir/tmpfile.$$
fml_sgml_dir=$fml_dir/doc/share/sgml
fml_catalog_path=$fml_sgml_dir/catalog
sgmltoolslite_catalog_path=$gnu_dir/dist/sgmltools-lite/dsssl/sgmltools.cat
pkg_catalog=/usr/pkg/etc/sgml/catalog
sgml_catalog_files=$SGML_CATALOG_FILES:$pkg_catalog:$sgmltoolslite_catalog_path
sgml_search_path=$SGML_SEARCH_PATH:$fml_catalog_path:$cur_dir;
for path in /usr/pkg/bin/openjade /usr/pkg/bin/lynx /usr/pkg/bin/w3m
do
if [ ! -x $path ];then
echo "error: $path not found"
exit 1
fi
done
#
# getopts
#
set -- `getopt dm: $*`
if test $? != 0; then echo 'Usage: ...'; exit 2; fi
for i
do
case $i
in
-d)
debug=1;
shift;;
-m)
mode=$2; shift;
shift;;
--)
shift; break;;
esac
done
source=$cur_dir/$1
#
# fix environment
#
TMPDIR=$tmp_dir ; export TMPDIR
COLS=72 ; export COLS
SGML_SEARCH_PATH=$sgml_search_path ; export SGML_SEARCH_PATH
SGML_CATALOG_FILES=$sgml_catalog_files; export SGML_CATALOG_FILES
#
# main: go!
#
common_options="\
-v \
-o $tmp_file \
-c $fml_catalog_path "
if [ "X$mode" = "Xhtml" -o "X$mode" = "Xonehtml" ];then
test -d $out_dir || mkdir $out_dir
chdir $out_dir || exit 1
dsssl=$gnu_dir/dist/sgmltools-lite/dsssl/html.dsl
/usr/pkg/bin/openjade $common_options \
-t sgml \
-c $fml_catalog_path \
-d $dsssl#$mode \
-d ${FML_DSL:-$fml_sgml_dir/fml.dsl} \
> $out_html < $source
elif [ "X$mode" = "Xlynx" ];then
dsssl=$gnu_dir/dist/sgmltools-lite/dsssl/ascii-lynx.dsl
/usr/pkg/bin/openjade $common_options \
-t sgml \
-d $dsssl#html \
> $out_html < $source
/usr/pkg/bin/lynx -dump -nolist -force_html $out_html > $out_txt
mv $out_html $tmp_dir
elif [ "X$mode" = "Xw3m" ];then
dsssl=$gnu_dir/dist/sgmltools-lite/dsssl/ascii-w3m.dsl
/usr/pkg/bin/openjade $common_options \
-t sgml \
-d $dsssl#html \
> $out_html < $source
/usr/pkg/bin/w3m -T text/html -dump $out_html > $out_txt
mv $out_html $tmp_dir
else
echo "error: unknown mode: $mode"
fi
exit 0;
|