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/06/18 19:38:03 UTC

[maven-doxia] branch DOXIA-590 updated (a4da3895 -> 9fe50645)

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

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


    from a4da3895 [DOXIA-590] Either provided element class or default class gets ignored
     new 1fe1baf7 implement hidden rows
     new 9fe50645 Improve naming

The 2 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:
 .../maven/doxia/sink/impl/Xhtml5BaseSink.java      |  45 +++++---
 .../maven/doxia/sink/impl/XhtmlBaseSink.java       |  46 +++++---
 .../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java  | 120 +++++++++++++++++++-
 .../maven/doxia/sink/impl/XhtmlBaseSinkTest.java   | 122 ++++++++++++++++++++-
 4 files changed, 298 insertions(+), 35 deletions(-)


[maven-doxia] 01/02: implement hidden rows

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

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

commit 1fe1baf782cbe86ca9df484e0712b050663669b7
Author: Fred Eckertson <fe...@cerner.com>
AuthorDate: Wed Jun 1 22:07:08 2022 -0500

    implement hidden rows
---
 .../maven/doxia/sink/impl/Xhtml5BaseSink.java      |  37 +++++--
 .../maven/doxia/sink/impl/XhtmlBaseSink.java       |  38 ++++---
 .../maven/doxia/sink/impl/Xhtml5BaseSinkTest.java  | 120 +++++++++++++++++++-
 .../maven/doxia/sink/impl/XhtmlBaseSinkTest.java   | 122 ++++++++++++++++++++-
 4 files changed, 290 insertions(+), 27 deletions(-)

diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
index 57c14779..ace3220e 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Stack;
+import java.util.regex.Pattern;
 
 import javax.swing.text.MutableAttributeSet;
 import javax.swing.text.html.HTML.Attribute;
@@ -64,6 +65,9 @@ public class Xhtml5BaseSink
     /** The PrintWriter to write the result. */
     private final PrintWriter writer;
 
+    /** Used to identify if a class string contains `hidden` */
+    private static final Pattern HIDDEN_CLASS_PATTERN = Pattern.compile( "(?:.*\\s|^)hidden(?:\\s.*|$)" );
+
     /** Used to collect text events mainly for the head events. */
     private StringBuffer textBuffer = new StringBuffer();
 
@@ -1507,9 +1511,8 @@ public class Xhtml5BaseSink
     }
 
     /**
-     * The default class style is <code>a</code> or <code>b</code> depending the row id.
+     * Rows are striped with two colors by adding the class <code>a</code> or <code>b</code>. {@inheritDoc}
      *
-     * {@inheritDoc}
      * @see javax.swing.text.html.HTML.Tag#TR
      */
     @Override
