help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Docbook -> texinfo/info


From: Aharon Robbins
Subject: Re: Docbook -> texinfo/info
Date: Fri, 6 Jul 2001 15:26:39 +0300

Greetings All.

> To: address@hidden
> Cc: address@hidden, address@hidden,
>         Aharon Robbins <address@hidden>
> Subject: Re: Docbook -> texinfo/info
> From: Akim Demaille <address@hidden>
> Date: 05 Jul 2001 15:03:14 +0200
>
> |     I have a couple of large docbook documents
> | 
> | I don't know of any way to read docbook in info, or (more plausibly)
> | convert docbook into Texinfo.  If anyone does, I'd like to know about it.
>
> I seem to have understood Aharon might know such a tool.

Here is what I have:

> To: address@hidden
> Subject: Re: docbook and texinfo?
> Date: Wed, 28 Apr 1999 13:00:32 +0100
> From: Mark Burton <address@hidden>
> 
> > From: Aharon Robbins <address@hidden>
> > Subject: docbook and texinfo?
> > Date: Wed, 28 Apr 1999 12:22:04 +0200
> 
> > Hi. RMS sent me your way.
> 
> Hello Arnold,
> 
> > I understand you're working on a project to convert Docbook to
> > Texinfo.
> 
> That's correct.
> 
> > 
> > I am interested in going the other way, and was wondering if you'd done
> > any kind of work on that, before I started in on hacking makeinfo.
> 
> Sorry, I haven't done anything in that direction.
> 
> > How is the Docbook -> Texinfo project going?  That might also end up
> > being useful to me.
> 
> It's going fine. I can already convert quite a reasonable set of
> DocBook elements into texinfo. Still some way to go though before it
> is really useful. When I have progressed it a little further I will
> send a copy to you.
> 
> Regards,
> 
> Mark

Try dropping Mark a note.  Other mail that may or may not be helpful
follows.

Good luck,

Arnold

