You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2024/05/01 14:05:59 UTC

(jspwiki) branch master updated (75024462e -> 936486065)

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git


    from 75024462e fix typo
     new 59ad1a530 Fix possible ArrayIndexOutOfBOundsException
     new f79d41cb5 JSPWIKI-1190: generate markdown flavour of wikipages as part of the build
     new 3cefebd7a Update dependencies     * Awaitility to 4.2.1     * Log4J to 2.23.1     * Maven plugins: install to 3.1.2, cargo to 1.10.13
     new 936486065 2.12.2-git-14

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog.md                                       | 13 +++++++++
 LICENSE                                            | 10 +++----
 .../src/main/java/org/apache/wiki/api/Release.java |  2 +-
 jspwiki-markdown/pom.xml                           | 13 +++++++++
 .../markdown/migration/WikiSyntaxConverter.java    | 34 ++++++++++++++++++----
 jspwiki-wikipages/.gitignore                       |  1 +
 .../assembly/{zip.xml => zip-markdown.xml}         |  4 +--
 jspwiki-wikipages/assembly/zip.xml                 |  6 +++-
 jspwiki-wikipages/pom.xml                          | 15 ++++++++++
 .../htmltowiki/XHtmlElementToWikiTranslator.java   |  2 +-
 pom.xml                                            | 21 +++++++++----
 11 files changed, 99 insertions(+), 22 deletions(-)
 create mode 100644 jspwiki-wikipages/.gitignore
 copy jspwiki-wikipages/assembly/{zip.xml => zip-markdown.xml} (93%)


(jspwiki) 04/04: 2.12.2-git-14

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 93648606537ca298ba163c38e66087ea1adf34c2
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Wed May 1 16:05:32 2024 +0200

    2.12.2-git-14
---
 ChangeLog.md                                               | 13 +++++++++++++
 jspwiki-api/src/main/java/org/apache/wiki/api/Release.java |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 7e6cbad5b..2d98e05d8 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -17,6 +17,19 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+**2024-05-01  Juan Pablo Santos (juanpablo AT apache DOT org)**
