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 2024/08/15 17:28:05 UTC
(maven-fluido-skin) branch MSKINS-226 updated (2ae1262 -> 355dd5f)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch MSKINS-226
in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
omit 2ae1262 [MSKINS-226] Add custom option to explicitly enable AnchorJS along with options
add 2f21fdb [MSKINS-249] Fix for MSKINS-245 does not cover all cases
new 355dd5f [MSKINS-226] Add custom option to explicitly enable AnchorJS along with options
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (2ae1262)
\
N -- N -- N refs/heads/MSKINS-226 (355dd5f)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/resources/META-INF/maven/site.vm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(maven-fluido-skin) 01/01: [MSKINS-226] Add custom option to explicitly enable AnchorJS along with options
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MSKINS-226
in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
commit 355dd5f9dee4f3324bf01f131818c99356365f81
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Apr 9 18:16:34 2023 +0200
[MSKINS-226] Add custom option to explicitly enable AnchorJS along with options
This closes #51
---
src/it/mskins-226-anchorjs-no-options/pom.xml | 57 ++++++++++++++++++++++
.../src/site/apt/index.apt.vm | 36 ++++++++++++++
.../src/site/site.xml | 50 +++++++++++++++++++
.../mskins-226-anchorjs-no-options/verify.groovy | 23 +++++++++
src/it/mskins-226-anchorjs-options/pom.xml | 57 ++++++++++++++++++++++
.../src/site/apt/index.apt.vm | 36 ++++++++++++++
.../mskins-226-anchorjs-options/src/site/site.xml | 56 +++++++++++++++++++++
src/it/mskins-226-anchorjs-options/verify.groovy | 24 +++++++++
src/main/resources/META-INF/maven/site-macros.vm | 21 +++++---
src/main/resources/META-INF/maven/site.vm | 2 +-
src/site/apt/index.apt.vm | 38 +++++++++++++++
11 files changed, 392 insertions(+), 8 deletions(-)
diff --git a/src/it/mskins-226-anchorjs-no-options/pom.xml b/src/it/mskins-226-anchorjs-no-options/pom.xml
new file mode 100644
index 0000000..6e71e98
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-no-options/pom.xml
@@ -0,0 +1,57 @@
+<?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>
+
+ <groupId>org.apache.maven.skins.its</groupId>
+ <artifactId>mskins-226_anchorjs-no-options</artifactId>
+ <version>@project.version@</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-226-anchorjs-no-options/src/site/apt/index.apt.vm b/src/it/mskins-226-anchorjs-no-options/src/site/apt/index.apt.vm
new file mode 100644
index 0000000..ee74913
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-no-options/src/site/apt/index.apt.vm
@@ -0,0 +1,36 @@
+ ------
+ ${project.name}
+ ------
+ Jens Reimann
+ ------
+ 2018-03-23
+ ------
+
+~~ 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.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+${project.name}
+
+ This is a test for ${skinName} with no (default) AnchorJS options.
+ ${skinDescription}
+
+* Actual configuration
+
+%{snippet|id=skin-anchorjs|file=${project.basedir}/src/site/site.xml}
diff --git a/src/it/mskins-226-anchorjs-no-options/src/site/site.xml b/src/it/mskins-226-anchorjs-no-options/src/site/site.xml
new file mode 100644
index 0000000..9d23020
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-no-options/src/site/site.xml
@@ -0,0 +1,50 @@
+<?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}">
+
+ <skin>
+ <groupId>${skinGroupId}</groupId>
+ <artifactId>${skinArtifactId}</artifactId>
+ <version>${skinVersion}</version>
+ </skin>
+
+ <!-- START SNIPPET: skin-anchorjs -->
+ <custom>
+ <fluidoSkin>
+ <anchorJs />
+ </fluidoSkin>
+ </custom>
+ <!-- END SNIPPET: skin-anchorjs -->
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache Maven Fluido Skin" href="https://maven.apache.org/skins/maven-fluido-skin/index.html" />
+ <item name="Maven Fluido Skin ITs" href="https://maven.apache.org/skins/maven-fluido-skin/ITs.html" />
+ </breadcrumbs>
+ <head/>
+ </body>
+
+</project>
diff --git a/src/it/mskins-226-anchorjs-no-options/verify.groovy b/src/it/mskins-226-anchorjs-no-options/verify.groovy
new file mode 100644
index 0000000..e87484c
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-no-options/verify.groovy
@@ -0,0 +1,23 @@
+/*
+ * 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.text.contains( 'anchors.add()')
+assert !index.text.contains( 'anchors.options.')
diff --git a/src/it/mskins-226-anchorjs-options/pom.xml b/src/it/mskins-226-anchorjs-options/pom.xml
new file mode 100644
index 0000000..afabf03
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-options/pom.xml
@@ -0,0 +1,57 @@
+<?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>
+
+ <groupId>org.apache.maven.skins.its</groupId>
+ <artifactId>mskins-226_anchorjs-options</artifactId>
+ <version>@project.version@</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-226-anchorjs-options/src/site/apt/index.apt.vm b/src/it/mskins-226-anchorjs-options/src/site/apt/index.apt.vm
new file mode 100644
index 0000000..4c515ff
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-options/src/site/apt/index.apt.vm
@@ -0,0 +1,36 @@
+ ------
+ ${project.name}
+ ------
+ Jens Reimann
+ ------
+ 2018-03-23
+ ------
+
+~~ 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.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+${project.name}
+
+ This is a test for ${skinName} with custom AnchorJS options.
+ ${skinDescription}
+
+* Actual configuration
+
+%{snippet|id=skin-anchorjs|file=${project.basedir}/src/site/site.xml}
diff --git a/src/it/mskins-226-anchorjs-options/src/site/site.xml b/src/it/mskins-226-anchorjs-options/src/site/site.xml
new file mode 100644
index 0000000..f50b607
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-options/src/site/site.xml
@@ -0,0 +1,56 @@
+<?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}">
+
+ <skin>
+ <groupId>${skinGroupId}</groupId>
+ <artifactId>${skinArtifactId}</artifactId>
+ <version>${skinVersion}</version>
+ </skin>
+
+ <!-- START SNIPPET: skin-anchorjs -->
+ <custom>
+ <fluidoSkin>
+ <anchorJs>
+ <cssSelector>h1, h2, h3, h4, h5</cssSelector>
+ <options>
+ <class>.anchor</class>
+ <titleText>foo</titleText>
+ </options>
+ </anchorJs>
+ </fluidoSkin>
+ </custom>
+ <!-- END SNIPPET: skin-anchorjs -->
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache Maven Fluido Skin" href="https://maven.apache.org/skins/maven-fluido-skin/index.html" />
+ <item name="Maven Fluido Skin ITs" href="https://maven.apache.org/skins/maven-fluido-skin/ITs.html" />
+ </breadcrumbs>
+ <head/>
+ </body>
+
+</project>
diff --git a/src/it/mskins-226-anchorjs-options/verify.groovy b/src/it/mskins-226-anchorjs-options/verify.groovy
new file mode 100644
index 0000000..a7ea7a7
--- /dev/null
+++ b/src/it/mskins-226-anchorjs-options/verify.groovy
@@ -0,0 +1,24 @@
+/*
+ * 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.text.contains( 'anchors.add("h1, h2, h3, h4, h5")')
+assert index.text.contains( 'anchors.options.class = ".anchor"')
+assert index.text.contains( 'anchors.options.titleText = "foo"')
diff --git a/src/main/resources/META-INF/maven/site-macros.vm b/src/main/resources/META-INF/maven/site-macros.vm
index 9649832..f3b69c3 100644
--- a/src/main/resources/META-INF/maven/site-macros.vm
+++ b/src/main/resources/META-INF/maven/site-macros.vm
@@ -557,12 +557,19 @@ $indent </ul>##
Apache Maven Doxia Site Renderer#if( $doxiaSiteRendererVersion ) $doxiaSiteRendererVersion#end##
#end
##
-##
-#macro( anchorJS )
-<script>
- if(anchors) {
- anchors.add();
- }
-</script>
+#macro( anchorJs )
+#**##if ( $decoration.getCustomChild( 'fluidoSkin.anchorJs' ) )
+ <script>
+#* *##if ( $decoration.getCustomValue( 'fluidoSkin.anchorJs.cssSelector' ) && $decoration.getCustomValue( 'fluidoSkin.anchorJs.cssSelector' ) != '' )
+#* *##set ( $cssSelector = '"' + $decoration.getCustomValue( 'fluidoSkin.anchorJs.cssSelector' ) + '"' )
+#* *##end
+#* *##foreach( $option in $decoration.getCustomChild( 'fluidoSkin.anchorJs.options' ).getChildren() )
+#* *##if( $option.value && $option.value != "" )
+ anchors.options.$option.name = "$option.value";
+#* *##end
+#* *##end
+ anchors.add($!cssSelector);
+ </script>
+#**##end
#end
##
diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm
index ea785a4..03c96d4 100644
--- a/src/main/resources/META-INF/maven/site.vm
+++ b/src/main/resources/META-INF/maven/site.vm
@@ -274,6 +274,6 @@
#* *##end
</div>
</footer>
-#**##anchorJS()
+#**##anchorJs()
</body>
</html>
diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm
index 5f2398d..ca2b836 100644
--- a/src/site/apt/index.apt.vm
+++ b/src/site/apt/index.apt.vm
@@ -438,6 +438,44 @@ Welcome to ${project.name}!
As of version <<2.0.0-M9>>, support for Flattr buttons in fluido-skin has been removed.
+** {AnchorJS}
+
+ You can optionally enable anchor ID generation with {{{https://www.bryanbraun.com/anchorjs/}AnchorJS}}:
+
++-----+
+<project name="xxx">
+ [...]
+ <custom>
+ <fluidoSkin>
+ <anchorJs />
+ </fluidoSkin>
+ </custom>
+ [...]
+</project>
++-----+
+
+ Note that the generated IDs are not compatible with IDs generated by the underlying Doxia framework.
+
+ Additionally you can provide a CSS selector for the <<<add()>>> function and options:
+
++-----+
+<project name="xxx">
+ [...]
+ <custom>
+ <fluidoSkin>
+ <anchorJs>
+ <cssSelector>h1, h2, h3, h4, h5</cssSelector>
+ <options>
+ <class>.anchor</class>
+ <titleText>foo</titleText>
+ </options>
+ </anchorJs>
+ </fluidoSkin>
+ </custom>
+ [...]
+</project>
++-----+
+
** {Skip generation date}
Since version <<1.3.1>>, you can skip generation date from the line "Generated by Apache Maven Doxia at \<date\>"