You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/05/07 16:10:41 UTC

[maven-fluido-skin] 01/01: [MSKINS-184] Don't link pages to themselves with empty hrefs

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

michaelo pushed a commit to branch MSKINS-184
in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git

commit fca2f262022002e944e5289c798693e2dc4ba6df
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat May 7 17:03:01 2022 +0200

    [MSKINS-184] Don't link pages to themselves with empty hrefs
    
    This closes #26
---
 src/it/sidebar/verify.groovy                     |  2 +-
 src/it/topbar/verify.groovy                      |  2 +-
 src/main/resources/META-INF/maven/site-macros.vm | 14 +++++++++-----
 src/main/resources/META-INF/maven/site.vm        |  2 +-
 src/main/resources/css/maven-theme.css           |  4 ++++
 5 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/it/sidebar/verify.groovy b/src/it/sidebar/verify.groovy
index eec3ebf..6d022e7 100644
--- a/src/it/sidebar/verify.groovy
+++ b/src/it/sidebar/verify.groovy
@@ -23,7 +23,7 @@ assert index.exists()
 // MSKINS-130 check that html structure is as clean as possible
 String html = index.getText()
 // active menu
-assert html.contains( '<li class="active"><a href="#"><span class="none"></span>About</a>' )
+assert html.contains( '<li class="active"><a><span class="none"></span>About</a>' )
 // inactive menu
 assert html.contains( '<li><a href="summary.html" title="Summary"><span class="none"></span>Summary</a>' )
 assert html.contains( '<li><a href="plugins.html" title="Plugins"><span class="none"></span>Plugins</a></li>' )
diff --git a/src/it/topbar/verify.groovy b/src/it/topbar/verify.groovy
index 68e808a..98248ac 100644
--- a/src/it/topbar/verify.groovy
+++ b/src/it/topbar/verify.groovy
@@ -23,7 +23,7 @@ assert index.exists()
 // MSKINS-130 check that html structure is as clean as possible
 String html = index.getText()
 // active menu
-assert html.contains( '<li><a href="index.html" title="About">About</a></li>' )
+assert html.contains( '<li><a title="About">About</a></li>' )
 // inactive menu
 assert html.contains( '<li><a href="summary.html" title="Summary">Summary</a></li>' )
 assert html.contains( '<li><a href="plugins.html" title="Plugins">Plugins</a></li>' )
diff --git a/src/main/resources/META-INF/maven/site-macros.vm b/src/main/resources/META-INF/maven/site-macros.vm
index eb371c2..f2ec58e 100644
--- a/src/main/resources/META-INF/maven/site-macros.vm
+++ b/src/main/resources/META-INF/maven/site-macros.vm
@@ -19,7 +19,7 @@
 #**##foreach( $menu in $menus )
 #**##if ( $menu.name )
       <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">$menu.name <b class="caret"></b></a>
+        <a class="dropdown-toggle" data-toggle="dropdown">$menu.name <b class="caret"></b></a>
         <ul class="dropdown-menu">
 #*    *##foreach( $item in $menu.items )
 #*      *##if ($item.items.size() > 0)
@@ -55,7 +55,11 @@
 #**##else
 #*  *##set ( $linkTarget = "" )
 #**##end
-#**#<a href="$href"$linkTarget title="$name">$name</a>##
+#**##if ( $alignedFileName == $href )
+#*  *#<a title="$name">$name</a>##
+#**##else
+#*  *#<a href="$href"$linkTarget title="$name">$name</a>##
+#**##end
 #end
 ##
 #macro ( topLinks $links )
@@ -281,20 +285,20 @@ $indent    <li>##
 #**##if ( $item.img )
 #*  *##if ( $item.position == "left" )
 #*    *##if ( $alignedFileName == $currentItemHref )
-#*      *#<a href="#">#image($item.img $item.alt $item.border $item.width $item.height) $item.name</a>##
+#*      *#<a>#image($item.img $item.alt $item.border $item.width $item.height) $item.name</a>##
 #*    *##else
 #*      *##link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false)
 #*    *##end
 #*  *##else
 #*    *##if ( $alignedFileName == $currentItemHref )
-#*      *#<a href="#">$item.name #image($item.img $item.alt $item.border $item.width $item.height)</a>##
+#*      *#<a>$item.name #image($item.img $item.alt $item.border $item.width $item.height)</a>##
 #*    *##else
 #*      *##link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false)
 #*    *##end
 #*  *##end
 #**##else
 #*  *##if ( $alignedFileName == $currentItemHref )
-#*    *#<a href="#"><span class="$collapseClass"></span>$item.name</a>##
+#*    *#<a><span class="$collapseClass"></span>$item.name</a>##
 #*  *##else
 #*    *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $collapseClass)
 #*  *##end
diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm
index 5a0516d..10da917 100644
--- a/src/main/resources/META-INF/maven/site.vm
+++ b/src/main/resources/META-INF/maven/site.vm
@@ -160,7 +160,7 @@
               && $decoration.body.links.size() > 0 )
             <ul class="nav pull-right">
               <li class="dropdown">
-                <a href="#" class="dropdown-toggle" data-toggle="dropdown">External Links <b class="caret"></b></a>
+                <a class="dropdown-toggle" data-toggle="dropdown">External Links <b class="caret"></b></a>
                 <ul class="dropdown-menu">
 #*            *##topLinks( $decoration.body.links )
                 </ul>
diff --git a/src/main/resources/css/maven-theme.css b/src/main/resources/css/maven-theme.css
index 7a3120a..8538489 100644
--- a/src/main/resources/css/maven-theme.css
+++ b/src/main/resources/css/maven-theme.css
@@ -143,3 +143,7 @@ li.pull-right {
 input.search-query {
   padding-right: 0px;
 }
+
+a.dropdown-toggle {
+  cursor: pointer;
+}