TIVI-153: add as dependency for iputils
[profile/ivi/xmlto.git] / format / docbook / txt
1 case "$USE_BACKEND" in
2 DEFAULT|DBLATEX)
3         if [ -n "`type -t $W3M_PATH`" ]
4         then
5           CONVERT="$W3M_PATH"
6           ARGS="-T text/html -dump"
7         elif [ -n "`type -t $LYNX_PATH`" ]
8         then
9           CONVERT="$LYNX_PATH"
10           ARGS="-force_html -dump -nolist -width=72"
11         elif [ -n "`type -t $LINKS_PATH`" ]
12         then
13           CONVERT="$LINKS_PATH"
14           ARGS="-dump"
15         else
16           echo >&2 "No way to convert HTML to text found."
17     echo >&2 "Try either installing text web browser(lynx/w3m/links) or use option --with-fop"
18           exit 3
19         fi
20
21         case "$1" in
22         stylesheet)
23           if [ "$VERBOSE" -ge 1 ]
24           then
25             echo >&2 "Convert to HTML (no chunks)"
26           fi
27           echo "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"
28     ;;
29         post-process)
30           if [ "$VERBOSE" -ge 1 ]
31     then
32             echo >&2 "Convert HTML to ASCII"
33           fi
34           ${CONVERT} ${ARGS} ${POSTARGS} "${XSLT_PROCESSED}" > \
35            "$OUTPUT_DIR/$(basename "${XSLT_PROCESSED%.*}").txt"
36           ;;
37         esac
38 ;;
39 FOP)
40         case "$1" in
41         stylesheet)
42           if [ "$VERBOSE" -ge 1 ]
43           then
44             echo >&2 "Convert to XSL-FO"
45           fi
46           echo "http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
47           ;;
48         post-process)
49           EXT=$(basename "$0")
50           if [ "$VERBOSE" -ge 1 ]
51           then
52             echo >&2 "Convert to ${EXT}"
53           fi
54           # Get the FO format script to do the rest
55           sh "$(dirname "$0")/../fo/${EXT}" "$1"
56           ;;
57         esac
58 ;;
59 esac