summaryrefslogtreecommitdiffstats
path: root/scilab/modules/helptools
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre.ledru@scilab.org>2010-02-22 11:56:39 +0100
committerSylvestre Ledru <sylvestre.ledru@scilab.org>2010-02-22 11:56:39 +0100
commit163a7906bea21a424f94b8643beb1ac6a20aeb60 (patch)
tree5088f0d5b19122fd3f5ee58813ea111e7a956275 /scilab/modules/helptools
parentc6ce5230290b5edaeca9aaa95bd866510df3b3c6 (diff)
parentb910e072ae7f53378f8c073d371df1d42ad533cf (diff)
downloadscilab-163a7906bea21a424f94b8643beb1ac6a20aeb60.zip
scilab-163a7906bea21a424f94b8643beb1ac6a20aeb60.tar.gz
Merge remote branch 'origin/5.2'
Conflicts: scilab/CHANGES_5.2.X scilab/configure scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/Category.java
Diffstat (limited to 'scilab/modules/helptools')
-rw-r--r--scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java12
-rw-r--r--scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java58
-rw-r--r--scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java4
3 files changed, 47 insertions, 27 deletions
diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java
index 130b0f5..03affe3 100644
--- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java
+++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java
@@ -48,6 +48,8 @@ public class BuildDocObject extends StyleSheet {
48 private static final String GRAPHICSIZE_EXTENSION_0 = "graphicsize.extension=0"; 48 private static final String GRAPHICSIZE_EXTENSION_0 = "graphicsize.extension=0";
49 private static final String TOC_SECTION_DEPTH_3 = "toc.section.depth=3"; 49 private static final String TOC_SECTION_DEPTH_3 = "toc.section.depth=3";
50 private static final String SECTION_AUTOLABEL_1 = "section.autolabel=1"; 50 private static final String SECTION_AUTOLABEL_1 = "section.autolabel=1";
51 private static final String USE_ID_AS_FILENAME = "use.id.as.filename=1";
52 private static final String GENERATE_TOC = "\"generate.toc= \"";
51 53
52 private String outputDirectory; 54 private String outputDirectory;
53 private String format; 55 private String format;
@@ -139,7 +141,7 @@ public class BuildDocObject extends StyleSheet {
139 141
140 /* HTML Format */ 142 /* HTML Format */
141 if (format.equalsIgnoreCase("HTML")) { 143 if (format.equalsIgnoreCase("HTML")) {
142 specificArgs.add("use.id.as.filename=1"); 144 specificArgs.add(USE_ID_AS_FILENAME);
143 specificArgs.add("html.stylesheet=html.css"); 145 specificArgs.add("html.stylesheet=html.css");
144 specificArgs.add(USE_EXTENSIONS_1); 146 specificArgs.add(USE_EXTENSIONS_1);
145 specificArgs.add(GRAPHICSIZE_EXTENSION_0); 147 specificArgs.add(GRAPHICSIZE_EXTENSION_0);
@@ -162,11 +164,11 @@ public class BuildDocObject extends StyleSheet {
162 164
163 /* CHM Format */ 165 /* CHM Format */
164 if (format.equalsIgnoreCase("CHM")) { 166 if (format.equalsIgnoreCase("CHM")) {
165 specificArgs.add("use.id.as.filename=1"); 167 specificArgs.add(USE_ID_AS_FILENAME);
166 specificArgs.add("html.stylesheet=htmlhelp.css"); 168 specificArgs.add("html.stylesheet=htmlhelp.css");
167 specificArgs.add(USE_EXTENSIONS_1); 169 specificArgs.add(USE_EXTENSIONS_1);
168 specificArgs.add(GRAPHICSIZE_EXTENSION_0); 170 specificArgs.add(GRAPHICSIZE_EXTENSION_0);
169 specificArgs.add("\"generate.toc= \""); 171 specificArgs.add(GENERATE_TOC);
170 this.styleDoc = docbookPath + "/htmlhelp/htmlhelp.xsl"; 172 this.styleDoc = docbookPath + "/htmlhelp/htmlhelp.xsl";
171 173
172 /* Copy the css file for thr HTML pages */ 174 /* Copy the css file for thr HTML pages */
@@ -188,8 +190,8 @@ public class BuildDocObject extends StyleSheet {
188 // JavaHelp 190 // JavaHelp
189 specificArgs.add(USE_EXTENSIONS_1); 191 specificArgs.add(USE_EXTENSIONS_1);
190 specificArgs.add(GRAPHICSIZE_EXTENSION_0); 192 specificArgs.add(GRAPHICSIZE_EXTENSION_0);
191 specificArgs.add("\"generate.toc= \""); 193 specificArgs.add(GENERATE_TOC);
192 specificArgs.add("use.id.as.filename=1"); 194 specificArgs.add(USE_ID_AS_FILENAME);
193 this.styleDoc = docbookPath + "/javahelp/javahelp.xsl"; 195 this.styleDoc = docbookPath + "/javahelp/javahelp.xsl";
194 } 196 }
195 this.format = format; 197 this.format = format;
diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java
index 15b6256..4af808c 100644
--- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java
+++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java
@@ -1,6 +1,7 @@
1/* 1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008 - INRIA - Hussein SHAFIE 3 * Copyright (C) 2008 - INRIA - Hussein SHAFIE
4 * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU
4 * 5 *
5 * This file must be used under the terms of the CeCILL. 6 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which 7 * This source file is licensed as described in the file COPYING, which
@@ -57,10 +58,7 @@ import org.scilab.forge.jlatexmath.TeXFormula;
57import java.awt.Color; 58import java.awt.Color;
58 59
59/** 60/**
60 * @TODO add comment 61 * Preprocess before building the documentation
61 *
62 * @param inFile
63 * @param outFile
64 */ 62 */
65public class CopyConvert extends DefaultHandler implements ErrorHandler { 63public class CopyConvert extends DefaultHandler implements ErrorHandler {
66 64
@@ -90,12 +88,22 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
90 private LaTeXElement latexElem = null; 88 private LaTeXElement latexElem = null;
91 private boolean isLatexConverted = true; 89 private boolean isLatexConverted = true;
92 90
93 public void setVerbose(boolean verbose){ 91 /**
94 this.verbose=verbose; 92 * Enables the verbose mode
93 *
94 * @param verbose true if enable
95 */
96 public void setVerbose(boolean verbose) {
97 this.verbose = verbose;
95 } 98 }
96 99
97 public void setPrintFormat(String printFormat){ 100 /**
98 this.printFormat=printFormat; 101 * Set the print format
102 *
103 * @param printFormat The print format
104 */
105 public void setPrintFormat(String printFormat) {
106 this.printFormat = printFormat;
99 } 107 }
100 108
101 public void setLatexConverted(boolean isLatexConverted){ 109 public void setLatexConverted(boolean isLatexConverted){
@@ -104,9 +112,15 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
104 112
105 // ----------------------------------------------------------------------- 113 // -----------------------------------------------------------------------
106 114
107 public void run(File inFile, File outFile) 115 /**
116 * Run the copy/convert process
117 *
118 * @param inFile Input file
119 * @param outFile Output file
120 */
121 public void run(File inFile, File outputFile)
108 throws SAXParseException, SAXException, IOException { 122 throws SAXParseException, SAXException, IOException {
109 outFile = outFile.getCanonicalFile(); 123 File outFile = outputFile.getCanonicalFile();
110 outDir = outFile.getParentFile(); 124 outDir = outFile.getParentFile();
111 if (!outDir.isDirectory() && !outDir.mkdirs()) { 125 if (!outDir.isDirectory() && !outDir.mkdirs()) {
112 throw new IOException("Cannot create directory '" + outDir + "'"); 126 throw new IOException("Cannot create directory '" + outDir + "'");
@@ -124,7 +138,7 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
124 parser = factory.newSAXParser(); 138 parser = factory.newSAXParser();
125 } catch (Exception e) { 139 } catch (Exception e) {
126 throw new SAXParseException( 140 throw new SAXParseException(
127 "Cannot create a properly configured SAX parser: " + Helpers.reason(e),locator); 141 "Cannot create a properly configured SAX parser: " + Helpers.reason(e), locator);
128 } 142 }
129 143
130 inScopePrefixes = new ArrayList<String[]>(); 144 inScopePrefixes = new ArrayList<String[]>();
@@ -141,10 +155,10 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
141 if (out.checkError()) { 155 if (out.checkError()) {
142 throw new IOException("Error writing '" + outFile + "'"); 156 throw new IOException("Error writing '" + outFile + "'");
143 } 157 }
144 } catch (SAXException e){ 158 } catch (SAXException e) {
145 if (locator!=null){ 159 if (locator != null) {
146 throw new SAXParseException("Cannot parse " + inFile + " " + Helpers.reason(e),locator); 160 throw new SAXParseException("Cannot parse " + inFile + " " + Helpers.reason(e), locator);
147 }else{ 161 } else {
148 throw new SAXException("Cannot parse " + inFile + " " + Helpers.reason(e)); 162 throw new SAXException("Cannot parse " + inFile + " " + Helpers.reason(e));
149 } 163 }
150 } finally { 164 } finally {
@@ -156,6 +170,11 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
156 // ContentHandler 170 // ContentHandler
157 // ----------------------------------------------------------------------- 171 // -----------------------------------------------------------------------
158 172
173 /**
174 * Set the document Locator
175 *
176 * @param locator The locator
177 */
159 public void setDocumentLocator(Locator locator) { 178 public void setDocumentLocator(Locator locator) {
160 this.locator = locator; 179 this.locator = locator;
161 } 180 }
@@ -354,8 +373,7 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
354 mainOut = null; 373 mainOut = null;
355 374
356 if (extractedFile != null) { 375 if (extractedFile != null) {
357 reportInfo("Extracted embedded graphics from '"+extractedFile+"' to '" 376 reportInfo("Extracted embedded graphics from '" + extractedFile + "' to '" + extractedFile + "'.");
358 + extractedFile + "'.");
359 377
360 String converted = copyConvertGraphics(extractedFile); 378 String converted = copyConvertGraphics(extractedFile);
361 if (converted != null) { 379 if (converted != null) {
@@ -643,10 +661,10 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
643 private boolean convertMathML(File inFile, File outFile) { 661 private boolean convertMathML(File inFile, File outFile) {
644 MutableLayoutContext context = new LayoutContextImpl(LayoutContextImpl 662 MutableLayoutContext context = new LayoutContextImpl(LayoutContextImpl
645 .getDefaultLayoutContext()); 663 .getDefaultLayoutContext());
646 context.setParameter(Parameter.ANTIALIAS,"true"); 664 context.setParameter(Parameter.ANTIALIAS, "true");
647 // Workaround a XEP problem. FOP 1 is OK. 665 // Workaround a XEP problem. FOP 1 is OK.
648 context.setParameter(Parameter.MATHBACKGROUND,"#FFFFFF"); 666 context.setParameter(Parameter.MATHBACKGROUND, "#FFFFFF");
649 context.setParameter(Parameter.MATHSIZE,"18"); 667 context.setParameter(Parameter.MATHSIZE, "18");
650 668
651 try { 669 try {
652 Converter.getInstance().convert(inFile, outFile, "image/png", context); 670 Converter.getInstance().convert(inFile, outFile, "image/png", context);
diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java
index b598654..3ac7bf5 100644
--- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java
+++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java
@@ -82,7 +82,7 @@ public final class Helpers {
82 } 82 }
83 83
84 public static String getTemporaryNameFo(String baseDirectory) { 84 public static String getTemporaryNameFo(String baseDirectory) {
85 return baseDirectory+"/__doc.fo"; 85 return baseDirectory + "/__doc.fo";
86 } 86 }
87 87
88 public static String getFileExtension(File file) { 88 public static String getFileExtension(File file) {
@@ -190,7 +190,7 @@ public final class Helpers {
190 */ 190 */
191 public static void deleteDirectory(File dir) { 191 public static void deleteDirectory(File dir) {
192 192
193 String files[] = dir.list(); 193 String[] files = dir.list();
194 if (files == null) { 194 if (files == null) {
195 files = new String[0]; 195 files = new String[0];
196 } 196 }