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

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


The following commit(s) were added to refs/heads/master by this push:
     new 22acc40  Update <wiki:Author> tag with format attribute
22acc40 is described below

commit 22acc40b4832eac234ce4a3442e41d4c3fb4aca9
Author: brushed <[email protected]>
AuthorDate: Fri Apr 5 21:10:06 2019 +0200

    Update <wiki:Author> tag with format attribute
---
 ChangeLog                                           |  2 +-
 .../main/java/org/apache/wiki/tags/AuthorTag.java   | 21 +++++++++++++++------
 .../src/main/resources/META-INF/jspwiki.tld         |  4 ++++
 .../src/main/webapp/templates/default/Nav.jsp       |  9 +--------
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fe61721..7b2c168 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,12 +5,12 @@
        * Added interwiki link for location links (google maps)
          eg: [Atomium|Location:Atomium, City of Brussels, Belgium]
 
-
        * Added plain editor configs as regular properties.
          By default, the editor preview, autosuggestion and tabcompletion are 
set.
 
        * Various small js / css tweaks.
 
+       * Add format option to <wiki:Author/> to render force rendering of text 
iso link
 
 2019-03-22  Juan Pablo Santos (juanpablo AT apache DOT org)
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/AuthorTag.java 
b/jspwiki-main/src/main/java/org/apache/wiki/tags/AuthorTag.java
index ff9da6f..444d187 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/AuthorTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/AuthorTag.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.tags;
 
@@ -39,7 +39,15 @@ public class AuthorTag
     extends WikiTagBase
 {
     private static final long serialVersionUID = 0L;
-    
+
+
+    public String m_format = "";
+
+    public void setFormat( String format )
+    {
+        m_format = format;  //empty or "plain"
+    }
+
     /**
      *  {@inheritDoc}
      */
@@ -55,17 +63,18 @@ public class AuthorTag
         if( author != null && author.length() > 0 )
         {
             author = TextUtil.replaceEntities(author);
-            if( engine.pageExists(author) )
+
+            if( engine.pageExists(author) && !( "plain".equalsIgnoreCase( 
m_format ) ) )
             {
                 // FIXME: It's very boring to have to do this.
                 //        Slow, too.
 
                 RenderingManager mgr = engine.getRenderingManager();
-                
+
                 MarkupParser p = mgr.getParser( m_wikiContext, 
"["+author+"|"+author+"]" );
 
                 WikiDocument d = p.parse();
-                
+
                 author = mgr.getHTML( m_wikiContext, d );
             }
 
diff --git a/jspwiki-main/src/main/resources/META-INF/jspwiki.tld 
b/jspwiki-main/src/main/resources/META-INF/jspwiki.tld
index 25d828b..aec00de 100644
--- a/jspwiki-main/src/main/resources/META-INF/jspwiki.tld
+++ b/jspwiki-main/src/main/resources/META-INF/jspwiki.tld
@@ -55,6 +55,10 @@
     <name>Author</name>
     <tag-class>org.apache.wiki.tags.AuthorTag</tag-class>
     <body-content>empty</body-content>
+    <attribute>
+       <name>format</name>
+       <rtexprvalue>true</rtexprvalue><!-- value is empty or 'plain' -->
+    </attribute>
   </tag>
 
   <tag>
diff --git a/jspwiki-war/src/main/webapp/templates/default/Nav.jsp 
b/jspwiki-war/src/main/webapp/templates/default/Nav.jsp
index 66a82b6..7e92360 100644
--- a/jspwiki-war/src/main/webapp/templates/default/Nav.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/Nav.jsp
@@ -134,14 +134,7 @@
         </span>
       </li>
       <li class="dropdown-header"><fmt:message key="info.author"/> :
-        <span>
-        <%-- wiki:Author sometimes returns a link(ok) or a plain text, we 
always need a link! --%>
-        <c:set var="author"><wiki:Author/></c:set>
-        <c:choose>
-          <c:when test="${ fn:contains(author,'href=')}">${author}</c:when>
-          <c:otherwise><a href="#">${author}</a></c:otherwise>
-        </c:choose>
-        </span>
+               <wiki:Author format="plain"/>
       </li>
       <li class="dropdown-header">
         <wiki:RSSImageLink mode="wiki" title="<fmt:message key='info.feed'/>"/>

Reply via email to