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/08/20 20:32:51 UTC

[maven-doxia] branch DOXIA-670 updated (66f4028e -> e6514f54)

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

michaelo pushed a change to branch DOXIA-670
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git


 discard 66f4028e [DOXIA-670] Remove code duplication in XdocSink
     new e6514f54 [DOXIA-670] Remove code duplication in XdocSink

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   (66f4028e)
            \
             N -- N -- N   refs/heads/DOXIA-670 (e6514f54)

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:
 .../apache/maven/doxia/module/xdoc/XdocSink.java   | 49 ++++++++++++++++++++++
 .../maven/doxia/module/xdoc/XdocSinkTest.java      |  4 +-
 2 files changed, 51 insertions(+), 2 deletions(-)


[maven-doxia] 01/01: [DOXIA-670] Remove code duplication in XdocSink

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

michaelo pushed a commit to branch DOXIA-670
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git

commit e6514f547e511aa765938b0eb8d6a4bbd373fb0f
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Aug 4 22:08:24 2022 +0200

    [DOXIA-670] Remove code duplication in XdocSink
---
 .../apache/maven/doxia/module/xdoc/XdocSink.java   | 32 ++--------------------
 .../maven/doxia/module/xdoc/XdocSinkTest.java      | 13 ++++++---
 2 files changed, 11 insertions(+), 34 deletions(-)

diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
index de012612..2a3f2e4f 100644
--- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
+++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
@@ -396,7 +396,6 @@ public class XdocSink
         MutableAttributeSet atts = SinkUtils.filterAttributes(
                 attributes, SinkUtils.SINK_VERBATIM_ATTRIBUTES  );
 
-
         if ( atts == null )
         {
             atts = new SinkEventAttributeSet();
@@ -406,10 +405,10 @@ public class XdocSink
 
         if ( atts.isDefined( SinkEventAttributes.DECORATION ) )
         {
-            boxed = "boxed".equals( atts.getAttribute( SinkEventAttributes.DECORATION ) );
+             boxedFlag = boxed =
+                "boxed".equals( atts.getAttribute( SinkEventAttributes.DECORATION ) );
         }
 
-        boxedFlag = boxed;
         atts.removeAttribute( SinkEventAttributes.DECORATION );
 
         if ( boxed )
@@ -418,7 +417,6 @@ public class XdocSink
         }
         else
         {
-            atts.removeAttribute( Attribute.ALIGN.toString() );
             writeStartTag( PRE, atts );
         }
     }
@@ -488,7 +486,6 @@ public class XdocSink
     public void tableRow()
     {
         MutableAttributeSet att = new SinkEventAttributeSet();
-        att.addAttribute( Attribute.VALIGN, "top" );
 
         writeStartTag( TR, att );
 
@@ -505,31 +502,6 @@ public class XdocSink
         init();
     }
 
-    /**
-     * Adds a link with an optional target.
-     *
-     * @param name the link name.
-     * @param target the link target, may be null.
-     */
-    public void link( String name, String target )
-    {
-        if ( isHeadFlag() )
-        {
-            return;
-        }
-
-        MutableAttributeSet att = new SinkEventAttributeSet();
-
-        att.addAttribute( Attribute.HREF, HtmlTools.escapeHTML( name ) );
-
-        if ( target != null )
-        {
-            att.addAttribute( Attribute.TARGET, target );
-        }
-
-        writeStartTag( A, att );
-    }
-
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
diff --git a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
index 3e8613f8..c439e7f2 100644
--- a/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
+++ b/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.doxia.module.xdoc;
  */
 
 import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.SinkEventAttributes;
 import org.apache.maven.doxia.sink.impl.AbstractSinkTest;
 import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
 import org.junit.jupiter.api.Test;
@@ -27,6 +28,8 @@ import org.junit.jupiter.api.Test;
 import java.io.StringWriter;
 import java.io.Writer;
 
+import javax.swing.text.html.HTML.Attribute;
+
 import static org.apache.maven.doxia.util.HtmlTools.escapeHTML;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
@@ -233,7 +236,7 @@ public class XdocSinkTest
     protected String getTableBlock( String cell, String caption )
     {
         return "<table border=\"0\"><caption>" + caption
-                + "</caption>\n<tr valign=\"top\">\n<td align=\"center\">" + cell + "</td></tr></table>";
+                + "</caption>\n<tr>\n<td align=\"center\">" + cell + "</td></tr></table>";
     }
 
     /** {@inheritDoc} */
@@ -416,9 +419,11 @@ public class XdocSinkTest
         {
             sink = new XdocSink( writer );
 
-            sink.link( "name", (String) null );
+            sink.link( "name" );
             sink.link_();
-            sink.link( "name", "nirvana" );
+            SinkEventAttributes attrs = new SinkEventAttributeSet();
+            attrs.addAttribute( Attribute.TARGET, "nirvana" );
+            sink.link( "name", attrs );
             sink.link_();
         }
         finally
@@ -426,7 +431,7 @@ public class XdocSinkTest
             sink.close();
         }
 
-        assertEquals( "<a href=\"name\"></a><a href=\"name\" target=\"nirvana\"></a>", writer.toString() );
+        assertEquals( "<a href=\"name\"></a><a target=\"nirvana\" href=\"name\"></a>", writer.toString() );
     }
 
     /** {@inheritDoc} */