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/23 14:41:59 UTC

[maven-reporting-impl] branch MSHARED-1106 created (now 317284f)

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

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


      at 317284f  [MSHARED-1106] Improve and simplify section handling

This branch includes the following new commits:

     new 317284f  [MSHARED-1106] Improve and simplify section handling

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.



[maven-reporting-impl] 01/01: [MSHARED-1106] Improve and simplify section handling

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 317284fbf3c28c7b754ca52ed4b82055b2c54122
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Jul 23 16:41:49 2022 +0200

    [MSHARED-1106] Improve and simplify section handling
---
 .../reporting/AbstractMavenReportRenderer.java     | 125 ++-------------------
 1 file changed, 12 insertions(+), 113 deletions(-)

diff --git a/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java b/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
index c9f57a4..0d3afb4 100644
--- a/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
+++ b/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
@@ -21,7 +21,6 @@ package org.apache.maven.reporting;
 
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
-import org.apache.maven.doxia.util.HtmlTools;
 
 import org.apache.maven.shared.utils.StringUtils;
 
@@ -97,21 +96,9 @@ public abstract class AbstractMavenReportRenderer
      *
      * @param name the name 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_()
+     * @see Sink#section(int, org.apache.maven.doxia.sink.SinkEventAttributes)
+     * @see Sink#sectionTitle(int, org.apache.maven.doxia.sink.SinkEventAttributes)
+     * @see Sink#sectionTitle_(int)
      */
     protected void startSection( String name )
     {
@@ -124,118 +111,30 @@ public abstract class AbstractMavenReportRenderer
      * @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_()
+     * @see Sink#section(int, org.apache.maven.doxia.sink.SinkEventAttributes)
+     * @see Sink#sectionTitle(int, org.apache.maven.doxia.sink.SinkEventAttributes)
+     * @see Sink#sectionTitle_(int)
      */
     protected void startSection( String name, String anchor )
     {
         section = section + 1;
-
-        switch ( section )
-        {
-            case 1:
-                sink.section1();
-                sink.sectionTitle1();
-                break;
-            case 2:
-                sink.section2();
-                sink.sectionTitle2();
-                break;
-            case 3:
-                sink.section3();
-                sink.sectionTitle3();
-                break;
-            case 4:
-                sink.section4();
-                sink.sectionTitle4();
-                break;
-            case 5:
-                sink.section5();
-                sink.sectionTitle5();
-                break;
-
-            default:
-                // TODO: warning - just don't start a section
-                break;
-        }
-
+        sink.section( section, null );
+        sink.sectionTitle( section, null );
+        sink.anchor( anchor );
         text( name );
-
-        switch ( section )
-        {
-            case 1:
-                sink.sectionTitle1_();
-                break;
-            case 2:
-                sink.sectionTitle2_();
-                break;
-            case 3:
-                sink.sectionTitle3_();
-                break;
-            case 4:
-                sink.sectionTitle4_();
-                break;
-            case 5:
-                sink.sectionTitle5_();
-                break;
-
-            default:
-                // TODO: warning - just don't start a section
-                break;
-        }
-
-        sink.anchor( HtmlTools.encodeId( anchor ) );
         sink.anchor_();
+        sink.sectionTitle_( section );
     }
 
     /**
      * Convenience method to wrap section ending in the current sink.
      *
-     * @see Sink#section1_()
-     * @see Sink#section2_()
-     * @see Sink#section3_()
-     * @see Sink#section4_()
-     * @see Sink#section5_()
+     * @see Sink#section_()
      * @throws IllegalStateException if too many closing sections.
      */
     protected void endSection()
     {
-        switch ( section )
-        {
-            case 1:
-                sink.section1_();
-                break;
-            case 2:
-                sink.section2_();
-                break;
-            case 3:
-                sink.section3_();
-                break;
-            case 4:
-                sink.section4_();
-                break;
-            case 5:
-                sink.section5_();
-                break;
-
-            default:
-                // TODO: warning - just don't start a section
-                break;
-        }
-
+        sink.section_( section );
         section = section - 1;
 
         if ( section < 0 )