Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/vietj/wikbook

  • Loading branch information...
commit 76e6297c546ec0422ddbc82678515d70ba191106 2 parents eb51ed7 + 4399293
@dbaeli authored
View
2  archetype/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  archetype/src/main/resources/archetype-resources/pom.xml
@@ -133,6 +133,7 @@
<copy todir="\${wikbook.target}/output/html">
<fileset dir="\${wikbook.target}/src/resources/">
<include name="**/*.css"/>
+ <include name="**/*.js"/>
<include name="**/*.png"/>
<include name="**/*.js"/>
<include name="**/*.gif"/>
@@ -168,6 +169,7 @@
<copy todir="\${wikbook.target}/output/xhtml">
<fileset dir="\${wikbook.target}/src/resources/">
<include name="**/*.css"/>
+ <include name="**/*.js"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
View
2  codesource/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  core/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
22 core/src/main/java/org/wikbook/core/model/DocbookBuilderContext.java
@@ -43,9 +43,29 @@
*/
public final void onValidationError(String msg)
{
+ onValidationError(msg, null);
+ }
+
+ /**
+ * The behavior of this method depends on the context validation mode.
+ * @param t the throwable
+ */
+ public final void onValidationError(Throwable t)
+ {
+ onValidationError(t.getMessage(), t);
+ }
+
+ /**
+ * The behavior of this method depends on the context validation mode.
+ *
+ * @param msg the message
+ * @param t the throwable
+ */
+ public final void onValidationError(String msg, Throwable t)
+ {
if (getValidationMode() == ValidationMode.STRICT)
{
- throw new WikbookValidationException(msg);
+ throw new WikbookValidationException(msg, t);
}
else
{
View
4 core/src/main/java/org/wikbook/core/model/content/block/ProgramListingElement.java
@@ -197,7 +197,7 @@ private void performIncludes(Element elt)
}
catch (Exception e)
{
- e.printStackTrace();
+ context.onValidationError(e);
Element errorElt = elt.getOwnerDocument().createElement("wikbook:error");
Text text = elt.getOwnerDocument().createTextNode(e.getMessage());
errorElt.appendChild(text);
@@ -274,7 +274,7 @@ public void process()
}
catch (Exception e)
{
- e.printStackTrace();
+ context.onValidationError(e);
bilto = "Exception occured, see logs";
}
break;
View
3  doc/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -58,6 +58,7 @@
<emitDoctype>true</emitDoctype>
<beforeBookBodyXML><![CDATA[<xi:include href="bookinfo.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />]]></beforeBookBodyXML>
<bookId>index</bookId>
+ <validationMode>strict</validationMode>
</configuration>
</plugin>
View
2  docbkxstyle/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  html2pdf/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  maven/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
3  maven/src/main/java/org/wikbook/maven/WikBookMojo.java
@@ -45,10 +45,7 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Properties;
View
32 pom.xml
@@ -5,7 +5,7 @@
<groupId>org.wikbook</groupId>
<artifactId>wikbook.parent</artifactId>
<packaging>pom</packaging>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
<name>Wikbook parent</name>
<description>The Wikbook project</description>
@@ -93,59 +93,59 @@
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.codesource</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.core</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.xwiki</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.maven</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.docbkxstyle</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.doc</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.doc</artifactId>
<classifier>html</classifier>
<type>zip</type>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.template</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.template.core</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.template.test-processor</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.template.test-processing</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</dependency>
<dependency>
@@ -216,7 +216,6 @@
<artifactId>xwiki-rendering-syntax-xwiki2</artifactId>
<version>3.2</version>
</dependency>
-
</dependencies>
</dependencyManagement>
@@ -270,13 +269,18 @@
<plugin>
<groupId>org.wikbook</groupId>
<artifactId>wikbook.maven</artifactId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.3</version>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
+ </plugin>
</plugins>
</pluginManagement>
View
2  site/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  template/core/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.template</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  template/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  template/test-processing/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.template</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2  template/test-processor/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.template</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
13 xwiki/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>wikbook.parent</artifactId>
<groupId>org.wikbook</groupId>
- <version>0.9.37-SNAPSHOT</version>
+ <version>0.9.38-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -63,6 +63,17 @@
<directory>src/test/resources</directory>
</testResource>
</testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <targetDir>${project.build.directory}</targetDir>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
</project>
View
57 xwiki/src/test/java/org/wikbook/xwiki/syntax/AbstractSyntaxTestCase.java
@@ -25,6 +25,7 @@
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.w3c.dom.Document;
+import org.wikbook.core.Utils;
import org.wikbook.xwiki.SimpleXDOMDocbookBuilderContext;
import org.wikbook.core.xml.XML;
import org.wikbook.xwiki.WikbookConverter;
@@ -33,6 +34,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMResult;
import java.io.File;
+import java.io.FileOutputStream;
import java.util.List;
/**
@@ -61,6 +63,46 @@ private Test(String fileName, String syntaxId)
/** . */
private static final Test CONFLUENCE_1_0 = new Test("confluence", Syntax.CONFLUENCE_1_0.toIdString());
+ /** . */
+ private File resultsDir;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ String targetDirProperty = System.getProperty("targetDir");
+ if (targetDirProperty != null)
+ {
+ File targetDir = new File(targetDirProperty);
+ if (targetDir.exists() && targetDir.isDirectory())
+ {
+ File resultsDir = new File(targetDir, "results");
+ if (resultsDir.exists())
+ {
+ if (resultsDir.isFile())
+ {
+ throw new AssertionFailedError("Dir " + resultsDir.getAbsolutePath() + " exists and is a file");
+ }
+ }
+ else
+ {
+ if (!resultsDir.mkdir())
+ {
+ throw new AssertionFailedError("Dir " + resultsDir.getAbsolutePath() + " could not be created");
+ }
+ }
+ this.resultsDir = resultsDir;
+ }
+ else
+ {
+ throw new AssertionFailedError("No valid target dir at " + targetDirProperty);
+ }
+ }
+ else
+ {
+ throw new AssertionFailedError("No valid target dir specified");
+ }
+ }
+
public void testSyntax()
{
String folderName = getFolderName();
@@ -94,6 +136,21 @@ private void doTest(String testPath, Test... tests) throws Exception
converter.setSyntaxId(test.syntaxId);
converter.convert(test.fileName + ".wiki", dom);
Document document = (Document)dom.getNode();
+
+ //
+ File f = new File(resultsDir, "test" + testPath.replace('/', '-') + "-" + test.fileName + ".xml");
+ String result = XML.serialize(document);
+ FileOutputStream out = new FileOutputStream(f);
+ try
+ {
+ out.write(result.getBytes("UTF-8"));
+ }
+ finally
+ {
+ Utils.safeClose(out);
+ }
+
+ //
File expected = new File(path, test.fileName + ".xml");
if (!expected.exists() || !expected.isFile())
{
View
4 xwiki/src/test/resources/wiki/codecitation/confluence.wiki
@@ -14,13 +14,13 @@
{@include org.wikbook.xwiki.syntax.CodeWithAnchors#bar()} // <1> foo
{code}
-{java}
+{code:language=java}
int a = 0; // <> anonymous callout, id should be 0
int b = 0; // <1> an explicit callout, id should be 1000
int c = 0; // <> anonymous value, id should be 1001
int d = 0; // <0> an explicit value, id should be 0
int e = 0; // <> an anonymous value, id should be 1
-{java}
+{code}
{code:language=xml|indent=2}
a
Please sign in to comment.
Something went wrong with that request. Please try again.