diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | tools/Makefile.am | 4 | ||||
-rwxr-xr-x | tools/gnome-doc-html.in | 218 | ||||
-rwxr-xr-x | tools/gnome-doc-tool.in | 251 |
5 files changed, 262 insertions, 221 deletions
@@ -1,3 +1,11 @@ +2007-01-26 Shaun McCance <shaunm@gnome.org> + + * configure.in: + * tools/gnome-doc-html.in: + * tools/gnome-doc-tool.in: + * tools/Makefile.am: + - Moved gnome-doc-html to gnome-doc-tool, new subcommand syntax + 2007-01-26 Christian Persch <chpe@svn.gnome.org> * Makefile.am: Fix distcheck. diff --git a/configure.in b/configure.in index bb3ce31..66c439d 100644 --- a/configure.in +++ b/configure.in @@ -35,7 +35,7 @@ doc/gnome-doc-make/Makefile doc/xslt/Makefile po/Makefile.in tools/Makefile -tools/gnome-doc-html +tools/gnome-doc-tool tools/gnome-doc-prepare tools/gnome-doc-utils.pc xslt/Makefile diff --git a/tools/Makefile.am b/tools/Makefile.am index cb1a0a6..4053179 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -6,7 +6,7 @@ aclocal_DATA = gnome-doc-utils.m4 sharedir = $(datadir)/gnome-doc-utils share_DATA = gnome-doc-utils.make -bin_SCRIPTS = gnome-doc-prepare gnome-doc-html +bin_SCRIPTS = gnome-doc-prepare gnome-doc-tool endif @@ -14,7 +14,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gnome-doc-utils.pc EXTRA_DIST = \ - gnome-doc-html.in \ + gnome-doc-tool.in \ gnome-doc-prepare.in \ gnome-doc-utils.m4 \ gnome-doc-utils.make \ diff --git a/tools/gnome-doc-html.in b/tools/gnome-doc-html.in deleted file mode 100755 index b6bf3a2..0000000 --- a/tools/gnome-doc-html.in +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/sh -# gnome-doc-html - Convert documentation to HTML -# gnome-doc-html. Generated from gnome-doc-html.in by configure. -# Copyright (C) 2006 Shaun McCance <shaunm@gnome.org> -# -# This program 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 program 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -progname=`echo "$0" | sed 's%^.*/%%'` - -PROGRAM=gnome-doc-html -PACKAGE=@PACKAGE@ -VERSION=@VERSION@ -prefix=@prefix@ -datarootdir=@datarootdir@ -datadir=@datadir@ -pkgdatadir=@datadir@/gnome-doc-utils -xsltdir=@datadir@/xml/gnome/xslt - -function error { - echo "$progname: $1" 1>&2; - exit 1; -} -function print_help { - echo "Usage: $progname [OPTIONS] FILE" - echo "Convert FILE into HTML." - echo "" - echo "Basic Output Control:" - echo " -c, --css-file=FILE file to output CSS to" - echo " -d, --chunk-depth=INT how deep sections should be chunked" - echo " -e, --extension=EXT the extension to append to output files" - echo " -n, --no-figures do not copy figures into the output directory" - echo " -o, --output=PATH the file or directory to output to" - echo "" - echo "Formatting Control:" - echo " --admon-graphics-path=PATH the path to the admonition graphics" - echo " --admon-graphics-size=INT the size of the admonition graphics" - echo " --admon-graphics-extension=EXT the extension of the admonition grahpics" - echo " --classsynopsis-language=LANG the default programming language to be used" - echo " for classsynopsis elements" - echo " --funcsynopsis-style=STYLE the style to be used to render funcsynopsis" - echo " elements, either 'KR' or 'ANSI'" - echo "" - echo "Miscellaneous:" - echo " -v, --verbose print all the commands executed" - echo " -V, --version print version information and exit" - echo " -h, --help display this help and exit" -} -function echo_verbose { - if [ "x$doc_verbose" == "x1" ]; then echo $1; fi -} -function mkdir_p { - dir=''; - echo $1 | sed -e 's/\//\n/g' | while read d; do - dir="$dir$d/" - if [ ! -d "$dir" ]; then - echo_verbose "mkdir \"$dir\"" - mkdir "$dir" - fi - done; -} - -longopts=' - -lcss-file: - -lchunk-depth: - -lextension: - -lno-figures - -loutput: - -ladmon-graphics-path: - -ladmon-graphics-size: - -ladmon-graphics-extension: - -lclasssynopsis-language: - -lfuncsynopsis-style: - -lverbose - -lversion - -lhelp -' -options=`getopt -qn$progname $longopts -- c:d:e:o:nvVh "$@"` -if [ "$?" != "0" ]; then print_help 1>&2; exit 1; fi - -eval set -- "$options"; -while [ "$1" != "--" ]; do - case "$1" in - -c | --css-file) - doc_css_file="$2";; - -d | --chunk-depth) - doc_chunk_depth="$2";; - -e | --extension) - doc_extension="$2";; - -n | --no-figures) - doc_no_figures="1";; - -o | --output) - doc_output="$2";; - - --admon-graphics-path) - doc_admon_graphics_path="$2";; - --admon-graphics-size) - doc_admon_graphics_size="$2";; - --admon-graphics-extension) - doc_admon_graphics_extension="$2";; - --classsynopsis-language) - doc_classsynopsis_language="$2";; - --funcsynopsis-style) - doc_funcsynopsis_style="$2";; - - -v | --verbose) - doc_verbose=1;; - - -V | --version) - echo "$PROGRAM ($PACKAGE) $VERSION" - exit 0;; - -h | --help) - print_help - exit 0;; - --) - print_help 1>&2 - exit 1;; - esac - shift -done -shift - -if [ "$#" != "1" ]; then print_help 1>& 2; exit 1; fi; -doc_input="$1" -if [ ! -f "$doc_input" ]; then error "$doc_input: No such file"; fi -doc_indir=$( (cd $(dirname $doc_input) && pwd) ) -doc_infile=$(basename $doc_input) -if [ "x${doc_infile: -4}" == "x.xml" ]; then - doc_inbase=${doc_infile:0:$((${#doc_infile}-4))} -else - doc_inbase="$doc_infile" -fi - -if [ "x$doc_output" == "x" ]; then - doc_outdir=`pwd` - if [ "x$doc_extension" == "x" ]; then doc_extension='.xhtml'; fi - doc_outfile="${doc_inbase}${doc_extension}" -elif [ -d "$doc_output" -o "${doc_output: -1}" == "/" ]; then - mkdir_p "$doc_output" - doc_outdir=`(cd "$doc_output" && pwd)` - if [ "x$doc_extension" == "x" ]; then doc_extension='.xhtml'; fi - doc_outfile="${doc_inbase}${doc_extension}" -else - dir=`dirname "$doc_output"` - mkdir_p "$dir" - doc_outdir=`(cd "$dir" && pwd)` - doc_outfile=`basename "$doc_output"` - if [ "x$doc_extension" == "x" ]; then - doc_extension=`echo "$doc_outfile" | grep -o '\..*'` - fi; -fi; -if [ "x${doc_outfile: -${#doc_extension}}" == "x${doc_extension}" ]; then - doc_outbase="${doc_outfile:0:$((${#doc_outfile}-${#doc_extension}))}" -else - doc_outbase="${doc_outfile}" -fi - -params='--param db.chunk.chunk_top 0' -params="$params --stringparam db.chunk.basename \"$doc_outbase\"" -params="$params --stringparam db.chunk.extension \"$doc_extension\"" -if [ "x$doc_chunk_depth" != "x" ]; then - params="$params --param db.chunk.max_depth $doc_chunk_depth" -fi -if [ "x$doc_css_file" != "x" ]; then - params="$params --stringparam db2html.css.file \"$doc_css_file\"" -fi -if [ "x$doc_admon_graphics_path" != "x" ]; then - params="$params --stringparam db2html.admon.graphics_path" - params="$params \"$doc_admon_graphics_path\"" -fi -if [ "x$doc_admon_graphics_size" != "x" ]; then - params="$params --stringparam db2html.admon.graphics_size" - params="$params \"$doc_admon_graphics_size\"" -fi -if [ "x$doc_admon_graphics_extension" != "x" ]; then - params="$params --stringparam db2html.admon.graphics_extension" - params="$params \"$doc_admon_graphics_extension\"" -fi -if [ "x$doc_classsynopsis_language" != "x" ]; then - params="$params --stringparam db2html.classsynopsis.language" - params="$params \"$doc_classsynopsis_language\"" -fi -if [ "x$doc_funcsynopsis_style" != "x" ]; then - params="$params --stringparam db2html.funcsynopsis.style" - params="$params \"$doc_funcsynopsis_style\"" -fi - -cmd="xmllint --noent --xinclude \"$doc_indir/$doc_infile\" |\ - xsltproc $params -o \"$doc_outdir/$doc_outfile\" \"$xsltdir/docbook/html/db2html.xsl\" -" -echo_verbose "$cmd" -eval "$cmd" - -if [ "x$doc_no_figures" != "x1" -a "$doc_indir" != "$doc_outdir" ]; then - xmllint --noent --xinclude "$doc_indir/$doc_infile" \ - | xsltproc "$xsltdir/docbook/utils/figures.xsl" - \ - | while read fig; do - mkdir_p "$doc_outdir/"`dirname "$fig"` - cmd="cp \"$doc_indir/$fig\" \"$doc_outdir/$fig\"" - echo_verbose "$cmd" - eval "$cmd" - done -fi diff --git a/tools/gnome-doc-tool.in b/tools/gnome-doc-tool.in new file mode 100755 index 0000000..e4d7713 --- /dev/null +++ b/tools/gnome-doc-tool.in @@ -0,0 +1,251 @@ +#!/bin/sh +# gnome-doc-html - Convert documentation to HTML +# gnome-doc-html. Generated from gnome-doc-html.in by configure. +# Copyright (C) 2006 Shaun McCance <shaunm@gnome.org> +# +# This program 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 program 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +progname=`echo "$0" | sed 's%^.*/%%'` + +PROGRAM=gnome-doc-html +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +pkgdatadir=@datadir@/gnome-doc-utils +xsltdir=@datadir@/xml/gnome/xslt + +function error { + echo "$progname: $1" 1>&2; + exit 1; +} + +function print_help { + cat <<EOF +Usage: $progname <COMMAND> [OPTIONS] FILE +Process a documentation file. + +COMMAND is one of: + html convert the document to HTML + help display this help and exit +EOF +} + +function print_help_html { + cat <<EOF +Usage: $progname <COMMAND> [OPTIONS] FILE +Convert FILE into HTML. + +Basic Output Control: + -c, --css-file=FILE file to output CSS to + -d, --chunk-depth=INT how deep sections should be chunked + -e, --extension=EXT the extension to append to output files + -n, --no-figures do not copy figures into the output directory + -o, --output=PATH the file or directory to output to + +Formatting Control: + --admon-graphics-path=PATH the path to the admonition graphics + --admon-graphics-size=INT the size of the admonition graphics + --admon-graphics-extension=EXT the extension of the admonition grahpics + --classsynopsis-language=LANG the default programming language to be used + for classsynopsis elements + --funcsynopsis-style=STYLE the style to be used to render funcsynopsis + elements, either 'KR' or 'ANSI' + +Miscellaneous: + -v, --verbose print all the commands executed + -V, --version print version information and exit + -h, --help display this help and exit +EOF +} +function echo_verbose { + if [ "x$doc_verbose" == "x1" ]; then echo $1; fi +} +function mkdir_p { + dir=''; + echo $1 | sed -e 's/\//\n/g' | while read d; do + dir="$dir$d/" + if [ ! -d "$dir" ]; then + echo_verbose "mkdir \"$dir\"" + mkdir "$dir" + fi + done; +} + +function DO_html { + longopts=' + -lcss-file: + -lchunk-depth: + -lextension: + -lno-figures + -loutput: + -ladmon-graphics-path: + -ladmon-graphics-size: + -ladmon-graphics-extension: + -lclasssynopsis-language: + -lfuncsynopsis-style: + -lverbose + -lversion + -lhelp + '; + options=`getopt -qn$progname $longopts -- c:d:e:o:nvVh "$@"` + if [ "$?" != "0" ]; then print_help_html 1>&2; exit 1; fi + echo "$options" + eval set -- "$options"; + while [ "$1" != "--" ]; do + case "$1" in + -c | --css-file) + doc_css_file="$2";; + -d | --chunk-depth) + doc_chunk_depth="$2";; + -e | --extension) + doc_extension="$2";; + -n | --no-figures) + doc_no_figures="1";; + -o | --output) + doc_output="$2";; + + --admon-graphics-path) + doc_admon_graphics_path="$2";; + --admon-graphics-size) + doc_admon_graphics_size="$2";; + --admon-graphics-extension) + doc_admon_graphics_extension="$2";; + --classsynopsis-language) + doc_classsynopsis_language="$2";; + --funcsynopsis-style) + doc_funcsynopsis_style="$2";; + + -v | --verbose) + doc_verbose=1;; + + -V | --version) + echo "$PROGRAM ($PACKAGE) $VERSION" + exit 0;; + -h | --help) + print_help_html + exit 0;; + --) + print_help_html 1>&2 + exit 1;; + esac + shift + done + shift + + if [ "$#" != "1" ]; then print_help_html 1>& 2; exit 1; fi; + doc_input="$1" + if [ ! -f "$doc_input" ]; then error "$doc_input: No such file"; fi + doc_indir=$( (cd $(dirname $doc_input) && pwd) ) + doc_infile=$(basename $doc_input) + if [ "x${doc_infile: -4}" == "x.xml" ]; then + doc_inbase=${doc_infile:0:$((${#doc_infile}-4))} + else + doc_inbase="$doc_infile" + fi + + if [ "x$doc_output" == "x" ]; then + doc_outdir=`pwd` + if [ "x$doc_extension" == "x" ]; then doc_extension='.xhtml'; fi + doc_outfile="${doc_inbase}${doc_extension}" + elif [ -d "$doc_output" -o "${doc_output: -1}" == "/" ]; then + mkdir_p "$doc_output" + doc_outdir=`(cd "$doc_output" && pwd)` + if [ "x$doc_extension" == "x" ]; then doc_extension='.xhtml'; fi + doc_outfile="${doc_inbase}${doc_extension}" + else + dir=`dirname "$doc_output"` + mkdir_p "$dir" + doc_outdir=`(cd "$dir" && pwd)` + doc_outfile=`basename "$doc_output"` + if [ "x$doc_extension" == "x" ]; then + doc_extension=`echo "$doc_outfile" | grep -o '\..*'` + fi; + fi; + if [ "x${doc_outfile: -${#doc_extension}}" == "x${doc_extension}" ]; then + doc_outbase="${doc_outfile:0:$((${#doc_outfile}-${#doc_extension}))}" + else + doc_outbase="${doc_outfile}" + fi + + params='--param db.chunk.chunk_top 0' + params="$params --stringparam db.chunk.basename \"$doc_outbase\"" + params="$params --stringparam db.chunk.extension \"$doc_extension\"" + if [ "x$doc_chunk_depth" != "x" ]; then + params="$params --param db.chunk.max_depth $doc_chunk_depth" + fi + if [ "x$doc_css_file" != "x" ]; then + params="$params --stringparam db2html.css.file \"$doc_css_file\"" + fi + if [ "x$doc_admon_graphics_path" != "x" ]; then + params="$params --stringparam db2html.admon.graphics_path" + params="$params \"$doc_admon_graphics_path\"" + fi + if [ "x$doc_admon_graphics_size" != "x" ]; then + params="$params --stringparam db2html.admon.graphics_size" + params="$params \"$doc_admon_graphics_size\"" + fi + if [ "x$doc_admon_graphics_extension" != "x" ]; then + params="$params --stringparam db2html.admon.graphics_extension" + params="$params \"$doc_admon_graphics_extension\"" + fi + if [ "x$doc_classsynopsis_language" != "x" ]; then + params="$params --stringparam db2html.classsynopsis.language" + params="$params \"$doc_classsynopsis_language\"" + fi + if [ "x$doc_funcsynopsis_style" != "x" ]; then + params="$params --stringparam db2html.funcsynopsis.style" + params="$params \"$doc_funcsynopsis_style\"" + fi + + cmd="xmllint --noent --xinclude \"$doc_indir/$doc_infile\" |\ + xsltproc $params -o \"$doc_outdir/$doc_outfile\" \"$xsltdir/docbook/html/db2html.xsl\" -" + echo_verbose "$cmd" + eval "$cmd" + + if [ "x$doc_no_figures" != "x1" -a "$doc_indir" != "$doc_outdir" ]; then + xmllint --noent --xinclude "$doc_indir/$doc_infile" \ + | xsltproc "$xsltdir/docbook/utils/figures.xsl" - \ + | while read fig; do + mkdir_p "$doc_outdir/"`dirname "$fig"` + cmd="cp \"$doc_indir/$fig\" \"$doc_outdir/$fig\"" + echo_verbose "$cmd" + eval "$cmd" + done + fi +} + + +command="$1"; +shift; +if [ "$command" = "html" ]; then + DO_html $@; +elif [ "$command" = "-V" -o "$command" = "--version" ]; then + echo "$PROGRAM ($PACKAGE) $VERSION"; + exit 0; +elif [ "$command" = "help" ]; then + print_help; + exit 0; +else + print_help 1>&2; + exit 1; +fi; + |