Jrst-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
April 2011
- 2 participants
- 14 discussions
r568 - in trunk/jrst/src/test: java/org/nuiton/jrst/bugs resources/bugs
by echatellier@users.nuiton.org 27 Apr '11
by echatellier@users.nuiton.org 27 Apr '11
27 Apr '11
Author: echatellier
Date: 2011-04-27 14:05:06 +0200 (Wed, 27 Apr 2011)
New Revision: 568
Url: http://nuiton.org/repositories/revision/jrst/568
Log:
#877 : Perte du titre de table des mati?\195?\168res
Added:
trunk/jrst/src/test/resources/bugs/testContent877.rst
Modified:
trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java
Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java
===================================================================
--- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java 2011-04-27 11:43:27 UTC (rev 567)
+++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java 2011-04-27 12:05:06 UTC (rev 568)
@@ -65,4 +65,20 @@
Assert.assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0);
Assert.assertTrue(content.indexOf("width=\"49%\" height=\"49%\"") > 0);
}
+
+ /**
+ * Test que le titre d'un content n'est pas perdu.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testContentDirective() throws Exception {
+ File in = new File("src/test/resources/bugs/testContent877.rst");
+ File out = File.createTempFile("jrst-testContent", ".html");
+ out.deleteOnExit();
+ JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME);
+
+ String content = FileUtils.readFileToString(out);
+ Assert.assertTrue(content.indexOf("Table des matières") > 0);
+ }
}
Added: trunk/jrst/src/test/resources/bugs/testContent877.rst
===================================================================
--- trunk/jrst/src/test/resources/bugs/testContent877.rst (rev 0)
+++ trunk/jrst/src/test/resources/bugs/testContent877.rst 2011-04-27 12:05:06 UTC (rev 568)
@@ -0,0 +1,9 @@
+Test content
+============
+
+.. contents:: Table des matières
+
+Test
+----
+
+Test que le titre du sommaire est toujours là.
1
0
r567 - in trunk: . jrst jrst/src/main/java/org/nuiton/jrst jrst/src/main/resources/i18n
by echatellier@users.nuiton.org 27 Apr '11
by echatellier@users.nuiton.org 27 Apr '11
27 Apr '11
Author: echatellier
Date: 2011-04-27 13:43:27 +0200 (Wed, 27 Apr 2011)
New Revision: 567
Url: http://nuiton.org/repositories/revision/jrst/567
Log:
#7 Replace uk.co.flamingpenguin.jewelcli by ApplicationConfig
Added:
trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java
trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java
trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java
Modified:
trunk/jrst/pom.xml
trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java
trunk/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java
trunk/jrst/src/main/resources/i18n/jrst_en_GB.properties
trunk/jrst/src/main/resources/i18n/jrst_fr_FR.properties
trunk/pom.xml
Modified: trunk/jrst/pom.xml
===================================================================
--- trunk/jrst/pom.xml 2011-04-27 08:35:27 UTC (rev 566)
+++ trunk/jrst/pom.xml 2011-04-27 11:43:27 UTC (rev 567)
@@ -91,12 +91,7 @@
<artifactId>xalan</artifactId>
<groupId>xalan</groupId>
</dependency> -->
- <!-- Annoted interfaces to present command line arguments -->
<dependency>
- <groupId>uk.co.flamingpenguin.jewelcli</groupId>
- <artifactId>jewelcli</artifactId>
- </dependency>
- <dependency>
<groupId>net.sf.docbook</groupId>
<artifactId>docbook-xsl</artifactId>
<type>zip</type>
Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java
===================================================================
--- trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2011-04-27 08:35:27 UTC (rev 566)
+++ trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2011-04-27 11:43:27 UTC (rev 567)
@@ -25,12 +25,9 @@
package org.nuiton.jrst;
-import static org.nuiton.i18n.I18n._;
-
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -42,9 +39,10 @@
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringReader;
-import java.lang.reflect.Method;
import java.net.URL;
import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
@@ -69,9 +67,10 @@
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.ClassPathI18nInitializer;
import org.nuiton.jrst.convertisor.DocUtils2RST;
import org.nuiton.jrst.convertisor.DocUtilsVisitor;
-import org.nuiton.util.FileCompletion;
+import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.FileUtil;
import org.nuiton.util.Resource;
import org.nuiton.util.StringUtil;
@@ -80,12 +79,6 @@
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
-import uk.co.flamingpenguin.jewel.cli.Cli;
-import uk.co.flamingpenguin.jewel.cli.CliFactory;
-import uk.co.flamingpenguin.jewel.cli.CommandLineInterface;
-import uk.co.flamingpenguin.jewel.cli.Option;
-import uk.co.flamingpenguin.jewel.cli.Unparsed;
-
/**
* FIXME: 'JRST --help' doesn't work, but 'JRST --help toto' work :( FIXME:
* 'JRST -c' doesn't work, but 'JRST -c toto'
@@ -98,7 +91,6 @@
* Last update: $Date$
* by : $Author$
*/
-@CommandLineInterface(application = "JRST")
public class JRST {
public enum Overwrite {
@@ -130,8 +122,10 @@
/** XSL Stylesheet to transform Docbook into PDF. */
protected static final String docbook2fo = "/docbook/fo/docbook.xsl";
+ public static final String PATTERN_TYPE = "xml|xhtml|docbook|html|xdoc|rst|fo|pdf|odt|rtf";
+
/** HTML output format type */
- public static final String TYPE_HTML = "html";
+ public static final String TYPE_HTML = "html";
/** XDOC output format type */
public static final String TYPE_XDOC = "xdoc";
@@ -180,13 +174,14 @@
}
/**
+ * Main method.
*
- * @param args
- * @throws Exception
+ * @param args main args
+ * @throws Exception
*/
public static void main(String[] args) throws Exception {
- I18n.init(null, null);
+ I18n.init(new ClassPathI18nInitializer(), Locale.UK);
if (args.length == 0) {
args = askOption();
@@ -195,27 +190,26 @@
System.exit(0);
}
- JRSTOption option = CliFactory.parseArguments(JRSTOption.class, args);
+ ApplicationConfig config = JRSTConfig.getConfig(args);
+ config.doAction(0);
- if (option.isHelp()) {
- Cli<JRSTOption> cli = CliFactory.createCli(JRSTOption.class);
- System.out.println(cli.getHelpMessage());
- return;
+ // parse options
+ String xslList = JRSTConfigOption.XSL_FILE.getOption(config);
+ if (xslList == null) {
+ xslList = JRSTConfigOption.OUT_TYPE.getOption(config);
}
- if (option.isConsole()) {
- args = askOptionText();
+ List<String> unparsed = config.getUnparsed();
+ if (unparsed.isEmpty()) {
+ JRSTConfig.help();
}
- option = CliFactory.parseArguments(JRSTOption.class, args);
- // search xsl file list to apply
- String xslList = null;
- if (option.isXslFile()) {
- xslList = option.getXslFile();
- } else {
- xslList = option.getOutType();
+ File inputFile = new File(config.getUnparsed().get(0));
+ File ouputFile = JRSTConfigOption.OUT_FILE.getOptionAsFile(config);
+ Overwrite overwrite = Overwrite.NEVER;
+ if (JRSTConfigOption.FORCE.getOptionAsBoolean(config)) {
+ overwrite = Overwrite.ALLTIME;
}
-
- generate(xslList, option.getFile(), option.getOutFile(), option
- .isForce() ? Overwrite.ALLTIME : Overwrite.NEVER);
+
+ generate(xslList, inputFile, ouputFile, overwrite);
}
private static String[] askOption() throws SecurityException,
@@ -225,18 +219,13 @@
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
- boolean done = false;
if (!(gs == null)) {
if (gs.length > 0) {
result = askOptionGraph();
- done = true;
}
}
- if (!done) {
- result = askOptionText();
- }
} catch (java.awt.HeadlessException e) {
- result = askOptionText();
+ result = null;
}
return result;
@@ -244,168 +233,20 @@
}
/**
- * interface graphique
+ * Interface graphique.
*
* @return
* @throws SecurityException
* @throws NoSuchMethodException
*/
- private static String[] askOptionGraph() throws SecurityException,
+ protected static String[] askOptionGraph() throws SecurityException,
NoSuchMethodException {
-
- Method m = JRSTOption.class.getMethod("getOutType");
- Option a = m.getAnnotation(Option.class);
- JRSTInterface graph = new JRSTInterface(a.pattern());
- // String[] result=graph.askOption();
+ JRSTInterface graph = new JRSTInterface(PATTERN_TYPE);
+
return graph.getCmd();
}
- /**
- * Interface textuel
- *
- * @return String[]
- * @throws IOException
- */
- private static String[] askOptionText() throws IOException {
-
- System.out.println(_("help?"));
- Boolean done = false;
- String cheminRST = "";
- while (!done) {
- System.out.println(_("rstFile?"));
- cheminRST = lireFile(false, false);
- if (cheminRST.length() == 0) {
- System.exit(0);
- }
- File fileRST = new File(cheminRST);
- if (!fileRST.exists()) {
- System.out.println(_("dontExist"));
- cheminRST = "";
- } else {
- done = true;
- }
- }
- done = false;
- String type = "";
- while (!done) {
- type = "";
- System.out.println(_("outputFormat?"));
- type = lire();
- if (type.matches("xhtml|docbook|xml|html|xdoc|rst|pdf|odt|rtf")
- || type.length() == 0) {
- done = true;
- }
- }
- String cheminXSL = "";
- if (type.length() == 0) {
- done = false;
- while (!done) {
- System.out.println(_("xslFile?"));
- String cheminXSLtmp = lireFile(false, true);
-
- File fileRST = new File(cheminXSLtmp);
- if (cheminXSLtmp.equals("")) {
- if (cheminXSL.length() != 0) {
- cheminXSL = cheminXSL.substring(0,
- cheminXSL.length() - 1);
- }
- done = true;
- } else {
- if (!fileRST.exists()) {
- System.out.println(_("dontExist"));
- } else {
- cheminXSL += cheminXSLtmp;
- String other = "";
- do {
- System.out.println(_("other?"));
- other = lire();
- } while (!other.matches("y|n|o"));
- if (other.equals("y") || other.equals("o")) {
- cheminXSL += ",";
- }
- else if (other.equals("n")) {
- done = true;
- }
- }
- }
-
- }
- if (cheminXSL.length() == 0
- || !type
- .matches("xhtml|docbook|xml|html|xdoc|rst|pdf|odt|rtf")) {
- type = "xml";
- }
- }
- boolean ecraser = false;
- done = false;
- String cheminSortie = "";
- while (!done) {
- System.out.println(_("outputFile?"));
- cheminSortie = lireFile(true, true);
-
- File fileRST = new File(cheminSortie);
- if (fileRST.exists()) {
- String strEcraser = "";
- do {
- System.out.println(_("overwrite?"));
- strEcraser = lire();
- } while (!strEcraser.matches("y|n|o"));
- if (strEcraser.equals("y") || strEcraser.equals("o")) {
- done = true;
- ecraser = true;
- }
- } else {
- done = true;
- }
- }
- String cmd = "";
- if (ecraser) {
- cmd += "--force ";
- }
- cmd += "-t " + type;
- if (cheminXSL.length() > 0) {
- cmd += " -x " + cheminXSL;
- }
- if (cheminSortie.length() > 0) {
- cmd += " -o " + cheminSortie;
- }
- cmd += " " + cheminRST + " ";
- return cmd.split(" ");
- }
-
- /**
- * lit une ligne
- *
- * @return String
- */
- public static String lire() {
-
- String ligne_lue = null;
- try {
- InputStreamReader isr = new InputStreamReader(System.in);
- BufferedReader br = new BufferedReader(isr);
- ligne_lue = br.readLine();
- } catch (IOException e) {
- System.err.println(e);
- }
- return ligne_lue;
-
- }
-
- public static String lireFile(boolean enreg, boolean exit)
- throws IOException {
- String line = "";
- FileCompletion fc = new FileCompletion(enreg, exit);
- if (fc.consoleAvailable()) {
- line = fc.read();
- }
- if (line == null) {
- line = "";
- }
- return line;
- }
-
public static void generate(String xslListOrOutType, File fileIn,
File fileOut, Overwrite overwrite) throws Exception {
generate(xslListOrOutType, fileIn, "UTF-8", fileOut, "UTF-8", overwrite);
@@ -633,40 +474,4 @@
}
}
}
-
- /**
- * Les options
- */
- public interface JRSTOption {
-
- @Option(description = "display this help and exit")
- boolean isHelp();
-
- @Option(description = "overwrite existing out file")
- boolean isForce();
-
- @Option(shortName = "c", description = "Console mode")
- boolean isConsole();
-
- @Option(shortName = "x", description = "XSL file list to apply, comma separated")
- String getXslFile();
-
- boolean isXslFile();
-
- @Option(shortName = "t", pattern = "xml|xhtml|docbook|html|xdoc|rst|fo|pdf", // TODO
- // odt|rtf",
- description = "Output type")
- String getOutType();
-
- boolean isOutType();
-
- @Option(shortName = "o", description = "Output file")
- File getOutFile();
-
- boolean isOutFile();
-
- @Unparsed(name = "FILE")
- File getFile();
- }
-
}
Added: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java
===================================================================
--- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java (rev 0)
+++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java 2011-04-27 11:43:27 UTC (rev 567)
@@ -0,0 +1,121 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jrst;
+
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ArgumentsParserException;
+
+/**
+ * Permet la configuration de JRST pour son execution (parsing de la ligne
+ * de commande).
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class JRSTConfig {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(JRSTConfig.class);
+
+ private JRSTConfig() {
+ }
+
+
+ static public ApplicationConfig getConfig() {
+ return getConfig(null, null);
+ }
+
+ static public ApplicationConfig getConfig(String[] args) {
+ return getConfig(null, null, args);
+ }
+
+ /**
+ * Create WikittyConfig and load particular configuration filename.
+ *
+ * @param configFilename name of wikitty config file
+ */
+ static public ApplicationConfig getConfig(String configFilename) {
+ return getConfig(null, configFilename);
+ }
+
+ /**
+ * Create WikittyConfig and use props as default value
+ *
+ * @param props as default value
+ */
+ static public ApplicationConfig getConfig(Properties props) {
+ return getConfig(props, null);
+ }
+
+ static public ApplicationConfig getConfig(
+ Properties props, String configFilename, String ... args) {
+ ApplicationConfig conf = new ApplicationConfig(
+ JRSTConfigOption.class, JRSTConfigAction.class,
+ props, configFilename);
+
+ // add options alias
+ conf.addAlias("--console", "--option", "console", "true");
+ conf.addAlias("-c", "--option console true");
+ conf.addAlias("--force", "--option", "force", "true");
+ conf.addAlias("--outFile", "--option", "outFile");
+ conf.addAlias("-o", "--option", "outFile");
+ conf.addAlias("--outType", "--option", "outType");
+ conf.addAlias("-t", "--option", "outType");
+ conf.addAlias("--xslFile", "--option", "xslFile");
+ conf.addAlias("-x", "--option", "xslFile");
+
+ try {
+ conf.parse(args);
+ } catch (ArgumentsParserException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't load wikitty configuration", eee);
+ }
+ }
+ return conf;
+ }
+
+ static public void help() {
+ System.out.println("JRST configuration and action");
+ System.out.println("Options (set with --option <key> <value>:");
+ for (JRSTConfigOption o : JRSTConfigOption.values()) {
+ System.out.println("\t" + o.key + "(" + o.getDefaultValue() + ")\t:" + o.getDescription());
+ }
+
+ System.out.println("Actions:");
+ for (JRSTConfigAction a : JRSTConfigAction.values()) {
+ System.out.println("\t" + java.util.Arrays.toString(a.aliases) + "(" + a.getAction() + ")\t:" + a.getDescription());
+ }
+ System.exit(0);
+ }
+
+}
Property changes on: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfig.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java
===================================================================
--- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java (rev 0)
+++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java 2011-04-27 11:43:27 UTC (rev 567)
@@ -0,0 +1,65 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jrst;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+import org.nuiton.util.ApplicationConfig.ActionDef;
+
+/**
+ * JRST actions.
+ *
+ * @author echatellier
+ */
+public enum JRSTConfigAction implements ActionDef {
+ HELP(n_("JRST help"), JRSTConfig.class.getName() + "#help", "-h", "--help");
+
+ public String description;
+ public String action;
+ public String[] aliases;
+
+ private JRSTConfigAction(String description, String action, String... aliases) {
+ this.description = description;
+ this.action = action;
+ this.aliases = aliases;
+ }
+
+ public String getDescription() {
+ return _(description);
+ }
+
+ @Override
+ public String getAction() {
+ return action;
+ }
+
+ @Override
+ public String[] getAliases() {
+ return aliases;
+ }
+
+}
Property changes on: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java
===================================================================
--- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java (rev 0)
+++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java 2011-04-27 11:43:27 UTC (rev 567)
@@ -0,0 +1,130 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.jrst;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+import java.io.File;
+
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ApplicationConfig.OptionDef;
+
+/**
+ * JRST options enum.
+ *
+ * @author chatellier
+ */
+public enum JRSTConfigOption implements OptionDef {
+
+ FORCE("force", n_("jrst.option.force"), "false", String.class, true, false),
+ OUT_FILE("outFile", n_("jrst.option.outfile"), null, String.class, true, false),
+ OUT_TYPE("outType", n_("jrst.option.outtype"), null, String.class, true, false),
+ XSL_FILE("xslFile", n_("jrst.option.xslfile"), null, String.class, true, false);
+
+ public String key;
+ public String description;
+ public String defaultValue;
+ public Class<?> type;
+ public boolean isTransient;
+ public boolean isFinal;
+ public String[] alias;
+
+ private JRSTConfigOption(String key, String description,
+ String defaultValue, Class<?> type, boolean isTransient, boolean isFinal, String... alias) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this.isTransient = isTransient;
+ this.isFinal = isFinal;
+ this.alias = alias;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return isFinal;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ @Override
+ public String getDescription() {
+ return _(description);
+ }
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return type;
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public void setTransient(boolean isTransient) {
+ this.isTransient = isTransient;
+ }
+
+ @Override
+ public void setFinal(boolean isFinal) {
+ this.isFinal = isFinal;
+ }
+
+ public String[] getAlias() {
+ return alias;
+ }
+
+ public String getOption(ApplicationConfig config) {
+ String result = config.getOption(getKey());
+ return result;
+ }
+
+ public File getOptionAsFile(ApplicationConfig config) {
+ File result = config.getOptionAsFile(getKey());
+ return result;
+ }
+
+ public boolean getOptionAsBoolean(ApplicationConfig config) {
+ boolean result = config.getOptionAsBoolean(getKey());
+ return result;
+ }
+}
Property changes on: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTConfigOption.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java
===================================================================
--- trunk/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java 2011-04-27 08:35:27 UTC (rev 566)
+++ trunk/jrst/src/main/java/org/nuiton/jrst/JRSTInterface.java 2011-04-27 11:43:27 UTC (rev 567)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2004 - 2010 CodeLutin
+ * Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -32,7 +32,6 @@
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
-import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
@@ -137,13 +136,11 @@
setTitle("JRST");
setLayout(new BorderLayout());
add(getPanelPrincipal(), BorderLayout.CENTER);
- Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
- setModal(true); // pour que JRST attende que cette fenetre soit
- // ferme
- pack();
+ // pour que JRST attende que cette fenetre soit ferme
+ setModal(true);
setResizable(false);
- setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2
- - getHeight() / 2); // Centrer
+ pack();
+ setLocationRelativeTo(null);
setVisible(true);
}
Modified: trunk/jrst/src/main/resources/i18n/jrst_en_GB.properties
===================================================================
--- trunk/jrst/src/main/resources/i18n/jrst_en_GB.properties 2011-04-27 08:35:27 UTC (rev 566)
+++ trunk/jrst/src/main/resources/i18n/jrst_en_GB.properties 2011-04-27 11:43:27 UTC (rev 567)
@@ -1,20 +1,13 @@
+JRST\ help=
JRST\ parsing\ error\ line\ %d\ char\ %s\:\\n%s=JRST parsing error line %d char %s\:\\n%s
-annuler=.. to cancel or return to parent directory
btnCancel=Cancel
btnConvert=Convert
-dontExist=Invalid file path
-entrer=Enter to display file list, or to complete path
-exit=Enter "\!q" to exit
externalXSL=External(s) XSL(s)
-help?=JRST --help to display help
+jrst.option.force=Overwrite existing out file
+jrst.option.outfile=Output file
+jrst.option.outtype=Output type (xml|xhtml|docbook|html|xdoc|rst|fo|pdf)
+jrst.option.xslfile=XSL file list to apply, comma separated
open=Open file \:
openEmpty?=This field must be filled in.
-other?=Want you add an other XSL file ?(y/n)
-outputFile?=Please enter output path (empty to display in console)
-outputFormat?=Please enter output format (xhtml, docbook, xml(by default), html, xdoc, rst, pdf, odt ou rtf)\n(empty to enter XSL files to use)
-overwrite?=This file exists, do you want to overwrite it ? (y/n)
overwriteGraph?=This file exists, do you want to overwrite it ?
-rstFile?=Please enter reStructuredText file path (empty to exit)
-save=Enter "\!s" in the end of the file name to save
saveAs=Save as \:
-xslFile?=Please enter XSL file path (XML output if empty)
Modified: trunk/jrst/src/main/resources/i18n/jrst_fr_FR.properties
===================================================================
--- trunk/jrst/src/main/resources/i18n/jrst_fr_FR.properties 2011-04-27 08:35:27 UTC (rev 566)
+++ trunk/jrst/src/main/resources/i18n/jrst_fr_FR.properties 2011-04-27 11:43:27 UTC (rev 567)
@@ -1,20 +1,13 @@
+JRST\ help=
JRST\ parsing\ error\ line\ %d\ char\ %s\:\\n%s=
-annuler=.. pour annuler ou pour revenir au repertoire precedent
btnCancel=Annuler
btnConvert=Convertir
-dontExist=Ce fichier n'existe pas
-entrer=Entrer pour afficher la liste des fichiers, ou pour completer le chemin
-exit=Saisir "\!q" pour quitter
externalXSL=XSL(s) externe(s)
-help?=JRST --help pour afficher l'aide
+jrst.option.force=Remplace un fichier existant
+jrst.option.outfile=Fichier de sortie
+jrst.option.outtype=Type de sortie (xml|xhtml|docbook|html|xdoc|rst|fo|pdf)
+jrst.option.xslfile=Fichier XSL a appliquer (s\u00E9par\u00E9 par une ,)
open=Ouvrir le fichier \:
openEmpty?=Ce champ doit etre rempli.
-other?=Voulez-vous ajouter un autre fichier XSL ?(o/n)
-outputFile?=Veuillez saisir le chemin du fichier sortie (Laissez vide pour l'afficher dans la sortie standard)
-outputFormat?=Veuillez saisir le format de sortie (xhtml, docbook, xml(par default), html, xdoc, rst, pdf, odt ou rtf)\n(Laissez vide pour specifier le ou les XSL de generations \u00E0 utiliser)
-overwrite?=Ce fichier existe, etes-vous sur de vouloir ecraser le fichier ?(o/n)
overwriteGraph?=Ce fichier existe, etes-vous sur de vouloir ecraser le fichier ?
-rstFile?=Veuillez saisir le chemin du fichier reStructuredText (Laissez vide pour quitter)
-save=Saisir "\!s" a la fin du nom de fichier pour l'enregistrer
saveAs=Enregistrer sous \:
-xslFile?=Veuillez saisir le chemin du fichier XSL (Sortie XML si vide)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-27 08:35:27 UTC (rev 566)
+++ trunk/pom.xml 2011-04-27 11:43:27 UTC (rev 567)
@@ -233,13 +233,6 @@
</dependency>
<dependency>
- <groupId>uk.co.flamingpenguin.jewelcli</groupId>
- <artifactId>jewelcli</artifactId>
- <version>0.57</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
1
0
27 Apr '11
Author: echatellier
Date: 2011-04-27 10:35:27 +0200 (Wed, 27 Apr 2011)
New Revision: 566
Url: http://nuiton.org/repositories/revision/jrst/566
Log:
Evolution #1479: Update to plexus-utils 2.0.7
Evolution #1480: Update to nuiton-util 2.1.2
Evolution #1481: Update nuiton-i18n 2.3.2
Modified:
trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java
trunk/pom.xml
Modified: trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java
===================================================================
--- trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2011-04-11 08:45:50 UTC (rev 565)
+++ trunk/jrst/src/main/java/org/nuiton/jrst/JRST.java 2011-04-27 08:35:27 UTC (rev 566)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2004 - 2010 CodeLutin
+ * Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -186,7 +186,7 @@
*/
public static void main(String[] args) throws Exception {
- I18n.init();
+ I18n.init(null, null);
if (args.length == 0) {
args = askOption();
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-11 08:45:50 UTC (rev 565)
+++ trunk/pom.xml 2011-04-27 08:35:27 UTC (rev 566)
@@ -6,7 +6,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2004 - 2010 CodeLutin
+ Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -149,7 +149,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>1.5.15</version>
+ <version>2.0.7</version>
</dependency>
<dependency>
@@ -383,8 +383,8 @@
<siteSourcesType>apt</siteSourcesType>
<doxiaVersion>1.1.4</doxiaVersion>
- <nuitonUtilsVersion>2.0</nuitonUtilsVersion>
- <nuitonI18nVersion>2.3</nuitonI18nVersion>
+ <nuitonUtilsVersion>2.1.2</nuitonUtilsVersion>
+ <nuitonI18nVersion>2.3.2</nuitonI18nVersion>
<xalanVersion>2.7.1</xalanVersion>
</properties>
1
0
Author: tchemit
Date: 2011-04-11 10:45:50 +0200 (Mon, 11 Apr 2011)
New Revision: 565
Url: http://nuiton.org/repositories/revision/jrst/565
Log:
Update mavenpom4redmineAndCentral to 2.5.3.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-14 14:44:51 UTC (rev 564)
+++ trunk/pom.xml 2011-04-11 08:45:50 UTC (rev 565)
@@ -33,7 +33,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>2.5.2</version>
+ <version>2.5.3</version>
</parent>
<artifactId>jrst</artifactId>
1
0