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 2f8aad6 Mark the menu item of an unlisted page's series
2f8aad6 is described below
commit 2f8aad6bfc709dafb9bb76472f3e443ce7d6ba65
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Tue Nov 3 02:21:21 2026 +0000
Mark the menu item of an unlisted page's series
A page that no menu lists, such as docs/4.0.0/release-notes.html,
marks the item whose directory is the nearest parent of its own, when
exactly one item points into that directory. Pages next to an item and
links to other sites never match.
Refs apache/maven-doxia-sitetools#657
---
src/it/menu-series/pom.xml | 53 +++++++++++++++++
.../src/site/markdown/docs/1.0/release-notes.md | 21 +++++++
.../src/site/markdown/docs/2.0/release-notes.md | 21 +++++++
.../menu-series/src/site/markdown/docs/history.md | 21 +++++++
.../menu-series/src/site/markdown/docs/unlisted.md | 21 +++++++
src/it/menu-series/src/site/markdown/index.md | 21 +++++++
src/it/menu-series/src/site/markdown/tools/a.md | 21 +++++++
.../src/site/markdown/tools/a/details.md | 21 +++++++
src/it/menu-series/src/site/markdown/tools/b.md | 21 +++++++
src/it/menu-series/src/site/site.xml | 42 +++++++++++++
src/it/menu-series/verify.groovy | 41 +++++++++++++
src/main/resources/META-INF/maven/site-macros.vm | 68 +++++++++++++++++++++-
12 files changed, 370 insertions(+), 2 deletions(-)
diff --git a/src/it/menu-series/pom.xml b/src/it/menu-series/pom.xml
new file mode 100644
index 0000000..73a3efd
--- /dev/null
+++ b/src/it/menu-series/pom.xml
@@ -0,0 +1,53 @@
+<?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>
+ <parent>
+ <groupId>org.apache.maven.skins</groupId>
+ <artifactId>maven-skins</artifactId>
+ <version>@project.parent.version@</version>
+ </parent>
+
+ <groupId>org.apache.maven.skins.its</groupId>
+ <artifactId>@project.artifactId@-menu-series</artifactId>
+ <version>@project.version@</version>
+
+ <name>@project.name@ IT, menu series</name>
+ <url>https://maven.apache.org/skins/@project.artifactId@/menu-series/</url>
+
+ <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>
+
+
+</project>
diff --git a/src/it/menu-series/src/site/markdown/docs/1.0/release-notes.md
b/src/it/menu-series/src/site/markdown/docs/1.0/release-notes.md
new file mode 100644
index 0000000..aa0e754
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/docs/1.0/release-notes.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Release notes 1.0
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/docs/2.0/release-notes.md
b/src/it/menu-series/src/site/markdown/docs/2.0/release-notes.md
new file mode 100644
index 0000000..1c7be7b
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/docs/2.0/release-notes.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Release notes 2.0
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/docs/history.md
b/src/it/menu-series/src/site/markdown/docs/history.md
new file mode 100644
index 0000000..d16972a
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/docs/history.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# History
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/docs/unlisted.md
b/src/it/menu-series/src/site/markdown/docs/unlisted.md
new file mode 100644
index 0000000..61e2a4f
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/docs/unlisted.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Unlisted
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/index.md
b/src/it/menu-series/src/site/markdown/index.md
new file mode 100644
index 0000000..e6386ee
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/index.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Home
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/tools/a.md
b/src/it/menu-series/src/site/markdown/tools/a.md
new file mode 100644
index 0000000..8a0df41
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/tools/a.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Tool A
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/tools/a/details.md
b/src/it/menu-series/src/site/markdown/tools/a/details.md
new file mode 100644
index 0000000..18e3337
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/tools/a/details.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Tool A details
+
+Text.
diff --git a/src/it/menu-series/src/site/markdown/tools/b.md
b/src/it/menu-series/src/site/markdown/tools/b.md
new file mode 100644
index 0000000..f436b0b
--- /dev/null
+++ b/src/it/menu-series/src/site/markdown/tools/b.md
@@ -0,0 +1,21 @@
+<!--
+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.
+-->
+# Tool B
+
+Text.
diff --git a/src/it/menu-series/src/site/site.xml
b/src/it/menu-series/src/site/site.xml
new file mode 100644
index 0000000..8bc7276
--- /dev/null
+++ b/src/it/menu-series/src/site/site.xml
@@ -0,0 +1,42 @@
+<?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.
+ */
+ -->
+
+<site xmlns="http://maven.apache.org/SITE/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0
https://maven.apache.org/xsd/site-2.0.0.xsd"
+ name="${skinName}">
+
+ <skin>
+ <groupId>${skinGroupId}</groupId>
+ <artifactId>${skinArtifactId}</artifactId>
+ <version>${skinVersion}</version>
+ </skin>
+
+ <body>
+ <menu name="Docs">
+ <item name="Home" href="index.html"/>
+ <item name="History" href="docs/history.html"/>
+ <item name="Tool A" href="tools/a.html"/>
+ <item name="Tool B" href="tools/b.html"/>
+ </menu>
+ </body>
+</site>
diff --git a/src/it/menu-series/verify.groovy b/src/it/menu-series/verify.groovy
new file mode 100644
index 0000000..a5f3b9f
--- /dev/null
+++ b/src/it/menu-series/verify.groovy
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+String page( String path ) {
+ new File( basedir, "target/site/" + path ).text
+}
+
+// a page listed in the menu is marked as the current page
+assert page( "docs/history.html" ).contains( '<li><a class="active"
aria-current="page">History</a></li>' )
+assert !page( "docs/history.html" ).contains( 'aria-current="true"' )
+
+// an unlisted page in a subdirectory of a listed item's directory marks that
item as part of its series
+String notes = page( "docs/1.0/release-notes.html" )
+assert notes.contains( 'class="active" aria-current="true">History</a></li>' )
+assert !notes.contains( 'aria-current="page"' )
+assert page( "docs/2.0/release-notes.html" ).contains( 'class="active"
aria-current="true">History</a></li>' )
+
+// a page next to the listed item, not below it, marks nothing
+assert !page( "docs/unlisted.html" ).contains( 'class="active"' )
+
+// a directory that two items point into belongs to neither
+assert !page( "tools/a/details.html" ).contains( 'class="active"' )
+
+// pages at the site root never take a series marker
+assert !page( "index.html" ).contains( 'aria-current="true"' )
diff --git a/src/main/resources/META-INF/maven/site-macros.vm
b/src/main/resources/META-INF/maven/site-macros.vm
index 31a3346..e57afc2 100644
--- a/src/main/resources/META-INF/maven/site-macros.vm
+++ b/src/main/resources/META-INF/maven/site-macros.vm
@@ -198,13 +198,73 @@
#**##set( $pageHref = $pageHref.replaceAll( '\\', '/' ) )
#end
##
+## the menu item for a page that no menu lists: the item whose directory is
the longest prefix of the page's
+## directory, so a series of pages such as docs/4.0.0/release-notes.html marks
the item for docs/history.html;
+## the page sits in a subdirectory of the item's, never next to it, and a
directory counts only when exactly one item
+## points into it, so a folder of unrelated pages marks nothing;
+## items at the site root and links to other sites never match
(apache/maven-doxia-sitetools#657)
+#macro( seriesItem $menus )
+#**##set( $exactItem = false )
+#**##set( $seriesItem = false )
+#**##set( $seriesOwners = {} )
+#**##set( $seriesCounts = {} )
+#**##foreach( $menu in $menus )
+#* *##if( $menu.items && $menu.items.size() > 0 )#seriesWalk( $menu.items
)#end
+#**##end
+#**##if( !$exactItem && $currentFileName && $currentFileName.lastIndexOf( '/'
) > 0 )
+#* *##set( $pageDir = $currentFileName.substring( 0,
$currentFileName.lastIndexOf( '/' ) + 1 ) )
+#* *##set( $seriesDepth = 0 )
+#* *##foreach( $dir in $seriesOwners.keySet() )
+#* *##if( $pageDir.startsWith( $dir ) && $pageDir != $dir && $dir.length()
> $seriesDepth && $seriesCounts.get( $dir ) == 1 )
+#* *##set( $seriesItem = $seriesOwners.get( $dir ) )
+#* *##set( $seriesDepth = $dir.length() )
+#* *##end
+#* *##end
+#**##end
+#end
+##
+#macro( seriesWalk $items )
+#**##foreach( $walkItem in $items )
+#* *##pageHref( $walkItem.href )
+#* *##if( $alignedFileName == $pageHref )
+#* *##set( $exactItem = true )
+#* *##end
+#* *##set( $walkHref = "$!walkItem.href" )
+#* *##if( $project && $project.url )
+#* *##set( $siteRoot = $project.url )
+#* *##if( !$siteRoot.endsWith( '/' ) )
+#* *##set( $siteRoot = "${siteRoot}/" )
+#* *##end
+#* *##if( $walkHref.startsWith( $siteRoot ) )
+#* *##set( $walkHref = $walkHref.substring( $siteRoot.length() ) )
+#* *##end
+#* *##end
+#* *##if( $walkHref.startsWith( '/' ) )
+#* *##set( $walkHref = $walkHref.substring( 1 ) )
+#* *##elseif( $walkHref.startsWith( './' ) )
+#* *##set( $walkHref = $walkHref.substring( 2 ) )
+#* *##end
+#* *##if( !$walkHref.contains( ':' ) && !$walkHref.startsWith( '../' ) &&
$walkHref.lastIndexOf( '/' ) > 0 )
+#* *##set( $walkDir = $walkHref.substring( 0, $walkHref.lastIndexOf( '/' )
+ 1 ) )
+#* *##if( $seriesCounts.containsKey( $walkDir ) )
+#* *##set( $walkCount = $seriesCounts.get( $walkDir ) + 1 )
+#* *##else
+#* *##set( $walkCount = 1 )
+#* *##set( $walkIgnored = $seriesOwners.put( $walkDir, $walkItem ) )
+#* *##end
+#* *##set( $walkIgnored = $seriesCounts.put( $walkDir, $walkCount ) )
+#* *##end
+#* *##if( $walkItem.items && $walkItem.items.size() > 0 )#seriesWalk(
$walkItem.items )#end
+#**##end
+#end
+##
#macro( displayTree $item $display )
#**##if( $item.items && $item.items.size() > 0 )
#* *##foreach( $subItem in $item.items )
#* *##pageHref( $subItem.href )
#* *##set( $subItemHref = $pageHref )
##
-#* *##if( $alignedFileName == $subItemHref )
+#* *##if( $alignedFileName == $subItemHref || $subItem == $seriesItem )
#* *##set( $display = true )
#* *##end
##
@@ -221,12 +281,15 @@
## collapsed by default: expanded when collapse is false, or when the page is
the item or below it
#* *##set( $display = false )
#* *##displayTree( $item $display )
-#* *##if( $item.collapse == false || $alignedFileName == $currentItemHref ||
$display )
+#* *##if( $item.collapse == false || $alignedFileName == $currentItemHref ||
$item == $seriesItem || $display )
#* *##set( $expanded = true )
#* *##end
#**##end
#**##if( $alignedFileName == $currentItemHref )
#* *##set( $linkClass = 'active" aria-current="page' )
+#**##elseif( $item == $seriesItem )
+## the page belongs to this item's series: marked like the current page,
announced as the current item of a set
+#* *##set( $linkClass = 'active" aria-current="true' )
#**##elseif( $item.items && $item.items.size() > 0 && !$expanded )
## a caret marks an item whose sub-items are not shown
#* *##set( $linkClass = "collapsed" )
@@ -247,6 +310,7 @@ $indent ##
#end
##
#macro( mainMenu $menus )
+#**##seriesItem( $menus )
<ul class="menu-list list-unstyled mb-0">
#**##foreach( $menu in $menus )
#**##if( $menu.name )