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/07/01 19:08:05 UTC

[maven-reporting-impl] 01/01: [MSHARED-390] Add startSection method AbstractMavenReportRenderer where anchor != name

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

michaelo pushed a commit to branch MSHARED-390
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git

commit 7b7664dff26ea7a6ba51d3aeea1e88c19ea69a3a
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Jul 1 21:07:49 2022 +0200

    [MSHARED-390] Add startSection method AbstractMavenReportRenderer where anchor != name
    
    This closes #8
---
 .../reporting/AbstractMavenReportRenderer.java     | 30 +++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java b/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
index 24ef9a0..bff3d58 100644
--- a/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
+++ b/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
@@ -95,6 +95,7 @@ public abstract class AbstractMavenReportRenderer
      * Convenience method to wrap section creation in the current sink. An anchor will be add for the name.
      *
      * @param name the name of this section, could be null.
+     * @param anchor the anchor of this section, could be null.
      * @see #text(String)
      * @see Sink#section1()
      * @see Sink#sectionTitle1()
@@ -113,6 +114,33 @@ public abstract class AbstractMavenReportRenderer
      * @see Sink#sectionTitle5_()
      */
     protected void startSection( String name )
+    {
+        startSection( name, name );
+    }
+
+    /**
+     * Convenience method to wrap section creation in the current sink. An anchor will be add for the name.
+     *
+     * @param name the name of this section, could be null.
+     * @param anchor the anchor of this section, could be null.
+     * @see #text(String)
+     * @see Sink#section1()
+     * @see Sink#sectionTitle1()
+     * @see Sink#sectionTitle1_()
+     * @see Sink#section2()
+     * @see Sink#sectionTitle2()
+     * @see Sink#sectionTitle2_()
+     * @see Sink#section3()
+     * @see Sink#sectionTitle3()
+     * @see Sink#sectionTitle3_()
+     * @see Sink#section4()
+     * @see Sink#sectionTitle4()
+     * @see Sink#sectionTitle4_()
+     * @see Sink#section5()
+     * @see Sink#sectionTitle5()
+     * @see Sink#sectionTitle5_()
+     */
+    protected void startSection( String name, String anchor )
     {
         section = section + 1;
 
@@ -169,7 +197,7 @@ public abstract class AbstractMavenReportRenderer
                 break;
         }
 
-        sink.anchor( HtmlTools.encodeId( name ) );
+        sink.anchor( HtmlTools.encodeId( anchor ) );
         sink.anchor_();
     }