Add test case with inlineMacro with substitutions
ADD
asciidoctorj-core/src/test/java/org/asciidoctor/extension/SayMacro.java
+package org.asciidoctor.extension;
+
+import org.asciidoctor.ast.ContentNode;
+import org.asciidoctor.ast.StructuralNode;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SayMacro extends InlineMacroProcessor {
+
+ public SayMacro(String macroName) {
+ super(macroName);
+ }
+
+ public SayMacro(String macroName, Map<String, Object> config) {
+ super(macroName, config);
+ }
+
+ @Override
+ public Object process(ContentNode parent, String target, Map<String, Object> attributes) {
+ String text = "*" + target + "*";
+ Map<String, Object> phraseNodeAttributes = new HashMap<>();
+ phraseNodeAttributes.put("subs", ":normal");
+ return createPhraseNode(parent, "quoted", text, phraseNodeAttributes);
+ }
+
+}

MODIFY
asciidoctorj-core/src/test/java/org/asciidoctor/extension/WhenJavaExtensionIsRegistered.java
asciidoctorj-core/src/test/java/org/asciidoctor/extension/WhenJavaExtensionIsRegistered.java
@@ -740,6 +740,28 @@ public class WhenJavaExtensionIsRegistered {
assertThat(logRecords, hasSize(0));
}
+ @Test
+ public void an_inline_macro_with_subs_should_be_executed_when_an_inline_macro_is_detected() {
+
+ JavaExtensionRegistry javaExtensionRegistry = this.asciidoctor.javaExtensionRegistry();
+
+ javaExtensionRegistry.inlineMacro("say", "org.asciidoctor.extension.SayMacro");
+
+ String adoc = "Hello say:word[]!";
+ String content = asciidoctor.convert(adoc,
+ options().toFile(false));
+
+ org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8");
+ Element p = doc.getElementsByTag("p").first();
+ assertThat(p, notNullValue());
+ Element strong = p.getElementsByTag("strong").first();
+ assertThat(strong, notNullValue());
+ assertThat(strong.text(), is("word"));
+
+ final List<LogRecord> logRecords = TestLogHandlerService.getLogRecords();
+ assertThat(logRecords, hasSize(0));
+ }
+
@Test
public void should_unregister_all_current_registered_extensions() throws IOException {

Add test case with inlineMacro with substitutions