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/06 23:05:45 UTC
[maven-fluido-skin] 01/01: [MSKINS-174] Render breadcrumbs div conditionally
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MSKINS-174
in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
commit 15a10951fd6e9a294fcc0ed71cc53d544d446880
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri May 6 21:27:05 2022 +0200
[MSKINS-174] Render breadcrumbs div conditionally
This closes #25
---
src/it/mskins-174/pom.xml | 63 ++++++++++++++++++++++++
src/it/mskins-174/src/site/site.xml | 37 ++++++++++++++
src/it/mskins-174/verify.groovy | 22 +++++++++
src/main/resources/META-INF/maven/site-macros.vm | 30 +++++------
src/main/resources/META-INF/maven/site.vm | 20 +++++---
5 files changed, 150 insertions(+), 22 deletions(-)
diff --git a/src/it/mskins-174/pom.xml b/src/it/mskins-174/pom.xml
new file mode 100644
index 0000000..ad12582
--- /dev/null
+++ b/src/it/mskins-174/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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 regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <!-- This we need because we don't want any breadcrumbs -->
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>24</version>
+ </parent>
+
+ <groupId>org.apache.maven.skins.its</groupId>
+ <artifactId>mskins-174</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <skinName>@project.name@</skinName>
+ <skinDescription>@project.description@</skinDescription>
+ <skinGroupId>@project.groupId@</skinGroupId>
+ <skinArtifactId>@project.artifactId@</skinArtifactId>
+ <skinVersion>@project.version@</skinVersion>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>@sitePluginVersion@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>@projectInfoReportsPluginVersion@</version>
+ <configuration>
+ <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/src/it/mskins-174/src/site/site.xml b/src/it/mskins-174/src/site/site.xml
new file mode 100644
index 0000000..ee1ed51
--- /dev/null
+++ b/src/it/mskins-174/src/site/site.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "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.
+ */
+ -->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
+ name="${skinName}">
+
+ <publishDate position="none" />
+ <version position="none" />
+
+ <skin>
+ <groupId>${skinGroupId}</groupId>
+ <artifactId>${skinArtifactId}</artifactId>
+ <version>${skinVersion}</version>
+ </skin>
+
+</project>
diff --git a/src/it/mskins-174/verify.groovy b/src/it/mskins-174/verify.groovy
new file mode 100644
index 0000000..0e8f566
--- /dev/null
+++ b/src/it/mskins-174/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "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.
+ */
+
+File index = new File( basedir, "target/site/index.html" )
+assert index.exists()
+assert !index.getText().contains( '<div id="breadcrumbs">')
diff --git a/src/main/resources/META-INF/maven/site-macros.vm b/src/main/resources/META-INF/maven/site-macros.vm
index 25ab4f5..eb371c2 100644
--- a/src/main/resources/META-INF/maven/site-macros.vm
+++ b/src/main/resources/META-INF/maven/site-macros.vm
@@ -191,21 +191,23 @@
#end
##
#macro ( links $links )
-#**##set ( $counter = 0 )
-#**### MSKINS-41
-#**##set ( $begin = $links.size() - 1 )
-#**##foreach( $index in [$begin..0] )
-#* *##set ( $item = $links.get( $index ) )
-#* *##set ( $counter = $counter + 1 )
-#* *##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) )
-#* *##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
-##
- <li class="pull-right">##
-#* *##if ( $counter > 0 && $counter < $links.size() )
-#* *#<span class="divider">|</span>
+#**##if ( $links && $links.size() > 0 )
+#* *##set ( $counter = 0 )
+#* *### MSKINS-41
+#* *##set ( $begin = $links.size() - 1 )
+#* *##foreach( $index in [$begin..0] )
+#* *##set ( $item = $links.get( $index ) )
+#* *##set ( $counter = $counter + 1 )
+#* *##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) )
+#* *##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
+##
+ <li class="pull-right">##
+#* *##if ( $counter > 0 && $counter < $links.size() )
+#* *#<span class="divider">|</span>
+#* *##end
+#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false)
+#* *#</li>
#* *##end
-#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false)
-#* *#</li>
#**##end
#end
##
diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm
index d84dc30..5a0516d 100644
--- a/src/main/resources/META-INF/maven/site.vm
+++ b/src/main/resources/META-INF/maven/site.vm
@@ -202,19 +202,23 @@
<div class="clear"><hr/></div>
</div>
+#* *##set ( $publishDateLeftContent = "#publishDate( 'left' $decoration.publishDate $decoration.version )" )
+#* *##set ( $publishDateRightContent = "#publishDate( 'right' $decoration.publishDate $decoration.version )" )
+#* *### MSITE-44
+#* *##if ( !$topBarEnabled )
+#* *##set ( $linksContent = "#links( $decoration.body.links )" )
+#* *##end
+#* *##if ( $publishDateLeftContent.length() > 0 || $publishDateRightContent.length() > 0 ||
+ ( $linksContent && $linksContent.length() > 0 ) )
<div id="breadcrumbs">
<ul class="breadcrumb">
-#* *##publishDate( "left" $decoration.publishDate $decoration.version )
-#* *##publishDate( "right" $decoration.publishDate $decoration.version )
+#* *#$publishDateLeftContent##
+#* *#$publishDateRightContent##
##
-#* *### MSITE-44
-#* *##if ( !$topBarEnabled
- && $decoration.body.links
- && $decoration.body.links.size() > 0 )
-#* *##links( $decoration.body.links )
-#* *##end
+#* *#$!linksContent##
</ul>
</div>
+#* *##end
</header>
##
#* *##if ( $sideBarEnabled )