Fixes Make sure that symbols stay symbols in extension config.
MODIFY
CHANGELOG.adoc
CHANGELOG.adoc
@@ -13,6 +13,10 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
== Unreleased
+Bug Fixes::
+
+* Inline macro attribute parsing changes after first document conversion (@wilkinsona) (#926)
+
== 2.3.0 (2020-05-02)
Improvement::

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/internal/RubyHashMapDecorator.java
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/internal/RubyHashMapDecorator.java
@@ -144,7 +144,7 @@ public class RubyHashMapDecorator implements Map<String, Object> {
return NodeConverter.createASTNode(rubyObject);
}
if (rubyObject instanceof RubySymbol) {
- return ((RubySymbol) rubyObject).asJavaString();
+ return ":" + rubyObject.asString();
}
return JavaEmbedUtils.rubyToJava((IRubyObject) rubyValue);
} else {

ADD
asciidoctorj-core/src/test/java/org/asciidoctor/extension/WhenTheInlineMacroProcessorRunsTwice.java
+package org.asciidoctor.extension;
+
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.ast.ContentNode;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertThat;
+
+public class WhenTheInlineMacroProcessorRunsTwice {
+
+ // See https://github.com/asciidoctor/asciidoctorj/issues/926
+ @Test
+ public void inlineMacroAttributes() {
+ Asciidoctor asciidoctor = Asciidoctor.Factory.create();
+ asciidoctor.javaExtensionRegistry().inlineMacro(new InlineMacroProcessor("example") {
+
+ @Override
+ public Object process(ContentNode parent, String target, Map<String, Object> attributes) {
+ return createPhraseNode(parent, "quoted", attributes.toString(), attributes, new HashMap<>());
+ }
+
+ });
+ assertThat(convert(asciidoctor), containsString("{format=test}"));
+ assertThat(convert(asciidoctor), containsString("{format=test}"));
+ }
+
+ private String convert(Asciidoctor asciidoctor) {
+ return asciidoctor.convert("example:alpha.bravo[format=test]", Collections.emptyMap());
+ }
+
+}

Fixes #926. Make sure that symbols stay symbols in extension config.