Author: desruisseaux
Date: Sat May 21 22:31:59 2016
New Revision: 1744997
URL: http://svn.apache.org/viewvc?rev=1744997&view=rev
Log:
Add a main method to developer guide assembler.
Modified:
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
Modified:
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java?rev=1744997&r1=1744996&r2=1744997&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/Assembler.java
[UTF-8] Sat May 21 22:31:59 2016
@@ -65,7 +65,7 @@ import static org.apache.sis.internal.bo
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
*/
public final class Assembler {
/**
@@ -546,4 +546,43 @@ public final class Assembler {
transformer.setOutputProperty(OutputKeys.INDENT, "no");
transformer.transform(new DOMSource(document), new
StreamResult(output));
}
+
+ /**
+ * Generates the {@code "content/book/en|fr/developer-guide.html"} file
from {@code "book/en|fr/body.html"}.
+ * The only argument expected by this method is the language: {@code "en"}
or {@code "fr"}.
+ * The current directory shall be the parent directory of {@code "book"}
and {@code "content"}.
+ *
+ * @param args command-line arguments. Should contain exactly on value,
which is the language.
+ * @throws Exception if an I/O error, a XML parsing error or other kinds
of error occurred.
+ *
+ * @since 0.8
+ */
+ @SuppressWarnings("UseOfSystemOutOrSystemErr")
+ public static void main(final String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Expected parameter: the language (\"en\" or
\"fr\").");
+ System.err.println("Current directory shall be the root of Apache
SIS site source code.");
+ System.exit(1);
+ }
+ String lang = args[0];
+ final Locale locale;
+ if ("en".equalsIgnoreCase(lang)) {
+ locale = Locale.ENGLISH;
+ } else if ("fr".equalsIgnoreCase(lang)) {
+ locale = Locale.FRENCH;
+ } else {
+ System.err.println("Unsupported language code: " + lang);
+ System.exit(1);
+ return;
+ }
+ lang = locale.getLanguage();
+ File input = new File("book/" + lang + "/body.html");
+ if (!input.isFile()) {
+ System.err.println("Can not read " + input + ". Is the current
directory the root of SIS site source code?");
+ System.exit(1);
+ return;
+ }
+ final Assembler assembler = new Assembler(input, locale);
+ assembler.run(new File("content/book/" + lang +
"/developer-guide.html"));
+ }
}
Modified:
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java?rev=1744997&r1=1744996&r2=1744997&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/CodeColorizer.java
[UTF-8] Sat May 21 22:31:59 2016
@@ -262,7 +262,7 @@ public final class CodeColorizer {
*/
if (stopCondition != null) {
if (node.getNodeType() != Node.TEXT_NODE) {
- syntaticElement.appendChild(node); // Also remove from
its previous position.
+ syntaticElement.appendChild(node); // Also remove
from its previous position.
continue;
}
final String text = node.getTextContent();
Modified:
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java?rev=1744997&r1=1744996&r2=1744997&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/internal/book/package-info.java
[UTF-8] Sat May 21 22:31:59 2016
@@ -25,6 +25,6 @@
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
*/
package org.apache.sis.internal.book;