jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brus...@apache.org
Subject jspwiki git commit: JSPWIKI-1032: IMAGE html rendering improvs
Date Tue, 13 Dec 2016 21:21:25 GMT
Repository: jspwiki
Updated Branches:
  refs/heads/master 4e7810ca8 -> 014dc6707


JSPWIKI-1032: IMAGE html rendering improvs


Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/014dc670
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/014dc670
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/014dc670

Branch: refs/heads/master
Commit: 014dc670790bc3c1e4b5d306efa2b75be2426161
Parents: 4e7810c
Author: brushed <dirk.frederickx@gmail.com>
Authored: Tue Dec 13 22:21:13 2016 +0100
Committer: brushed <dirk.frederickx@gmail.com>
Committed: Tue Dec 13 22:21:13 2016 +0100

----------------------------------------------------------------------
 ChangeLog                                       |  6 ++
 .../src/main/java/org/apache/wiki/Release.java  |  2 +-
 .../main/java/org/apache/wiki/plugin/Image.java | 36 +++++++-----
 .../java/org/apache/wiki/util/XhtmlUtil.java    | 60 ++++++++++----------
 .../main/styles/haddock/default/variables.less  |  2 +-
 5 files changed, 59 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jspwiki/blob/014dc670/ChangeLog
----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 1c16582..6b998e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-12-13  Dirk Frederickx (brushed AT apache DOT org)
 
+       * 2.10.3-svn-19
+
+       * JSPWIKI-1032 : Use image "src" attribute instead of "href"
+
+2016-12-13  Dirk Frederickx (brushed AT apache DOT org)
+
        * 2.10.3-svn-18
 
        * [JSPWIKI-1037] UI will not display with IE 9 or IE10.

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/014dc670/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 25f3842..5b3584d 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "18";
+    public static final String     BUILD         = "19";
 
     /**
      *  This is the generic version string you should use when printing out the version.
 It is of

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/014dc670/jspwiki-war/src/main/java/org/apache/wiki/plugin/Image.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/plugin/Image.java b/jspwiki-war/src/main/java/org/apache/wiki/plugin/Image.java
index b6dc0be..5ee799a 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/plugin/Image.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/plugin/Image.java
@@ -1,4 +1,4 @@
-/* 
+/*
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -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.plugin;
 
@@ -46,8 +46,9 @@ import org.apache.wiki.util.TextUtil;
  *  <li><b>style</b> - the style attribute of the image</li>
  *  <li><b>class</b> - the associated class for the image</li>
  *  <li><b>border</b> - the border for the image</li>
+ *  <li><b>title</b> - the title for the image, can be presented as a tooltip
to the user</li>
  *  </ul>
- *  
+ *
  *  @since 2.1.4.
  */
 // FIXME: It is not yet possible to do wiki internal links.  In order to
@@ -79,6 +80,8 @@ public class Image
     //    public static final String PARAM_MAP      = "map";
     /** The parameter name for setting the border.  Value is <tt>{@value}</tt>.
*/
     public static final String PARAM_BORDER   = "border";