> Date: Mon, 29 May 2000 10:15:39 +0200
> From: Werner Koch <address@hidden>
> To: Aharon Robbins <address@hidden>
> Subject: Re: Docbook and texinfo
> 
> --Dxnq1zWXvFF0Q93v
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> On Sun, 28 May 2000, Aharon Robbins wrote:
> 
> > I would be very interested in knowing what tools turn Docbook into
> > Texinfo.  I'm interested in going both ways.
> 
> I used the Debian package docbk-xml2x based on:
> 
> http://shell.ipoline.com/~elmert/comp/docbook2X/
> 
> I don't think that this is a good solution and I would prefer to use
> a real DSSSL stylesheet and (if needed) a Jade extension to handle
> this.
> 
> > BTW, what do you use for turning Docbook into paper?
> 
> JadeTex and the attached script.  The script lacks texi support but if
> you would like to add support using docbk-xml2x it would a first step.
> 
> > (gawk maintainer)
> 
> Hey, I really like awk.
> 
>   Werner
> 
> 
> -- 
> Werner Koch                           OpenPGP key 621CC013
> OpenIT GmbH                             tel +49 211 239577-0
> Birkenstr. 12                           email   address@hidden
> D-40233 Duesseldorf                     http://www.OpenIT.de
> 
> --Dxnq1zWXvFF0Q93v
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename=db2any
> 
> #!/bin/sh
> # db2any - Docbook to html/ps/info rendering
> #
> #     Copyright (C) 2000 Free Software Foundation
> #
> # This is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> # the Free Software Foundation; either version 2 of the License, or
> # (at your option) any later version.
> #
> # This is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.        See the
> # GNU General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
> #
> # Note: This requires a Posix shell
> #
> # $Id: db2any,v 1.3 2000/05/26 14:26:56 wkoch Exp $
> 
> 
> pgm="db2any"
> version="0.7"
> 
> usage () {
>     echo 'usage: db2any [--help] [options] filename' >&2
>     exit 1
> }
> 
> show_banner () {
>       cat <<EOF
> $pgm $version
> Copyright (C) 2000 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> stylesteet: $stylesheet
> EOF
> }
> 
> show_help () {
>     show_banner
>     cat <<EOF
> 
> usage: db2any [options] docbookfile
> 
> Options:
>     --mode    select the mode (one of: ${all_modes})
>     --help
>     --nosplit
>     --copyfiles
>     --systemcheck
>     --verbose
>     --draft
>     --manvolume
> EOF
>     exit 0
> }
> 
> # a list of all possible stylesheet locations
> stylesheet_dirs='
> /usr/local/lib/dsssl/stylesheets/docbook
> /usr/local/share/dsssl/stylesheets/docbook
> /usr/local/lib/sgml/stylesheet/dsssl/docbook/nwalsh
> /usr/local/share/sgml/stylesheet/dsssl/docbook/nwalsh
> /usr/lib/dsssl/stylesheets/docbook
> /usr/share/dsssl/stylesheets/docbook
> /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh
> /usr/share/sgml/stylesheet/dsssl/docbook/nwalsh
> /usr/lib/sgml/stylesheets/nwalsh-modular
> /usr/share/sgml/stylesheets/nwalsh-modular
> '
> 
> all_modes="check tex html man"
> input=
> verbose=no
> draft=no
> nosplit=no
> copyfiles=no
> systemcheck_only=no
> mode=none
> manvolume="man"
> expected_args=1
> while test "`echo $1 | head -c1`" = "-"; do
>     case $1 in
>       --version)
>       echo "$pgm $version"
>       exit 0
>       ;;
>       --help|-h|-help)
>       show_help
>       exit 0
>       ;;
>       --nosplit)
>       nosplit=yes
>       ;;
>       --copyfiles)
>       copyfiles=yes
>       ;;
>       --systemcheck)
>       systemcheck_only=yes
>       expected_args=0
>       ;;
>       --mode)
>       shift
>       if [ $# = 0 ]; then
>          echo "$pgm: missing argument for --mode" >&2
>          exit 1
>       fi
>       mode="$1"
>       ;;
>       --manvolume)
>       shift
>       if [ $# = 0 ]; then
>          echo "$pgm: missing argument for --manvolume" >&2
>          exit 1
>       fi
>       manvolume="$1"
>       ;;
>       --verbose)
>       verbose=yes
>       ;;
>       --draft)
>       draft=yes
>       ;;
>       --)
>       shift
>       break
>       ;;
>       *)
>       echo "$pgm: invalid option $1" >&2
>       exit 1
>       ;;
>     esac
>     shift
> done
> 
> if [ $# = $expected_args ]; then
>     if [ $# = 1 ]; then
>        input="$1"
>     fi
> else
>    usage
> fi
> 
> # check the mode
> all_modes="dvi html man"
> case "$mode" in
>     html|HTML)
>       mode=html
>       ;;
>     tex|TEX|TeX|dvi)
>       mode=dvi
>       ;;
>     man|MAN)
>       mode=man
>       ;;
>     check)
>       ;;
>     none)
>       if [ $systemcheck_only != yes ]; then
>           echo "$pgm: no mode specified; use one of: ${all_modes}" >&2
>           exit 1
>       fi
>       ;;
>     *)
>       echo "$pgm: invalid mode $mode" >&2
>       echo "$pgm: valid modes are: ${all_modes}"  >&2
>       exit 1
>       ;;
> esac
> 
> #######################################
> #   Options are all parsed here       #
> #######################################
> 
> # Figure out all what we need to know about the system we are
> # running on and where the Docbook tools are installed.
> # Tell about it when runnng in verbose mode.
> do_systemcheck () {
>     # look for Jade
>     jade_version=`jade -v </dev/null 2>&1 | \
>                  sed -n 's/.*:I:.*Jade version "\([0-9.]*\)"/\1/p'`
>     if [ -z "$jade_version" ]; then
>       echo "$pgm: error: jade not found" >&2
>       exit 1
>     fi
>     [ $verbose = yes ] && echo "$pgm: Jade version $jade_version found" >&2
> 
>     # look for JadeTeX
>     if ! jadetex -v 2>/dev/null | grep -q '^TeX' ; then
>       echo "$pgm: error: jadetex not found" >&2
>       exit 1
>     fi
> 
>     # look for the docbook-to-man script. Fixme: we should check that it
>     # it is a recent version.
>     if ! docbook-to-man 2>&1 | grep -q '^usage' ; then
>       echo "$pgm: error: docbook-to-man not found" >&2
>       exit 1
>     fi
> 
>     # figure out where our stylesheets are
>     tex_stylesheet=none
>     for d in ${stylesheet_dirs}; do
>       file=${d}/print/docbook.dsl
>       if [ -f $file ]; then
>           tex_stylesheet=$file
>           break
>       fi
>     done
>     [ $verbose = yes ] && echo "$pgm: TeX stylesheet: ${tex_stylesheet}" >&2
>     html_stylesheet=none
>     for d in ${stylesheet_dirs}; do
>       file=${d}/html/docbook.dsl
>       if [ -f $file ]; then
>           html_stylesheet=$file
>           break
>       fi
>     done
>     [ $verbose = yes ] && echo "$pgm: HTML stylesheet: ${html_stylesheet}" >&2
>     if [ $tex_stylesheet = none -o $html_stylesheet = none ]; then
>       echo "$pgm: error: stylesheets not found" >&2
>       exit 1
>     fi
> }
> 
> 
> # Render the docbook as HTML
> render_html () {
>     output="`basename $input| sed 's/\.sgml$//'`.html"
> 
>     # --nosplts creates just one HTML file
>     if test $nosplit = yes; then
>       echo "running jade on '$input' ..." >&2
>       jade -d $html_stylesheet -t sgml -i html -V nochunks $input > $output
>       echo "$output created"
>       return 0
>     fi
> 
>     # Make syre that we have a html subdir
>     if test -d html ; then
>       :
>     else
>       if mkdir html; then
>           echo "'html' directory created" >&2
>       else
>           echo "failed to create 'html' directory" >&2
>           exit 1
>       fi
>     fi
> 
>     outputdir="html/`basename $input| sed 's/\.sgml$//'`"
> 
>     if test -d $outputdir ; then
>       :
>     else
>       if mkdir $outputdir; then
>           echo "'$outputdir' created" >&2
>       else
>           echo "failed to create '$outputdir'" >&2
>           exit 1
>       fi
>     fi
>     echo "creating html pages in '$outputdir' ..." >&2
>     if test "$input" = "`basename $input`"; then
>       inp="../../$input"
>     else
>       inp="$input"
>     fi
>     [ $verbose = yes ] && echo "running jade on '$inp' ..." >&2
>     (cd $outputdir && jade -t sgml -i html -d $html_stylesheet $inp )
>     [ $verbose = yes ] && echo "html version in '$outputdir' created" >&2
> 
>     # break out all filerefs and copy them to the outputdirectory
>     # fixme: handling of path components is wrong
>     if test $copyfiles = yes; then
>       echo "looking for filerefs ..." >&2
>       for file in `nsgmls -i html $input \
>                       | awk '/^AFILEREF[ \t]+CDATA/ {print $3}'`; do
>           d=$outputdir/`basename $file`
>           if cat $file > $outputdir/`basename $file` ; then
>               echo "  $file -> $d" >&2
>           fi
>       done
>     fi
> 
>     mainfile=`ls $outputdir/${doctype}* | head -1`
> 
>     # create a html index file for it, so that we can more easy
>     # find the rendred pages
>     cat > $output <<EOF
> <html><title>$output</title>
> <body>
> 
> <a href="$mainfile">$mainfile</a>
> 
> </body>
> </html>
> EOF
> 
>     [ $verbose = yes ] && echo "$output created with link to '$mainfile'" >&2
> }
> 
> 
> # This function expects the source file in $texfile and
> # the name of the logfle in $logfile
> run_jadetex () {
>     [ -f $logfile ] && rm $logfile
>     jadetex $texfile
>     if ! tail $logfile | grep -q '^Output written on'; then
>       echo "JadeTeX failed" >&2
>       exit 1
>     fi
> }
> 
> # Render the docbook to DVI
> render_dvi () {
>     output="`basename $input| sed 's/\.sgml$//'`.dvi"
>     texfile="`basename $input| sed 's/\.sgml$//'`.tex"
>     logfile="`basename $input| sed 's/\.sgml$//'`.log"
>     auxfile="`basename $input| sed 's/\.sgml$//'`.aux"
> 
>     [ $verbose = yes ] && echo "running jade on '$input' ..." >&2
>     jade -t tex -i tex -d $tex_stylesheet $input
>     if ! tail $texfile | grep -q '\\endFOT{}'; then
>       echo "Jade failed" >&2
>       exit 1
>     fi
> 
>     # Better delete the aux file first
>     [ -f $auxfile ] && rm $auxfile
>     # The first run won't get the references right, so we have to
>     # run it 2 or 3 times.  JadeTex doesn't indicate whether a third
>     # run is required, so we do it always.
>     run_jadetex
>     if [ $draft = no ]; then
>       if tail -100 $logfile \
>          | grep -q '^LaTeX Warning: There were undefined references'; then
>          echo 'running JadeTeX a second and third 2time' >&2
>          run_jadetex
>          run_jadetex
>       fi
>     fi
> 
>     [ $verbose = yes ] && echo "$output created as '$output'" >&2
> }
> 
> # Render the docbook to troff
> render_man () {
>     output="`basename $input| sed 's/\.sgml$//'`.$manvolume"
> 
>     [ $verbose = yes ] && echo "running docbook-to-man on '$input' ..." >&2
>     docbook-to-man $input > $output
>     [ $verbose = yes ] && echo "man page '$output' created" >&2
> }
> 
> #######################################
> #      main function                #
> #######################################
> 
> do_systemcheck
> [ $systemcheck_only = yes ] && exit 0
> 
> if [ ! -f "$input" ]; then
>     input="$input.sgml"
>     if [ ! -f "$input" ]; then
>       echo "$pgm: '$input': no such file" >&2
>       exit 1
>     fi
> fi
> 
> # grep the document type
> doctype=`grep -i '\<doctype' $input|awk 'NR==1 {print $2}'| tr '[A-Z]' 
> '[a-z]'`
> if test -z "$doctype"; then
>     echo "$pgm: error: no DOCTYPE declaration found" >&2
>     exit 1
> fi
> [ $verbose = yes ] &&  echo "$input: DOCTYPE is '$doctype'" >&2
> 
> case $mode in
>     check)
>       nsgmls -vs $input
>       exit $?
>       ;;
>     html)
>       render_html
>       ;;
>     dvi)
>       render_dvi
>       ;;
>     man)
>       render_man
>       ;;
> esac
> 
> 
> exit 0
> 
> 
> --Dxnq1zWXvFF0Q93v--

> Date: Mon, 29 May 2000 18:53:59 +0200
> From: Werner Koch <address@hidden>
> To: Aharon Robbins <address@hidden>
> Subject: Re: Docbook and texinfo
> 
> On Mon, 29 May 2000, Aharon Robbins wrote:
> 
> > Where do I get JadeTex?
> 
> $ apt-get install jadetex
> 
> ;-)
> 
> ftp://ftp.tex.ac.uk/tex-archive/macros/jadetex/
> 
> 
> -- 
> Werner Koch                           OpenPGP key 621CC013
> OpenIT GmbH                             tel +49 211 239577-0
> Birkenstr. 12                           email   address@hidden
> D-40233 Duesseldorf                     http://www.OpenIT.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]