Author: aheritier
Date: Sun Mar  5 17:10:45 2006
New Revision: 383444

URL: http://svn.apache.org/viewcvs?rev=383444&view=rev
Log:
Display the "external link" icon only if the link host is different from the 
project url (pom.url).

Modified:
    maven/maven-1/plugins/trunk/xdoc/plugin.jelly
    maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl
    maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml

Modified: maven/maven-1/plugins/trunk/xdoc/plugin.jelly
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/plugin.jelly?rev=383444&r1=383443&r2=383444&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/xdoc/plugin.jelly Sun Mar  5 17:10:45 2006
@@ -194,16 +194,24 @@
         @target
         -->
     <define:tag name="itemLink">
-      <x:element name="a">
+      <j:catch>
+        <j:new var="siteHost" className="java.net.URL"><j:arg 
value="${pom.url}"/></j:new>
+      </j:catch>
+      <x:element name="a" trim="true">
         <x:attribute 
name="href">${pathTool.calculateLink(link,relativePath)}</x:attribute>
         <j:choose>
+          <j:when test="${link.startsWith('http') or 
link.startsWith('https')}">
+            <j:catch>
+              <j:new var="hrefHost" className="java.net.URL"><j:arg 
value="${link}"/></j:new>
+            </j:catch>
+            <j:if test="${(siteHost != null) and (hrefHost != null) and 
(!siteHost.host.equalsIgnoreCase(hrefHost.host))}">
+              <x:attribute name="class">externalLink</x:attribute>
+              <x:attribute name="title">External Link</x:attribute>
+            </j:if>
+          </j:when>
           <j:when test="${target != null and target.equals('_blank')}">
             <x:attribute name="class">newWindow</x:attribute>
             <x:attribute name="title">New Window</x:attribute>
-          </j:when>
-          <j:when test="${link.startsWith('http')}">
-            <x:attribute name="class">externalLink</x:attribute>
-            <x:attribute name="title">External Link</x:attribute>
           </j:when>
         </j:choose>
         <j:if test="${!empty(target)}">

Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl?rev=383444&r1=383443&r2=383444&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl Sun Mar  5 
17:10:45 2006
@@ -34,7 +34,11 @@
 
   <jsl:template match="document" trim="true">
     <x:doctype name="html" publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" 
systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
-
+    
+    <j:catch>
+      <j:new var="siteHost" className="java.net.URL"><j:arg 
value="${pom.url}"/></j:new>
+    </j:catch>
+    
     <j:useBean var="navbean" class="org.apache.maven.NavBean"/>
     <j:set var="location" value="${outFile.substring(destdir.length())}"/>
     <util:replace var="location" oldChar="\" newChar="/" value="${location}"/>
@@ -615,9 +619,14 @@
                 </x:attribute>
               </j:when>
               <j:when test="${href.startsWith('http://') or 
href.startsWith('https://')}">
+                <j:catch>
+                  <j:new var="hrefHost" className="java.net.URL"><j:arg 
value="${href}"/></j:new>
+                </j:catch>
                 <x:attribute name="href">${href}</x:attribute>
-                <x:attribute name="class">externalLink</x:attribute>
-                <x:attribute name="title">External Link</x:attribute>
+                <j:if test="${(siteHost != null) and (hrefHost != null) and 
(!siteHost.host.equalsIgnoreCase(hrefHost.host))}">
+                  <x:attribute name="class">externalLink</x:attribute>
+                  <x:attribute name="title">External Link</x:attribute>
+                </j:if>
               </j:when>
               <j:otherwise>
                 <x:attribute name="href">${href}</x:attribute>

Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml?rev=383444&r1=383443&r2=383444&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml Sun Mar  5 17:10:45 2006
@@ -27,6 +27,7 @@
   </properties>
   <body>
     <release version="1.10-SNAPSHOT" date="in SVN">
+      <action dev="aheritier" type="fix">Display the "external link" icon only 
if the link host is different from the project url (pom.url).</action>
       <action dev="aheritier" type="add">Fix generated pages titles: 
[nav.title | pom.name] - doc.title</action>
       <action dev="aheritier" type="add">New attribute fileSuffix for the tag 
doc:registerReport allow to use another extension than '.html' for a report 
link.</action>
       <action dev="ltheussl" type="add">Include instructions for ClearCase, 
Starteam and Perforce access in the scm-usage page.</action>


Reply via email to