@@ -1524,34 +1527,44 @@ public class Xhtml5BaseSink
     }
 
     /**
-     * The default class style is <code>a</code> or <code>b</code> depending the row id.
+     * Rows are striped with two colors by adding the class <code>a</code> or <code>b</code>. If the provided attributes
+     * specify the <code>hidden</code> class, the next call to tableRow will set the same striping class as this one. A
+     * style for <code>hidden</code> or <code>table.bodyTable hidden</code> may need to be provided to actually hide
+     * such a row. {@inheritDoc}
      *
-     * {@inheritDoc}
      * @see javax.swing.text.html.HTML.Tag#TR
      */
     @Override
     public void tableRow( SinkEventAttributes attributes )
     {
-        MutableAttributeSet atts = SinkUtils.filterAttributes(
+        MutableAttributeSet attrs = SinkUtils.filterAttributes(
                 attributes, SinkUtils.SINK_TR_ATTRIBUTES );
 
-        if ( atts == null )
+        if ( attrs == null )
         {
-            atts = new SinkEventAttributeSet();
+            attrs = new SinkEventAttributeSet();
         }
 
         String rowClass = evenTableRow ? "a" : "b";
-        if ( atts.isDefined( Attribute.CLASS.toString() ) )
+        boolean hidden = false;
+        if ( attrs.isDefined( Attribute.CLASS.toString() ) )
         {
-            String givenRowClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
+            String givenRowClass = (String) attrs.getAttribute( Attribute.CLASS.toString() );
+            if ( HIDDEN_CLASS_PATTERN.matcher( givenRowClass ).matches() )
+            {
+                hidden = true;
+            }
             rowClass = givenRowClass + " " + rowClass;
         }
 
-        atts.addAttribute( Attribute.CLASS, rowClass );
+        attrs.addAttribute( Attribute.CLASS, rowClass );
 
-        writeStartTag( HtmlMarkup.TR, atts );
+        writeStartTag( HtmlMarkup.TR, attrs );
 
-        evenTableRow = !evenTableRow;
+        if ( !hidden )
+        {
+            evenTableRow = !evenTableRow;
+        }
 
         if ( !this.cellCountStack.isEmpty() )
         {
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
index 5c879f30..7701484d 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Stack;
+import java.util.regex.Pattern;
 
 import javax.swing.text.MutableAttributeSet;
 import javax.swing.text.html.HTML.Attribute;
@@ -68,6 +69,9 @@ public class XhtmlBaseSink
     /** The PrintWriter to write the result. */
     private final PrintWriter writer;
 
+    /** Used to identify if a class string contains `hidden` */
+    private static final Pattern HIDDEN_CLASS_PATTERN = Pattern.compile( "(?:.*\\s|^)hidden(?:\\s.*|$)" );
+
     /** Used to collect text events mainly for the head events. */
     private StringBuffer textBuffer = new StringBuffer();
 
@@ -1385,9 +1389,8 @@ public class XhtmlBaseSink
     }
 
     /**
-     * The default class style is <code>a</code> or <code>b</code> depending the row id.
+     * Rows are striped with two colors by adding the class <code>a</code> or <code>b</code>. {@inheritDoc}
      *
-     * {@inheritDoc}
      * @see javax.swing.text.html.HTML.Tag#TR
      */
     @Override
@@ -1402,34 +1405,43 @@ public class XhtmlBaseSink
     }
 
     /**
-     * The default class style is <code>a</code> or <code>b</code> depending the row id.
+     * Rows are striped with two colors by adding the class <code>a</code> or <code>b</code>. If the provided attributes
+     * specify the <code>hidden</code> class, the next call to tableRow will set the same striping class as this one. A
+     * style for <code>hidden</code> or <code>table.bodyTable hidden</code> may need to be provided to actually hide
+     * such a row. {@inheritDoc}
      *
-     * {@inheritDoc}
      * @see javax.swing.text.html.HTML.Tag#TR
      */
     @Override
     public void tableRow( SinkEventAttributes attributes )
     {
-        MutableAttributeSet atts = SinkUtils.filterAttributes(
-                attributes, SinkUtils.SINK_TR_ATTRIBUTES );
+        MutableAttributeSet attrs = SinkUtils.filterAttributes( attributes, SinkUtils.SINK_TR_ATTRIBUTES );
 
-        if ( atts == null )
+        if ( attrs == null )
         {
-            atts = new SinkEventAttributeSet();
+            attrs = new SinkEventAttributeSet();
         }
 
         String rowClass = evenTableRow ? "a" : "b";
-        if ( atts.isDefined( Attribute.CLASS.toString() ) )
+        boolean hidden = false;
+        if ( attrs.isDefined( Attribute.CLASS.toString() ) )
         {
-            String givenRowClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
+            String givenRowClass = (String) attrs.getAttribute( Attribute.CLASS.toString() );
+            if ( HIDDEN_CLASS_PATTERN.matcher( givenRowClass ).matches() )
+            {
+                hidden = true;
+            }
             rowClass = givenRowClass + " " + rowClass;
         }
 
-        atts.addAttribute( Attribute.CLASS, rowClass );
+        attrs.addAttribute( Attribute.CLASS, rowClass );
 
-        writeStartTag( HtmlMarkup.TR, atts );
+        writeStartTag( HtmlMarkup.TR, attrs );
 
-        evenTableRow = !evenTableRow;
+        if ( !hidden )
+        {
+            evenTableRow = !evenTableRow;
+        }
 
         if ( !this.cellCountStack.isEmpty() )
         {
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
index 1e3ef4ec..6bc76fbc 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
@@ -1085,15 +1085,84 @@ public class Xhtml5BaseSinkTest
         {
             sink = new Xhtml5BaseSink( writer );
 
+            sink.tableRows( null, false );
+            sink.tableRow( attributes );
+            sink.tableRow_();
+            sink.tableRow();
+            sink.tableRow_();
+            sink.tableRows_();
+            sink.table_();
+        }
+        finally
+        {
+            sink.close();
+        }
+
+        String xmlExpected = "<table border=\"0\" class=\"bodyTable\">" + EOL + "<tr style=\"bold\" class=\"a\"></tr>"
+            + EOL + "<tr class=\"b\"></tr></table>";
+
+        assertEquals( xmlExpected, writer.toString() );
+    }
+
+    /**
+     * Test striping for hidden rows in tableRow method.
+     */
+    @Test
+    public void testHiddenTableRowStriping()
+    {
+        try
+        {
+            SinkEventAttributeSet attributes2 = new SinkEventAttributeSet();
+            SinkEventAttributeSet attributes3 = new SinkEventAttributeSet();
+            attributes3.addAttributes( attributes );
+            sink = new Xhtml5BaseSink( writer );
+
+            sink.tableRow();
+            sink.tableRow_();
             sink.tableRow( attributes );
             sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "hidden xyz abc" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "abc hidden xyz" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            sink.tableRow();
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "not-hidden xyz" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "xyz not-hidden" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            attributes3.addAttribute( SinkEventAttributes.CLASS, "xyz abc hidden" );
+            sink.tableRow( attributes3 );
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "xyz hidden-not" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            sink.tableRow();
+            sink.tableRow_();
         }
         finally
         {
             sink.close();
         }
 
-        assertEquals( "<tr style=\"bold\" class=\"a\"></tr>", writer.toString() );
+        StringBuilder sbExpeted = new StringBuilder( "<table border=\"0\" class=\"bodyTable\">" );
+        sbExpeted.append( EOL ).append( "<tr class=\"a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr style=\"bold\" class=\"b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"hidden xyz abc a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"abc hidden xyz a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"not-hidden xyz b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"xyz not-hidden a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr style=\"bold\" class=\"xyz abc hidden b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"xyz hidden-not b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"a\"></tr>" );
+
+        String xmlExpected = sbExpeted.toString();
+        assertEquals( xmlExpected, writer.toString() );
     }
 
     /**
@@ -1210,6 +1279,55 @@ public class Xhtml5BaseSinkTest
         assertEquals( "<a style=\"bold\" href=\"link.html\"></a>", writer.toString() );
     }
 
+    /**
+     * Test of link method for an external link.
+     */
+    @Test
+    public void testLinkExternal()
+    {
+        final String name = "https://www.apache.org";
+
+        try
+        {
+            sink = new Xhtml5BaseSink( writer );
+            sink.link( name, attributes );
+            sink.link_();
+        }
+        finally
+        {
+            sink.close();
+        }
+
+        assertEquals( "<a style=\"bold\" class=\"externalLink\" href=\"https://www.apache.org\"></a>",
+                      writer.toString() );
+    }
+
+    /**
+     * Test of link method for an external link when a css class is provided.
+     */
+    @Test
+    public void testLinkExternalClassExtend()
+    {
+        final String name = "https://www.apache.org";
+        SinkEventAttributeSet attributes2 = new SinkEventAttributeSet();
+        attributes2.addAttributes( attributes );
+        attributes2.addAttribute( SinkEventAttributes.CLASS, "cs1 cs2" );
+
+        try
+        {
+            sink = new Xhtml5BaseSink( writer );
+            sink.link( name, attributes2 );
+            sink.link_();
+        }
+        finally
+        {
+            sink.close();
+        }
+
+        assertEquals( "<a style=\"bold\" class=\"cs1 cs2 externalLink\" href=\"https://www.apache.org\"></a>",
+                      writer.toString() );
+    }
+
     /**
      * Test of inline method, of class Xhtml5BaseSink.
      */
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
index be4bd18c..ece60a56 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
@@ -47,6 +47,8 @@ public class XhtmlBaseSinkTest
     private XhtmlBaseSink sink;
     private Writer writer;
 
+    String EOL = System.lineSeparator();
+
     @BeforeEach
     public void setUp()
     {
@@ -705,15 +707,84 @@ public class XhtmlBaseSinkTest
         {
             sink = new XhtmlBaseSink( writer );
 
+            sink.tableRows( null, false );
+            sink.tableRow( attributes );
+            sink.tableRow_();
+            sink.tableRow();
+            sink.tableRow_();
+            sink.tableRows_();
+            sink.table_();
+        }
+        finally
+        {
+            sink.close();
+        }
+
+        String xmlExpected = "<table border=\"0\" class=\"bodyTable\">" + EOL + "<tr style=\"bold\" class=\"a\"></tr>"
+            + EOL + "<tr class=\"b\"></tr></table>";
+
+        assertEquals( xmlExpected, writer.toString() );
+    }
+
+    /**
+     * Test striping for hidden rows in tableRow method.
+     */
+    @Test
+    public void testHiddenTableRowStriping()
+    {
+        try
+        {
+            SinkEventAttributeSet attributes2 = new SinkEventAttributeSet();
+            SinkEventAttributeSet attributes3 = new SinkEventAttributeSet();
+            attributes3.addAttributes( attributes );
+            sink = new XhtmlBaseSink( writer );
+
+            sink.tableRow();
+            sink.tableRow_();
             sink.tableRow( attributes );
             sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "hidden xyz abc" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "abc hidden xyz" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            sink.tableRow();
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "not-hidden xyz" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "xyz not-hidden" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            attributes3.addAttribute( SinkEventAttributes.CLASS, "xyz abc hidden" );
+            sink.tableRow( attributes3 );
+            sink.tableRow_();
+            attributes2.addAttribute( SinkEventAttributes.CLASS, "xyz hidden-not" );
+            sink.tableRow( attributes2 );
+            sink.tableRow_();
+            sink.tableRow();
+            sink.tableRow_();
         }
         finally
         {
             sink.close();
         }
 
-        assertEquals( "<tr style=\"bold\" class=\"a\"></tr>", writer.toString() );
+        StringBuilder sbExpeted = new StringBuilder( "<table border=\"0\" class=\"bodyTable\">" );
+        sbExpeted.append( EOL ).append( "<tr class=\"a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr style=\"bold\" class=\"b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"hidden xyz abc a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"abc hidden xyz a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"not-hidden xyz b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"xyz not-hidden a\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr style=\"bold\" class=\"xyz abc hidden b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"xyz hidden-not b\"></tr>" ).append( EOL );
+        sbExpeted.append( "<tr class=\"a\"></tr>" );
+
+        String xmlExpected = sbExpeted.toString();
+        assertEquals( xmlExpected, writer.toString() );
     }
 
     /**
@@ -830,6 +901,55 @@ public class XhtmlBaseSinkTest
         assertEquals( "<a style=\"bold\" href=\"link.html\"></a>", writer.toString() );
     }
 
+    /**
+     * Test of link method for an external link.
+     */
+    @Test
+    public void testLinkExternal()
+    {
+        final String name = "https://www.apache.org";
+
+        try
+        {
+            sink = new XhtmlBaseSink( writer );
+            sink.link( name, attributes );
+            sink.link_();
+        }
+        finally
+        {
+            sink.close();
+        }
+
+        assertEquals( "<a style=\"bold\" class=\"externalLink\" href=\"https://www.apache.org\"></a>",
+                      writer.toString() );
+    }
+
+    /**
+     * Test of link method for an external link when a css class is provided.
+     */
+    @Test
+    public void testLinkExternalClassExtend()
+    {
+        final String name = "https://www.apache.org";
+        SinkEventAttributeSet attributes2 = new SinkEventAttributeSet();
+        attributes2.addAttributes( attributes );
+        attributes2.addAttribute( SinkEventAttributes.CLASS, "cs1 cs2" );
+
+        try
+        {
+            sink = new XhtmlBaseSink( writer );
+            sink.link( name, attributes2 );
+            sink.link_();
+        }
+        finally
+        {
+            sink.close();
+        }
+
+        assertEquals( "<a style=\"bold\" class=\"cs1 cs2 externalLink\" href=\"https://www.apache.org\"></a>",
+                      writer.toString() );
+    }
+
     /**
      * Test of italic/bold/monospaced method, of class XhtmlBaseSink.
      */


[maven-doxia] 02/02: Improve naming

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

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

commit 9fe506452e4a4eab8de435bc2cc2b9239ff02412
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Jun 18 21:22:38 2022 +0200

    Improve naming
---
 .../java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java     | 8 ++++----
 .../main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
index ace3220e..a7bc84c7 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
@@ -1828,14 +1828,14 @@ public class Xhtml5BaseSink
 
         if ( DoxiaUtils.isExternalLink( name ) )
         {
-            String hrefClass = "externalLink";
+            String linkClass = "externalLink";
             if ( atts.isDefined( Attribute.CLASS.toString() ) )
              {
-                 String givenClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
-                 hrefClass = givenClass + " " + hrefClass;
+                 String givenLinkClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
+                 linkClass = givenLinkClass + " " + linkClass;
              }
 
-             atts.addAttribute( Attribute.CLASS, hrefClass );
+             atts.addAttribute( Attribute.CLASS, linkClass );
         }
 
         atts.addAttribute( Attribute.HREF, HtmlTools.escapeHTML( name ) );
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
index 7701484d..18e94088 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
@@ -1705,14 +1705,14 @@ public class XhtmlBaseSink
 
         if ( DoxiaUtils.isExternalLink( name ) )
         {
-            String hrefClass = "externalLink";
+            String linkClass = "externalLink";
             if ( atts.isDefined( Attribute.CLASS.toString() ) )
              {
-                 String givenClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
-                 hrefClass = givenClass + " " + hrefClass;
+                 String givenLinkClass = (String) atts.getAttribute( Attribute.CLASS.toString() );
+                 linkClass = givenLinkClass + " " + linkClass;
              }
 
-             atts.addAttribute( Attribute.CLASS, hrefClass );
+             atts.addAttribute( Attribute.CLASS, linkClass );
         }
 
         atts.addAttribute( Attribute.HREF, HtmlTools.escapeHTML( name ) );