jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brus...@apache.org
Subject [1/2] jspwiki git commit: Support concatenation of multiple %%styles with a dot
Date Tue, 13 Dec 2016 18:16:35 GMT
Repository: jspwiki
Updated Branches:
  refs/heads/master 1ba57b3ea -> 1ebca686d


http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1ebca686/jspwiki-war/src/main/java/org/apache/wiki/Release.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/Release.java b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
index 58ec0ff..0b026e5 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
@@ -14,7 +14,7 @@
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
-    under the License.      
+    under the License.
  */
 
 package org.apache.wiki;
@@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils;
 
 
 /**
- *  Contains release and version information.  You may also invoke this class directly, in
which case it prints 
+ *  Contains release and version information.  You may also invoke this class directly, in
which case it prints
  *  out the version string.  This is a handy way of checking which JSPWiki version you have
- just type
  *  from a command line:
  *  <pre>
@@ -31,13 +31,13 @@ import org.apache.commons.lang.StringUtils;
  *  2.5.38
  *  </pre>
  *  <p>
- *  As a historical curiosity, this is the oldest JSPWiki file.  According to the CVS history,
it dates from 6.7.2001, 
+ *  As a historical curiosity, this is the oldest JSPWiki file.  According to the CVS history,
it dates from 6.7.2001,
  *  and it really hasn't changed much since.
  *  </p>
  *  @since  1.0
  */
 public final class Release {
-	
+
     private static final String VERSION_SEPARATORS = ".-";
 
     /**
@@ -46,8 +46,8 @@ public final class Release {
     public static final String     APPNAME       = "JSPWiki";
 
     /**
-     *  This should be empty when doing a release - otherwise keep it as "cvs" so that whenever
someone checks 
-     *  out the code, they know it is a bleeding-edge version.  Other possible values are
"alpha" and "beta" for 
+     *  This should be empty when doing a release - otherwise keep it as "cvs" so that whenever
someone checks
+     *  out the code, they know it is a bleeding-edge version.  Other possible values are
"alpha" and "beta" for
      *  alpha and beta versions, respectively.
      *  <p>
      *  If the POSTFIX is empty, it is not added to the version string.
@@ -63,19 +63,19 @@ public final class Release {
     /** The minor revision.  */
     public static final int        MINORREVISION = 3;
 
-    /** The build number/identifier.  This is a String as opposed to an integer, just so
that people can add 
-     *  other identifiers to it.  The build number is incremented every time a committer
checks in code, and reset 
+    /** The build number/identifier.  This is a String as opposed to an integer, just so
that people can add
+     *  other identifiers to it.  The build number is incremented every time a committer
checks in code, and reset
      *  when the a release is made.
      *  <p>
-     *  If you are a person who likes to build his own releases, we recommend that you add
your initials to this 
+     *  If you are a person who likes to build his own releases, we recommend that you add
your initials to this
      *  identifier (e.g. "13-jj", or 49-aj").
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "16";
+    public static final String     BUILD         = "17";
 
     /**
-     *  This is the generic version string you should use when printing out the version.
 It is of 
+     *  This is the generic version string you should use when printing out the version.
 It is of
      *  the form "VERSION.REVISION.MINORREVISION[-POSTFIX][-BUILD]".
      */
     public static final String     VERSTR        =
@@ -132,7 +132,7 @@ public final class Release {
 
     /**
      *  Returns true, if this version of JSPWiki is older or equal than what is requested.
-     *  
+     *
      *  @param version A version parameter string (a.b.c-something)
      *  @return A boolean value describing whether the given version is older than the current
JSPWiki version
      *  @since 2.4.57
@@ -164,7 +164,7 @@ public final class Release {
     }
 
     /**
-     *  Executing this class directly from command line prints out the current version. 
It is very useful for 
+     *  Executing this class directly from command line prints out the current version. 
It is very useful for
      *  things like different command line tools.
      *  <P>Example:
      *  <PRE>
@@ -177,5 +177,5 @@ public final class Release {
     public static void main( String[] argv ) {
         System.out.println(VERSTR);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1ebca686/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index ce62e07..c693ff4 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -1456,9 +1456,9 @@ public class JSPWikiMarkupParser extends MarkupParser {
                 if( !m_wysiwygEditorMode )
                 {
                     ResourceBundle rbPlugin = Preferences.getBundle( m_context, WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE
);
-                    return addElement( makeError( MessageFormat.format( rbPlugin.getString(
"plugin.error.insertionfailed" ), 
-                    		                                            m_context.getRealPage().getWiki(),

-                    		                                            m_context.getRealPage().getName(),

+                    return addElement( makeError( MessageFormat.format( rbPlugin.getString(
"plugin.error.insertionfailed" ),
+                    		                                            m_context.getRealPage().getWiki(),
+                    		                                            m_context.getRealPage().getName(),
                     		                                            e.getMessage() ) ) );
                 }
             }
@@ -2317,6 +2317,19 @@ public class JSPWikiMarkupParser extends MarkupParser {
             {
                 pushBack( ch );
                 clazz = readUntil( " \t\n\r" );
+                //Note: ref.https://www.w3.org/TR/CSS21/syndata.html#characters
+                //CSS Classnames can contain only the characters [a-zA-Z0-9] and
+                //ISO 10646 characters U+00A0 and higher, plus the "-" and the "_".
+                //They cannot start with a digit, two hyphens, or a hyphen followed by a
digit.
+
+                //(1) replace '.' by spaces, allowing multiple classnames on a div or span
+                //(2) remove any invalid character
+                if( clazz != null){
+
+                    clazz = clazz.replace('.', ' ')
+                                 .replaceAll("[^\\s-_\\w\\x200-\\x377]+","");
+
+                }
                 ch = nextToken();
 
                 //
@@ -2407,7 +2420,7 @@ public class JSPWikiMarkupParser extends MarkupParser {
             }
 
             if( style != null ) el.setAttribute("style", style);
-            if( clazz != null ) el.setAttribute("class", clazz );
+            if( clazz != null ) el.setAttribute("class", clazz);
             el = pushElement( el );
 
             return el;


Mime
View raw message