SOURCES: odtransform.sh - more online help - if no stylesheet given, use th...
pawelz
pawelz at pld-linux.org
Tue Jan 27 15:22:17 CET 2009
Author: pawelz Date: Tue Jan 27 14:22:17 2009 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- more online help
- if no stylesheet given, use the default one
- check if the input files exist
---- Files affected:
SOURCES:
odtransform.sh (1.3 -> 1.4)
---- Diffs:
================================================================
Index: SOURCES/odtransform.sh
diff -u SOURCES/odtransform.sh:1.3 SOURCES/odtransform.sh:1.4
--- SOURCES/odtransform.sh:1.3 Tue Jan 27 13:23:09 2009
+++ SOURCES/odtransform.sh Tue Jan 27 15:22:11 2009
@@ -19,7 +19,11 @@
usage() {
cat << EOF
odtversion rev 19
-Usage: $0 [stylesheet] [OpenDocument]
+Usage: $0 [stylesheet] [OpenDocument] - apply stylesheet to OpenDocument
+ $0 [OpenDocument] - convert OpenDocument to XML-FOP
+Example:
+ Convert OpenDocument to PDF file:
+ $0 document.odt | fop /dev/sdtin file.pdf
EOF
}
@@ -42,21 +46,44 @@
shift
;;
--help)
- usage()
- exit
- ;;
+odtransform.sh
+ usage
+ exit 0
+ ;;
*)
break
;;
esac
done
+if [ "$#" == 2 ]; then
+ STYLESHEET=$1
+ shift 1
+else
+ STYLESHEET=/usr/share/odtransform/ooo2xslfo.xslt
+fi
+
+if [ "$#" -ne "1" ]; then
+ usage
+ exit 1
+fi
+
CLASSPATH=$(build-classpath commons-logging log4j jaxp_parser_impl xalan odtransform)
+if ! [ -r $STYLESHEET ]; then
+ echo "Could not open $STYLESHEET file" >&2
+ exit 1
+fi
+
+if ! [ -r $1 ]; then
+ echo "Could not open $1 file" >&2
+ exit 1
+fi
+
if [ $DEBUG != 0 ]; then
echo '*****************************************************'
- echo $JAVA_CMD -Dlog4j.configuration=file:$LOG4JPROPS -cp $CLASSPATH org.clazzes.odtransform.OdtTransform ${1:+"$@"}
+ echo $JAVA_CMD -Dlog4j.configuration=file:$LOG4JPROPS -cp $CLASSPATH org.clazzes.odtransform.OdtTransform $STYLESHEET ${1:+"$@"}
echo '*****************************************************'
fi
-$JAVA_CMD -Dlog4j.configuration=file:$LOG4JPROPS -cp $CLASSPATH org.clazzes.odtransform.OdtTransform ${1:+"$@"}
+$JAVA_CMD -Dlog4j.configuration=file:$LOG4JPROPS -cp $CLASSPATH org.clazzes.odtransform.OdtTransform $STYLESHEET ${1:+"$@"}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/odtransform.sh?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list