+
+* _2.12.2-git-14_
+
+* [JSPWIKI-1190](https://issues.apache.org/jira/browse/JSPWIKI-1190) - Changing `jspwiki.syntax=markdown` breaks all the predefined/default wiki content
+    * Markdown wikipages are now generated from default wikipages as part of the build
+    * This generation allowed to uncover and fix a small bug in `XHtmlElementToWikiTranslator`, where an `ArrayIndexOutOfBOundsException` could occur when translating `style` tags
+
+* Dependency updates
+    * Awaitility to 4.2.1 (closes [PR #337](https://github.com/apache/jspwiki/pull/337), thanks to Dependabot)
+    * Log4J to 2.23.1 (closes [PR #338](https://github.com/apache/jspwiki/pull/338), thanks to Dependabot)
+    * Maven plugins: install to 3.1.2, cargo to 1.10.13 (closes [PR #339](https://github.com/apache/jspwiki/pull/339), thanks to Dependabot)
+
 **2024-04-27  Juan Pablo Santos (juanpablo AT apache DOT org)**
 
 * _2.12.2-git-13_
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
index e09d1299a..794c207ad 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
@@ -69,7 +69,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "13";
+    public static final String     BUILD         = "14";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of


(jspwiki) 03/04: Update dependencies * Awaitility to 4.2.1 * Log4J to 2.23.1 * Maven plugins: install to 3.1.2, cargo to 1.10.13

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 3cefebd7a14421387c87752f803ee11ac5a59a03
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Wed May 1 16:03:42 2024 +0200

    Update dependencies
        * Awaitility to 4.2.1
        * Log4J to 2.23.1
        * Maven plugins: install to 3.1.2, cargo to 1.10.13
    
    closes #337
    closes #338
    closes #339
---
 LICENSE | 10 +++++-----
 pom.xml | 21 +++++++++++++++------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/LICENSE b/LICENSE
index b0deb7545..41eef0ced 100644
--- a/LICENSE
+++ b/LICENSE
@@ -254,10 +254,10 @@ jmespath-java-1.12.565                      LICENSE
 joda-time-2.8.1                             LICENSE
 jstl-1.2.jar                                LICENSE
 logging-mailhandler-1.6.2.jar               ./jspwiki-war/src/main/config/doc/LICENSE.cddl
-log4j-1.2-api-2.23.0.jar                    LICENSE
-log4j-api-2.23.0.jar                        LICENSE
-log4j-core-2.23.0.jar                       LICENSE
-log4j-slf4j-impl-2.23.0                     LICENSE
+log4j-1.2-api-2.23.1.jar                    LICENSE
+log4j-api-2.23.1.jar                        LICENSE
+log4j-core-2.23.1.jar                       LICENSE
+log4j-slf4j-impl-2.23.1                     LICENSE
 lucene-analyzers-common-9.10.0.jar          LICENSE
 lucene-backward-codecs-9.10.0.jar           LICENSE
 lucene-core-9.10.0.jar                      LICENSE
@@ -281,7 +281,7 @@ xpp3-1.1.3.4-RC3                            ./jspwiki-war/src/main/config/doc/LI
 
 TEST LIBRARY                                LICENSE FILE
 =============================================================================================================
-awaitility-4.2.0.jar                        LICENSE
+awaitility-4.2.1.jar                        LICENSE
 commons-el-1.0.jar                          LICENSE
 custom_rhino-0.4.3.jar                      ./jspwiki-war/src/main/config/doc/LICENSE.mpl
 hsqldb-2.7.2.jar                            ./jspwiki-war/src/main/config/doc/LICENSE.hsqldb
diff --git a/pom.xml b/pom.xml
index aad5f7b0b..67b79668e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
     <maven.version>3.5</maven.version>
 
     <akismet-java.version>1.02</akismet-java.version>
-    <awaitility.version>4.2.0</awaitility.version>
+    <awaitility.version>4.2.1</awaitility.version>
     <aws-java-sdk-kendra.version>1.12.565</aws-java-sdk-kendra.version>
     <commons-collections.version>4.4</commons-collections.version>
     <commons-fileupload.version>1.5</commons-fileupload.version>
@@ -68,7 +68,7 @@
     <jetty.version>9.4.54.v20240208</jetty.version>
     <jrcs-diff.version>0.4.2</jrcs-diff.version>
     <junit.version>5.10.2</junit.version>
-    <log4j2.version>2.23.0</log4j2.version>
+    <log4j2.version>2.23.1</log4j2.version>
     <lucene.version>9.10.0</lucene.version>
     <mockito.version>5.11.0</mockito.version>
     <nekohtml.version>2.1.2</nekohtml.version>
@@ -88,7 +88,7 @@
     <plugin.compiler.version>3.13.0</plugin.compiler.version>
     <plugin.dependency.version>3.6.1</plugin.dependency.version>
     <plugin.enforcer.version>3.4.1</plugin.enforcer.version>
-    <plugin.install.version>3.1.1</plugin.install.version>
+    <plugin.install.version>3.1.2</plugin.install.version>
     <plugin.jar.version>3.4.1</plugin.jar.version>
     <plugin.javadoc.version>3.6.3</plugin.javadoc.version>
     <plugin.jxr.version>3.3.2</plugin.jxr.version>
@@ -104,7 +104,7 @@
     <plugin.jspc.version>3.2.2</plugin.jspc.version>
     <plugin.checksum.version>1.11</plugin.checksum.version>
     <plugin.jslint.version>1.0.1</plugin.jslint.version>
-    <plugin.cargo.version>1.10.11</plugin.cargo.version>
+    <plugin.cargo.version>1.10.13</plugin.cargo.version>
     <plugin.clirr.version>2.8</plugin.clirr.version>
     <plugin.cobertura.version>2.7</plugin.cobertura.version>
     <plugin.cyclonedx.version>2.8.0</plugin.cyclonedx.version>
@@ -952,7 +952,7 @@
 
   <profiles>
     <profile>
-      <id>build-wikipages-zip</id>
+      <id>build-wikipages-zips</id>
       <activation>
         <file>
           <exists>../assembly/zip.xml</exists>
@@ -968,12 +968,21 @@
                 <phase>package</phase>
                 <goals><goal>single</goal></goals>
                 <configuration>
-                  <appendAssemblyId>false</appendAssemblyId>
                   <descriptors>
                     <descriptor>../assembly/zip.xml</descriptor>
                   </descriptors>
                 </configuration>
               </execution>
+              <execution>
+                <id>create-markdown-wikipages-zip</id>
+                <phase>package</phase>
+                <goals><goal>single</goal></goals>
+                <configuration>
+                  <descriptors>
+                    <descriptor>../assembly/zip-markdown.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
             </executions>
           </plugin>
         </plugins>


(jspwiki) 02/04: JSPWIKI-1190: generate markdown flavour of wikipages as part of the build

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit f79d41cb5b60942a365000a2a435e1c8f40ae178
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Wed May 1 16:03:19 2024 +0200

    JSPWIKI-1190: generate markdown flavour of wikipages as part of the build
---
 jspwiki-markdown/pom.xml                           | 13 +++++++++
 .../markdown/migration/WikiSyntaxConverter.java    | 34 ++++++++++++++++++----
 jspwiki-wikipages/.gitignore                       |  1 +
 .../assembly/{zip.xml => zip-markdown.xml}         |  4 +--
 jspwiki-wikipages/assembly/zip.xml                 |  6 +++-
 jspwiki-wikipages/pom.xml                          | 15 ++++++++++
 6 files changed, 64 insertions(+), 9 deletions(-)

diff --git a/jspwiki-markdown/pom.xml b/jspwiki-markdown/pom.xml
index 359328456..2b19c5495 100644
--- a/jspwiki-markdown/pom.xml
+++ b/jspwiki-markdown/pom.xml
@@ -154,6 +154,19 @@
           </execution>
         </executions>
       </plugin>
+
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>generate-markdown-pages</id>
+            <goals><goal>test</goal></goals>
+            <configuration>
+              <test>WikiSyntaxConverter</test>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
\ No newline at end of file
diff --git a/jspwiki-markdown/src/test/java/org/apache/wiki/markdown/migration/WikiSyntaxConverter.java b/jspwiki-markdown/src/test/java/org/apache/wiki/markdown/migration/WikiSyntaxConverter.java
index 7e26ea68a..e42cf7b36 100644
--- a/jspwiki-markdown/src/test/java/org/apache/wiki/markdown/migration/WikiSyntaxConverter.java
+++ b/jspwiki-markdown/src/test/java/org/apache/wiki/markdown/migration/WikiSyntaxConverter.java
@@ -18,12 +18,14 @@
  */
 package org.apache.wiki.markdown.migration;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.wiki.TestEngine;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.api.spi.Wiki;
 import org.apache.wiki.attachment.AttachmentManager;
 import org.apache.wiki.htmltowiki.HtmlStringToWikiTranslator;
@@ -31,21 +33,41 @@ import org.apache.wiki.markdown.migration.parser.JSPWikiToMarkdownMarkupParser;
 import org.apache.wiki.pages.PageManager;
 import org.apache.wiki.plugin.PluginManager;
 import org.apache.wiki.render.RenderingManager;
-import org.junit.jupiter.api.Test;
+import org.jdom2.JDOMException;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
+import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
 import static org.apache.wiki.TestEngine.with;
 
 
-public class WikiSyntaxConverter {
+/**
+ * <p>Class used to autogenerate the initial set of markdown files, derived from the ones with jspwiki syntax, as part
+ * of the build,</p>
+ * <p>Can be used as a starting point to develop more complex converters from jspwiki to markdown syntax f.ex, to also
+ * convert page history, retain original authors, etc.</p>
+ */
+class WikiSyntaxConverter {
+
+    @ParameterizedTest
+    @ValueSource( strings = { "de", "en", "es", "fi", "fr", "it", "nl", "pt_BR", "ru", "zh_CN" } )
+    void jspwikiToMarkdownConverter( final String lang ) throws Exception {
+        final File target = new File( "../jspwiki-wikipages/" + lang + "/src/main/resources/markdown" );
+        target.delete();
+        translateJSPWikiToMarkdown( lang );
+        Arrays.stream( ArrayUtils.nullToEmpty( target.listFiles( ( dir, name ) -> name.endsWith( ".properties" ) ), File[].class ) )
+              .forEach( file -> file.delete() );
+    }
 
-    @Test
-    void jspwikiToMarkdownConverter() throws Exception {
-        final Engine jspw = buildEngine( "jspwiki", "../jspwiki-wikipages/en/src/main/resources" );
-        final Engine md = buildEngine( "markdown", "./target/pages-markdown" );
+    void translateJSPWikiToMarkdown( String lang ) throws JDOMException, IOException, ReflectiveOperationException, WikiException {
+        final Engine jspw = buildEngine( "jspwiki", "../jspwiki-wikipages/" + lang + "/src/main/resources" );
+        final Engine md = buildEngine( "markdown", "../jspwiki-wikipages/" + lang + "/src/main/resources/markdown" );
         jspw.getManager( PluginManager.class ).enablePlugins( false );
 
         final Collection< Page > pages = jspw.getManager( PageManager.class ).getAllPages();
diff --git a/jspwiki-wikipages/.gitignore b/jspwiki-wikipages/.gitignore
new file mode 100644
index 000000000..b0816431c
--- /dev/null
+++ b/jspwiki-wikipages/.gitignore
@@ -0,0 +1 @@
+*/src/main/resources/markdown/
diff --git a/jspwiki-wikipages/assembly/zip.xml b/jspwiki-wikipages/assembly/zip-markdown.xml
similarity index 93%
copy from jspwiki-wikipages/assembly/zip.xml
copy to jspwiki-wikipages/assembly/zip-markdown.xml
index 872cb1cb3..960fc8e03 100644
--- a/jspwiki-wikipages/assembly/zip.xml
+++ b/jspwiki-wikipages/assembly/zip-markdown.xml
@@ -20,14 +20,14 @@
 <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-  <id>zip</id>
+  <id>markdown</id>
   <formats>
     <format>zip</format>
   </formats>
   <fileSets>
     <fileSet>
       <outputDirectory></outputDirectory>
-      <directory>src/main/resources</directory>
+      <directory>src/main/resources/markdown</directory>
 	  <fileMode>0644</fileMode>
       <directoryMode>0755</directoryMode>
     </fileSet>
diff --git a/jspwiki-wikipages/assembly/zip.xml b/jspwiki-wikipages/assembly/zip.xml
index 872cb1cb3..00d159b92 100644
--- a/jspwiki-wikipages/assembly/zip.xml
+++ b/jspwiki-wikipages/assembly/zip.xml
@@ -20,7 +20,7 @@
 <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-  <id>zip</id>
+  <id>jspwiki</id>
   <formats>
     <format>zip</format>
   </formats>
@@ -28,6 +28,10 @@
     <fileSet>
       <outputDirectory></outputDirectory>
       <directory>src/main/resources</directory>
+      <excludes>
+        <exclude>markdown</exclude>
+        <exclude>markdown/*</exclude>
+      </excludes>
 	  <fileMode>0644</fileMode>
       <directoryMode>0755</directoryMode>
     </fileSet>
diff --git a/jspwiki-wikipages/pom.xml b/jspwiki-wikipages/pom.xml
index 52a2409f0..78bde6a91 100644
--- a/jspwiki-wikipages/pom.xml
+++ b/jspwiki-wikipages/pom.xml
@@ -59,4 +59,19 @@
 	  </plugins>
 	</pluginManagement>
   </build>
+
+  <dependencies>
+    <dependency><!-- artificial dependency just to ensure that the wiki pages are built after the markdown module has generated the markdown pages -->
+      <groupId>org.apache.jspwiki</groupId>
+      <artifactId>jspwiki-markdown</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>*</groupId>
+          <artifactId>*</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
 </project>


(jspwiki) 01/04: Fix possible ArrayIndexOutOfBOundsException

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 59ad1a5304589770cda9b7fea5945143e068cff8
Author: Juan Pablo Santos Rodríguez <ju...@gmail.com>
AuthorDate: Wed May 1 16:02:04 2024 +0200

    Fix possible ArrayIndexOutOfBOundsException
---
 .../java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jspwiki-wysiwyg/src/main/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java b/jspwiki-wysiwyg/src/main/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
index e8feb4e5e..b096cd5d1 100644
--- a/jspwiki-wysiwyg/src/main/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
+++ b/jspwiki-wysiwyg/src/main/java/org/apache/wiki/htmltowiki/XHtmlElementToWikiTranslator.java
@@ -225,7 +225,7 @@ public class XHtmlElementToWikiTranslator {
 
         final Map< Object, Object > m = new LinkedHashMap<>();
         Arrays.stream( style.toLowerCase().split( ";" ) )
-              .filter( StringUtils::isNotEmpty )
+              .filter( StringUtils::isNotBlank )
               .forEach( prop -> m.put( prop.split( ":" )[ 0 ].trim(), prop.split( ":" )[ 1 ].trim() ) );
         return m;
     }