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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9899787c Accept attributes after semantics in Xhtml5BaseSink.inline
9899787c is described below

commit 9899787c5d143bc9cb630b74bcba56caee0a0d06
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Tue Nov 3 22:48:09 2026 +0000

    Accept attributes after semantics in Xhtml5BaseSink.inline
---
 .../java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java |  3 ++-
 .../org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java  | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

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 d48c2646..a6e82634 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
@@ -1347,9 +1347,10 @@ public class Xhtml5BaseSink extends AbstractXmlSink 
implements HtmlMarkup {
                                         getLocationLogPrefix(),
                                         attribute.getValue());
                         }
-                        
compliantAttributes.removeAttribute(SinkEventAttributes.SEMANTICS);
                     }
                 }
+                // removed after the loop: removing it while iterating fails 
on any attribute that follows it
+                
compliantAttributes.removeAttribute(SinkEventAttributes.SEMANTICS);
                 writeStartTag(tag, compliantAttributes);
                 inlineStack.push(Collections.singletonList(tag));
             } else {
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 7fd4b8f2..1e24139a 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
@@ -1205,6 +1205,17 @@ class Xhtml5BaseSinkTest {
         assertEquals(expected, writer.toString());
     }
 
+    @Test
+    void inlineSemanticsBeforeOtherAttributes() {
+        try (Sink sink = new Xhtml5BaseSink(writer)) {
+            sink.inline(new SinkEventAttributeSet(
+                    SinkEventAttributes.SEMANTICS, "code", 
SinkEventAttributes.CLASS, "language-java"));
+            sink.text("text");
+            sink.inline_();
+        }
+        assertEquals("<code class=\"language-java\">text</code>", 
writer.toString());
+    }
+
     @Test
     void addStyleWithStringValue() {
         SinkEventAttributes attributes = new SinkEventAttributeSet();

Reply via email to