Update of /cvsroot/javadocbook/javadocbook/src/net/sf/javadocbook
In directory usw-pr-cvs1:/tmp/cvs-serv6376/net/sf/javadocbook
Modified Files:
Main.java
Log Message:
Applied patch (578545) adding an option for using a custom XSL file instead of an included Docbook XSL file.
Index: Main.java
===================================================================
RCS file: /cvsroot/javadocbook/javadocbook/src/net/sf/javadocbook/Main.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Main.java 8 Jul 2002 22:55:56 -0000 1.15
--- Main.java 8 Jul 2002 23:40:12 -0000 1.16
***************
*** 38,41 ****
--- 38,42 ----
import java.io.IOException;
import java.io.OutputStream;
+ import java.net.MalformedURLException;
import java.net.URL;
***************
*** 134,137 ****
--- 135,140 ----
options.addOption('h', "help", false, "Shows this help message.");
options.addOption('o', "output", true, "File to write output to. If omitted, standard output is used.");
+ options.addOption('s', "XSL", true, "Specifies a custom XSL Style Sheet to use in the transformation" +
+ "--ty[e is ignored if this options is used.");
options.addOption('t', "type", true, "Specifies type of output to be created. Possible values are: " +
PARAM_FO + ", " + PARAM_HTML + " or " + PARAM_XHTML);
***************
*** 148,161 ****
String output = cmds.getOptionValue('o');
! String styleSheet = null;
! String type = cmds.getOptionValue('t', PARAM_HTML);
! if (type.equalsIgnoreCase(PARAM_FO)) {
! styleSheet = FO_STYLE_SHEET;
! } else if (type.equalsIgnoreCase(PARAM_HTML)) {
! styleSheet = HTML_STYLE_SHEET;
! } else if (type.equalsIgnoreCase(PARAM_XHTML)) {
! styleSheet = XHTML_STYLE_SHEET;
} else {
! argumentError("Unrecognized type: " + type, 2);
}
--- 151,186 ----
String output = cmds.getOptionValue('o');
! URL styleSheetURL = null;
! if (cmds.hasOption('s')) {
! String fileName = cmds.getOptionValue('s');
! File f = new File(fileName);
! if (!f.exists()) {
! System.err.println("XSL file '" + fileName + "' does not exist.");
! System.exit(1);
! }
! try {
! styleSheetURL = f.toURL();
! } catch (MalformedURLException e) {
! System.err.println(e.getLocalizedMessage());
! System.exit(1);
! }
} else {
! String styleSheet = null;
! String type = cmds.getOptionValue('t', PARAM_HTML);
! if (type.equalsIgnoreCase(PARAM_FO)) {
! styleSheet = FO_STYLE_SHEET;
! } else if (type.equalsIgnoreCase(PARAM_HTML)) {
! styleSheet = HTML_STYLE_SHEET;
! } else if (type.equalsIgnoreCase(PARAM_XHTML)) {
! styleSheet = XHTML_STYLE_SHEET;
! } else {
! argumentError("Unrecognized type: " + type, 2);
! }
! // Use a URL to get the stylesheet since the stylesheet will be stored in a .jar
! styleSheetURL = new Object().getClass().getResource(styleSheet);
! if (styleSheetURL == null) {
! System.err.println("Could not find style sheet " + styleSheet);
! System.exit(1);
! }
}
***************
*** 187,194 ****
return;
}
- // Use a URL to get the stylesheet since the stylesheet will be stored in a .jar
- URL styleSheetURL = new Object().getClass().getResource(styleSheet);
- if (styleSheetURL == null)
- throw new RuntimeException("Could not find style sheet: " + styleSheet);
transform(in, out, styleSheetURL);
--- 212,215 ----
***************
*** 204,207 ****
--- 225,231 ----
/*
* $Log$
+ * Revision 1.16 2002/07/08 23:40:12 heathm
+ * Applied patch (578545) adding an option for using a custom XSL file instead of an included Docbook XSL file.
+ *
* Revision 1.15 2002/07/08 22:55:56 heathm
* Merged my changes with Devin's patch.
|