[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xhtmltools-devel] Changes to xhtmltools/xhtml2html
From: |
Jaime E. Villate |
Subject: |
[Xhtmltools-devel] Changes to xhtmltools/xhtml2html |
Date: |
Wed, 20 Feb 2002 16:26:59 -0500 |
Index: xhtmltools/xhtml2html
diff -c xhtmltools/xhtml2html:1.1 xhtmltools/xhtml2html:1.2
*** xhtmltools/xhtml2html:1.1 Wed Oct 24 16:32:00 2001
--- xhtmltools/xhtml2html Wed Feb 20 16:26:58 2002
***************
*** 1,11 ****
#! /bin/sh
! # $Id: xhtml2html,v 1.1 2001/10/24 20:32:00 villate Exp $
#
# xhtml2html - creates an html file from an XHTML file
#
! # Copyright (C) Jaime Villate <address@hidden>, 2001
#
! # 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.
--- 1,13 ----
#! /bin/sh
! # $Id: xhtml2html,v 1.2 2002/02/20 21:26:58 villate Exp $
#
# xhtml2html - creates an html file from an XHTML file
#
! # Copyright (C) 2001, 2002, Jaime Villate <address@hidden>
#
! # This program is part of xhtmltools
! #
! # xhtmltools 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.
***************
*** 21,71 ****
# edit the following line with the directory where the default XSL pages are
! XSL=/usr/lib/sgml/stylesheet/xsl
! STYLESHEET='xhtml2html.xsl'
TMP=XHTML2HTML-TEMP-$$
! case $1 in
-s) STYLESHEET=$2
! shift 2
;;
-h|--help)
! echo "Usage: `basename $0` [-s stylesheet] file.xhtml" >&2
! exit 1
;;
! esac
! if [ $# -gt 2 ]
! then
! echo "Usage: `basename $0` [-s stylesheet] file.xhtml" >&2
! exit 1
! fi
! if [ $# -eq 1 ]
then
! XSLFILE=$STYLESHEET
! if [ ! -r $STYLESHEET ]
then
! XSLFILE=$XSL/$STYLESHEET
! if [ ! -r $XSLFILE ]
then
! echo Cannot read \"$STYLESHEET\". Exiting. >&2
! exit 1
! fi
fi
- if [ ! -r $1 ]
- then
- echo Cannot read \"$1\". Exiting. >&2
- exit 1
- fi
-
- perl -pe '$| = 1; s/mode: xml \*\*\*/mode: html \*\*\*/' $1 > $TMP
-
- sabcmd $XSLFILE $TMP || (rm -f $TMP; exit 1)
- rm -f $TMP
- exit 0
else
! echo "Usage: `basename $0` [-s stylesheet] file.xhtml" >&2
exit 1
fi
--- 23,97 ----
# edit the following line with the directory where the default XSL pages are
! XSLTHTML='/usr/share/sgml/xhtmltools/xhtml2html.xsl'
TMP=XHTML2HTML-TEMP-$$
+ PARSER='xsltproc -nonet $XSLT $XHTML'
+ CONFFILE=~/.xhtmltools-conf
+
+ usage() {
+ echo "Usage:" 1>&2
+ echo " `basename $0` [-s stylesheet] [-c config] xhtmlfile" 1>&2
+ echo " " 1>&2
+ exit 1
+ }
! [[ $# -lt 1 ]] && usage
!
! while [[ $# -gt 0 ]]
! do
! case $1 in
-s) STYLESHEET=$2
! shift
;;
-h|--help)
! usage
! ;;
! -c) CONFFILE=$2
! shift
! ;;
! -*)
! usage
;;
! *)
! XHTMLFILE=$1
! esac
! shift
! done
! [[ -n $XHTMLFILE ]] || usage
!
! [[ -r $CONFFILE ]] && source $CONFFILE
!
! XSLTDIR=$(dirname $XSLTHTML)
! if [[ -n $STYLESHEET ]]
then
! if [[ -r $STYLESHEET ]]
then
! XSLT=$STYLESHEET
! elif [[ -r $XSLTDIR/$STYLESHEET ]]
then
! XSLT=$XSLTDIR/$STYLESHEET
! else
! XSLT=$STYLESHEET
fi
else
! XSLT=$XSLTHTML
! fi
!
! if [[ ! -r $XSLT ]]
! then
! echo Cannot find stylesheet \"$XSLT\" >&2
! exit 1
! fi
! if [[ ! -r $XHTMLFILE ]]
! then
! echo Cannot read XHTML file \"$1\" >&2
exit 1
fi
+ perl -pe '$| = 1; s/mode: xml \*\*\*/mode: html \*\*\*/' $XHTMLFILE > $TMP
+ XHTML=$TMP
+ eval $PARSER || (rm -f $TMP; exit 1)
+ rm -f $TMP
+ exit 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Xhtmltools-devel] Changes to xhtmltools/xhtml2html,
Jaime E. Villate <=