+    /** The parameter name for setting the title.  Value is <tt>{@value}</tt>.
*/
+    public static final String PARAM_TITLE   = "title";
 
     /**
      *  This method is used to clean away things like quotation marks which
@@ -108,6 +111,7 @@ public class Image
         String cssclass= getCleanParameter( params, PARAM_CLASS );
         // String map     = getCleanParameter( params, PARAM_MAP );
         String border  = getCleanParameter( params, PARAM_BORDER );
+        String title   = getCleanParameter( params, PARAM_TITLE );
 
         if( src == null )
         {
@@ -141,42 +145,44 @@ public class Image
         result.append( "<table border=\"0\" class=\""+cssclass+"\"" );
         //if( align != null ) result.append(" align=\""+align+"\"");
         //if( style != null ) result.append(" style=\""+style+"\"");
-        
+
         //
         //  Do some magic to make sure centering also work on FireFox
         //
-        if( style != null ) 
+        if( style != null )
         {
             result.append(" style=\""+style);
 
             // Make sure that we add a ";" to the end of the style string
             if( result.charAt( result.length()-1 ) != ';' ) result.append(";");
-                
-            if( align != null && align.equals("center") ) 
+
+            if( align != null && align.equals("center") )
             {
                 result.append(" margin-left: auto; margin-right: auto;");
             }
-                
+
             result.append("\"");
         }
         else
         {
             if( align != null && align.equals("center") ) result.append(" style=\"margin-left:
auto; margin-right: auto;\"");
         }
-        
+
+        if( title != null ) result.append(" title=\""+title+"\"");
+
         if( align != null && !(align.equals("center")) ) result.append(" align=\""+align+"\"");
-        
+
         result.append( ">\n" );
 
-        if( caption != null ) 
+        if( caption != null )
         {
             result.append("<caption align=bottom>"+TextUtil.replaceEntities(caption)+"</caption>\n");
         }
 
 
         result.append( "<tr><td>" );
-       
-        if( link != null ) 
+
+        if( link != null )
         {
             result.append("<a href=\""+link+"\"");
             if( target != null )
@@ -187,7 +193,7 @@ public class Image
         }
 
         result.append( "<img src=\""+src+"\"" );
-       
+
         if( ht != null )     result.append(" height=\""+ht+"\"");
         if( wt != null )     result.append(" width=\""+wt+"\"");
         if( alt != null )    result.append(" alt=\""+alt+"\"");
@@ -211,7 +217,7 @@ public class Image
                 || s.equals("_top") )
         {
             return true;
-        } 
+        }
         else if( s.length() > 0 ) // check [a-zA-z]
         {
             char c = s.charAt(0);

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/014dc670/jspwiki-war/src/main/java/org/apache/wiki/util/XhtmlUtil.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/util/XhtmlUtil.java b/jspwiki-war/src/main/java/org/apache/wiki/util/XhtmlUtil.java
index a44acba..d8e96cf 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/util/XhtmlUtil.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/util/XhtmlUtil.java
@@ -1,4 +1,4 @@
-/* 
+/*
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -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.util;
@@ -30,7 +30,7 @@ import org.jdom2.output.XMLOutputter;
  *  <p>
  *  This uses JDOM2 as its backing implementation.
  *  </p>
- *  
+ *
  *  <h3>Example</h3>
  *  <p>
  *  To generate a single element, an Element with PCDATA content, and then
@@ -52,26 +52,26 @@ import org.jdom2.output.XMLOutputter;
  * @since 2.10
  */
 public final class XhtmlUtil {
-	
+
     private XhtmlUtil() {}
-    
+
     /** to print <td></td> instead of <td /> */
     public static final Format EXPAND_EMPTY_NODES = Format.getCompactFormat().setExpandEmptyElements(
true );
-    
+
     /**
      *  Serializes the Element to a String using a compact serialization format.
-     *  
+     *
      * @param element  the element to serialize.
      * @return the serialized Element.
      */
-    public static String serialize( Element element ) { 
+    public static String serialize( Element element ) {
         return serialize( element, false );
     }
 
     /**
      *  Serializes the Element to a String. If <tt>pretty</tt> is true,
      *  uses a pretty whitespace format, otherwise a compact format.
-     *  
+     *
      * @param element  the element to serialize.
      * @param pretty   if true, use a pretty whitespace format.
      * @return the serialized Element.
@@ -82,7 +82,7 @@ public final class XhtmlUtil {
 
     /**
      *  Serializes the Element to a String. Allows to use a custom <tt>format</tt>.
-     *  
+     *
      * @param element  the element to serialize.
      * @param format   custom <tt>format</tt> used to serialize the Element.
      * @return the serialized Element.
@@ -91,10 +91,10 @@ public final class XhtmlUtil {
         XMLOutputter out = new XMLOutputter( format );
         return out.outputString( element );
     }
-    
+
     /**
      *  Return an Element with an element type name matching the parameter.
-     *  
+     *
      * @param element  the XHTML element type.
      * @return a JDOM2 Element.
      */
@@ -105,7 +105,7 @@ public final class XhtmlUtil {
     /**
      *  Return an Element with an element type name matching the parameter,
      *  and optional PCDATA (parsed character data, a String) content.
-     *  
+     *
      * @param element  the XHTML element type.
      * @param content  the optional PCDATA content.
      * @return a JDOM2 Element.
@@ -120,7 +120,7 @@ public final class XhtmlUtil {
 
     /**
      *  Return an XHTML link with a required 'href' attribute value and optional link (PCDATA)
content.
-     *  
+     *
      * @param href     the required 'href' value.
      * @param content  the optional link (PCDATA) content.
      * @return a JDOM2 Element.
@@ -131,10 +131,10 @@ public final class XhtmlUtil {
         }
         return fLink(href,content,null);
     }
-    
+
     /**
      *  Return an XHTML link target with a required 'id' attribute value.
-     *  
+     *
      * @param id    the required 'id' link target value.
      * @return a JDOM2 Element.
      */
@@ -144,11 +144,11 @@ public final class XhtmlUtil {
         }
         return fLink( null, content, id );
     }
-    
+
     /**
      *  Return an XHTML link with an optional 'href' attribute, optional
      *  link content, and optional 'id' link target value.
-     *  
+     *
      * @param href     the optional 'href' value.
      * @param content  the optional link (PCDATA) content.
      * @param id       the optional 'id' link target value.
@@ -158,20 +158,20 @@ public final class XhtmlUtil {
         Element a = element( XHTML.a );
         if( href != null ) {
             a.setAttribute( XHTML.ATTR_href, href );
-        }        
+        }
         if( content != null ) {
             a.addContent( content );
         }
         if( id != null ) {
-            a.setAttribute( XHTML.ATTR_id, id );   
+            a.setAttribute( XHTML.ATTR_id, id );
         }
         return a;
     }
-    
+
     /**
      *  Return an XHTML <tt>img</tt> element with an required 'src' attribute
      *  and optional 'alt' alternative text value.
-     *  
+     *
      * @param src      the required 'src' value.
      * @param alt      the optional 'alt' alternative text value.
      * @return a JDOM2 Element.
@@ -181,16 +181,16 @@ public final class XhtmlUtil {
         if( src == null ) {
             throw new IllegalArgumentException( "missing 'src' attribute value." );
         }
-        img.setAttribute( XHTML.ATTR_href, src );
+        img.setAttribute( XHTML.ATTR_src, src );
         if( alt != null ) {
-            img.setAttribute( XHTML.ATTR_alt, alt );   
+            img.setAttribute( XHTML.ATTR_alt, alt );
         }
         return img;
     }
-    
+
     /**
      *  Return an XHTML form <tt>input</tt> element with optional 'type', 'name'
and 'value' attributes.
-     *  
+     *
      * @param type   the optional 'type' value.
      * @param name   the optional 'name' value.
      * @param value  the optional 'value' value.
@@ -202,19 +202,19 @@ public final class XhtmlUtil {
             input.setAttribute( XHTML.ATTR_type, type );
         }
         if( name != null ) {
-            input.setAttribute( XHTML.ATTR_name, name );   
+            input.setAttribute( XHTML.ATTR_name, name );
         }
         if( value != null ) {
-            input.setAttribute( XHTML.ATTR_value, value );   
+            input.setAttribute( XHTML.ATTR_value, value );
         }
         return input;
     }
-    
+
     public static void setClass( Element element, String classValue ) {
         if( classValue == null ) {
             throw new IllegalArgumentException( "missing 'class' attribute value." );
         }
         element.setAttribute( XHTML.ATTR_class, classValue );
     }
-    
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jspwiki/blob/014dc670/jspwiki-war/src/main/styles/haddock/default/variables.less
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/styles/haddock/default/variables.less b/jspwiki-war/src/main/styles/haddock/default/variables.less
index cd6c123..a76bdea 100644
--- a/jspwiki-war/src/main/styles/haddock/default/variables.less
+++ b/jspwiki-war/src/main/styles/haddock/default/variables.less
@@ -161,7 +161,7 @@ images/feather-small.png   wxh  162x286
 @carousel-progress-size:  2px;
 
 // Category
-@wiki-category-link-color: #545454;
+@wiki-category-link-color: @state-info-bg; //#545454;
 
 //Editor
 @wiki-editor-bg : @white;


Mime
View raw message