Skip to content

Commit 7a23c82

Browse files
authored
Merge pull request #927 from robertpanzer/fix-926-extension-config-symbols
Fixes #926. Make sure that symbols stay symbols in extension config.
2 parents e241173 + 98cdb38 commit 7a23c82

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

Diff for: CHANGELOG.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[
1515

1616
Bug Fixes::
1717

18+
* Inline macro attribute parsing changes after first document conversion (@wilkinsona) (#926)
1819
* Upgrade to Rouge 3.20.0, fixing error `uninitialized constant Rouge::Lexers` problem (@ahus1) (#925)
1920

2021
== 2.3.0 (2020-05-02)

Diff for: asciidoctorj-core/src/main/java/org/asciidoctor/jruby/internal/RubyHashMapDecorator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private Object convertRubyValue(Object rubyValue) {
144144
return NodeConverter.createASTNode(rubyObject);
145145
}
146146
if (rubyObject instanceof RubySymbol) {
147-
return ((RubySymbol) rubyObject).asJavaString();
147+
return ":" + rubyObject.asString();
148148
}
149149
return JavaEmbedUtils.rubyToJava((IRubyObject) rubyValue);
150150
} else {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.asciidoctor.extension;
2+
3+
import org.asciidoctor.Asciidoctor;
4+
import org.asciidoctor.ast.ContentNode;
5+
import org.junit.Test;
6+
7+
import java.util.Collections;
8+
import java.util.HashMap;
9+
import java.util.Map;
10+
11+
import static org.hamcrest.Matchers.containsString;
12+
import static org.junit.Assert.assertThat;
13+
14+
public class WhenTheInlineMacroProcessorRunsTwice {
15+
16+
// See https://github.com/asciidoctor/asciidoctorj/issues/926
17+
@Test
18+
public void inlineMacroAttributes() {
19+
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
20+
asciidoctor.javaExtensionRegistry().inlineMacro(new InlineMacroProcessor("example") {
21+
22+
@Override
23+
public Object process(ContentNode parent, String target, Map<String, Object> attributes) {
24+
return createPhraseNode(parent, "quoted", attributes.toString(), attributes, new HashMap<>());
25+
}
26+
27+
});
28+
assertThat(convert(asciidoctor), containsString("{format=test}"));
29+
assertThat(convert(asciidoctor), containsString("{format=test}"));
30+
}
31+
32+
private String convert(Asciidoctor asciidoctor) {
33+
return asciidoctor.convert("example:alpha.bravo[format=test]", Collections.emptyMap());
34+
}
35+
36+
}

0 commit comments

Comments
 (0)