You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/05/21 01:21:50 UTC

[GitHub] [maven-doxia] feckertson commented on a diff in pull request #98: [DOXIA-590] Either provided element class or default class gets ignored

feckertson commented on code in PR #98:
URL: https://github.com/apache/maven-doxia/pull/98#discussion_r878615108


##########
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:
   This change covers the opening statement in my Jira but not the complexity described in my follow-up statement.
   
   I believe the code should check to see if givenRowClass matches `"\b(?:a|b)\b"` and skip appending rowClass if it does. That is, don't add "a" or "b" if the provide class already has one or the other.  This would allow the consumer to decide whether a row is initially odd or even.
   
   Why would one want to control this?  In order to create a table which supports hiding/showing selected rows and have it initially displayed with the rows hidden.
   
   To be clear, the zebra striping does not work correctly when rows are hidden. To address the matter, javascript must be employed to fix up the "a" and "b" assignments when rows are hidden/displayed and I did not see a way to have doxia execute some javascript just before or just after the document is rendered. 
   
   Without this control one must first display all the rows and then hide the rows that should be hidden.  This can create a noticeable flicker.  In my use case, I opted to start with no rows hidden because of the flicker.  The user then has to select a toggle to hide the noise, but it would be better experience to start with those rows already hidden. 
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org