[ 
https://issues.apache.org/jira/browse/DOXIA-590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17540372#comment-17540372
 ] 

ASF GitHub Bot commented on DOXIA-590:
--------------------------------------

michael-o commented on code in PR #98:
URL: https://github.com/apache/maven-doxia/pull/98#discussion_r878669535


##########
doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java:
##########
@@ -1567,21 +1567,24 @@ public void tableRow()
     @Override
     public void tableRow( SinkEventAttributes attributes )
     {
-        MutableAttributeSet att = new SinkEventAttributeSet();
+        MutableAttributeSet atts = SinkUtils.filterAttributes(
+                attributes, SinkUtils.SINK_TR_ATTRIBUTES );
 
-        if ( evenTableRow )
+        if ( atts == null )
         {
-            att.addAttribute( Attribute.CLASS, "a" );
+            atts = new SinkEventAttributeSet();
         }
-        else
+
+        String rowClass = evenTableRow ? "a" : "b";
+        if ( atts.isDefined( Attribute.CLASS.toString() ) )
         {
-            att.addAttribute( Attribute.CLASS, "b" );
+            String givenRowClass = (String) atts.getAttribute( 
Attribute.CLASS.toString() );
+            rowClass = givenRowClass + " " + rowClass;

Review Comment:
   I see and understand your usecase. We have these options:
   * Always append default class (the internal implementation might employ 
logic to determine the class name which is impossible to do externally)
   * If external class attribute is provided, take it as-is, don't add default 
class
   * Merge and avoid duplicates
   
   For me personally, if you have decided to provide attributes which are being 
set in the method called you are making a deliberate decision to ignore the set 
values. One of the problems is that class is a merge attribute while others are 
simply replace. That makes it complex. WDYT?
   
   @hboutemy Opinion?





> Either provided element class or default class gets ignored
> -----------------------------------------------------------
>
>                 Key: DOXIA-590
>                 URL: https://issues.apache.org/jira/browse/DOXIA-590
>             Project: Maven Doxia
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.8
>            Reporter: Fred Eckertson
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 2.0.0-M3, 1.11.2
>
>         Attachments: image-2022-05-18-21-57-40-619.png
>
>
> The following construct is somewhat common in doxia-core
> att.addAttribute( Attribute.CLASS, "a" );
> The documentation says that basic attributes (including CLASS) are supported. 
> However in cases like this either that "a" or the CLASS that was provided in 
> the attributes parameter will be ignored. The correct way to do this is to 
> append the provided CLASS to "a " if a CLASS attribute was provided.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to