This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
The following commit(s) were added to refs/heads/master by this push:
new 98e6cdb Give banner images without alt the project name
98e6cdb is described below
commit 98e6cdba1e2b045838c73b6c2a61541a3422f342
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Mon Nov 2 00:00:55 2026 +0000
Give banner images without alt the project name
---
src/it/mskins-16/src/site/site.xml | 2 +-
src/it/mskins-16/verify.groovy | 4 ++++
src/it/sidebar/verify.groovy | 4 ++--
src/it/topbar/verify.groovy | 4 ++--
src/main/resources/META-INF/maven/site-macros.vm | 11 +++++++++++
5 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/it/mskins-16/src/site/site.xml
b/src/it/mskins-16/src/site/site.xml
index 29cbb46..91b237a 100644
--- a/src/it/mskins-16/src/site/site.xml
+++ b/src/it/mskins-16/src/site/site.xml
@@ -35,7 +35,7 @@
<image src="images/apache-maven-project-2.png" width="473px" height="93px"
style="border: 0" />
</bannerLeft>
- <bannerRight href="http://www.apache.org">
+ <bannerRight name="Apache" href="http://www.apache.org">
<image src="images/apache-maven-project-2.png" width="473px" height="93px"
style="border: 1" />
</bannerRight>
diff --git a/src/it/mskins-16/verify.groovy b/src/it/mskins-16/verify.groovy
index 557eb33..194f1f4 100644
--- a/src/it/mskins-16/verify.groovy
+++ b/src/it/mskins-16/verify.groovy
@@ -30,3 +30,7 @@ assert !new File( site, "css/gh-fork-ribbon.min.css"
).exists()
for ( String profile : [ 'pre-release', 'retired', 'sandbox' ] ) {
assert !new File( site, "images/profiles/${profile}.png" ).exists()
}
+
+// banner images without alt: the project name when the banner has no name,
empty when its name gives the text
+assert html.contains( '<a href="http://www.apache.org"><img
src="images/apache-maven-project-2.png" alt="Apache Maven Fluido Skin IT,
MSKINS-16" ' )
+assert html.contains( '<a href="http://www.apache.org"><img
src="images/apache-maven-project-2.png" alt="" style="width: 473px;height:
93px;border: 1" /> Apache</a>' )
diff --git a/src/it/sidebar/verify.groovy b/src/it/sidebar/verify.groovy
index 893d5aa..a0a7efc 100644
--- a/src/it/sidebar/verify.groovy
+++ b/src/it/sidebar/verify.groovy
@@ -31,5 +31,5 @@ assert html.contains( '<li><a
href="plugins.html">Plugins</a></li>' )
assert html.contains( '<li><a href="https://www.apache.org/">Apache</a><span
class="divider">/</span></li>' )
// MSKINS-263 - image without class in banner
-assert html.contains('<div class="pull-left"><div id="bannerLeft"><h1><a
href="../../../"><img
src="../../../images/apache-maven-project-light-theme.svg" style="width:
489px;height: 83px;" /></a></h1></div></div>')
-assert html.contains('<div class="pull-right"><div id="bannerRight"><h1><img
src="../../../images/logos/MavenLogoLeaf.svg" style="width: 340px;height:
83px;" /></h1></div></div>')
+assert html.contains('<div class="pull-left"><div id="bannerLeft"><h1><a
href="../../../"><img
src="../../../images/apache-maven-project-light-theme.svg" alt="Apache Maven
Fluido Skin IT, sidebar layout" style="width: 489px;height: 83px;"
/></a></h1></div></div>')
+assert html.contains('<div class="pull-right"><div id="bannerRight"><h1><img
src="../../../images/logos/MavenLogoLeaf.svg" alt="" style="width:
340px;height: 83px;" /></h1></div></div>')
diff --git a/src/it/topbar/verify.groovy b/src/it/topbar/verify.groovy
index a286085..4602ad4 100644
--- a/src/it/topbar/verify.groovy
+++ b/src/it/topbar/verify.groovy
@@ -31,8 +31,8 @@ assert html.contains( '<li><a
href="plugins.html">Plugins</a></li>' )
assert html.contains( '<li><a href="https://www.apache.org/">Apache</a><span
class="divider">/</span></li>' )
// MSKINS-263 - image without class in banner
-assert html.contains('<div class="pull-left"><div id="bannerLeft"><h1><a
href="../../../"><img
src="../../../images/apache-maven-project-light-theme.svg" style="width:
489px;height: 83px;" /></a></h1></div></div>')
-assert html.contains('<div class="pull-right"><div id="bannerRight"><h1><img
src="../../../images/logos/MavenLogoLeaf.svg" style="width: 340px;height:
83px;" /></h1></div></div>')
+assert html.contains('<div class="pull-left"><div id="bannerLeft"><h1><a
href="../../../"><img
src="../../../images/apache-maven-project-light-theme.svg" alt="Apache Maven
Fluido Skin IT, topbar layout" style="width: 489px;height: 83px;"
/></a></h1></div></div>')
+assert html.contains('<div class="pull-right"><div id="bannerRight"><h1><img
src="../../../images/logos/MavenLogoLeaf.svg" alt="" style="width:
340px;height: 83px;" /></h1></div></div>')
// edit link after the page title: the SVG icon, copied with the site
assert html =~ /<a href="[^"]+"><img src="\.\/images\/edit\.svg" alt="Edit"
width="14" height="14" \/><\/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 482fc31..69abc29 100644
--- a/src/main/resources/META-INF/maven/site-macros.vm
+++ b/src/main/resources/META-INF/maven/site-macros.vm
@@ -121,6 +121,8 @@
#* *##end
#* *##if( $image.alt )
#* *##set( $alt = ' alt="' + $esc.xml( $image.alt ) + '"' )
+#* *##elseif( $inBanner )
+#* *##set( $alt = ' alt="' + $esc.xml( $bannerAlt ) + '"' )
#* *##else
#* *##set( $alt = "" )
#* *##end
@@ -143,9 +145,18 @@
<img#if( $imageClass ) class="$imageClass"#end$src$alt#if( $style )
style="$style"#end />##
#end
##
+## a banner image without alt that is the only content of its link takes the
project name, so the link has a name;
+## otherwise its alt is empty: the banner's own name gives the text, or an
unlinked logo is decorative
#macro( banner $banner $id )
#**##if( $banner )
+#* *##set( $inBanner = true )
+#* *##if( !$banner.name && $banner.href && $project && $project.name )
+#* *##set( $bannerAlt = $project.name )
+#* *##else
+#* *##set( $bannerAlt = "" )
+#* *##end
#* *#<div id="$id"><h1>#link( $banner $null false $null "set" $null ""
)</h1></div>##
+#* *##set( $inBanner = false )
#**##end
#end
##