forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request asciidoctor#449 from robertpanzer/fix-448
Fixes asciidoctor#448. Change parent node passed to InlineMacroProcessors to Con…
- Loading branch information
Showing
14 changed files
with
106 additions
and
39 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
asciidoctorj-core/src/main/java/org/asciidoctor/extension/BlockMacroProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
asciidoctorj-core/src/main/java/org/asciidoctor/extension/InlineMacroProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...rc/test/groovy/org/asciidoctor/extension/WhenAnInlineMacroProcessorProcessesATable.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.asciidoctor.extension | ||
|
||
import org.asciidoctor.Asciidoctor | ||
import org.asciidoctor.OptionsBuilder | ||
import org.jboss.arquillian.spock.ArquillianSputnik | ||
import org.jboss.arquillian.test.api.ArquillianResource | ||
import org.jsoup.Jsoup | ||
import org.jsoup.nodes.Document | ||
import org.jsoup.nodes.Element | ||
import org.junit.runner.RunWith | ||
import spock.lang.Issue | ||
import spock.lang.Specification | ||
|
||
@Issue('https://github.com/asciidoctor/asciidoctorj/issues/448') | ||
@RunWith(ArquillianSputnik) | ||
class WhenAnInlineMacroProcessorProcessesATable extends Specification { | ||
|
||
public static final String UTF8 = 'UTF-8' | ||
public static final String HREF = 'href' | ||
public static final String ANCHOR_TAG = 'a' | ||
public static final String TARGET = 'gittutorial.html' | ||
|
||
@ArquillianResource | ||
private Asciidoctor asciidoctor | ||
|
||
private static final String INLINE_MACRO_DOCUMENT = '''= Test document | ||
|=== | ||
| You can find infos on man:gittutorial[7] or man:git[8, 1]. | ||
|=== | ||
''' | ||
|
||
private static final String INLINE_MACRO_DOCUMENT_ASCIIDOC_STYLE = '''= Test document | ||
|=== | ||
a| You can find infos on man:gittutorial[7] or man:git[8, 1]. | ||
|=== | ||
''' | ||
|
||
|
||
def "a InlineMacroProcessor should be able to process table cells"() { | ||
when: | ||
asciidoctor.javaExtensionRegistry().inlineMacro(AnnotatedLongInlineMacroProcessor) | ||
String result = asciidoctor.convert(INLINE_MACRO_DOCUMENT, OptionsBuilder.options().headerFooter(false)) | ||
|
||
then: | ||
Document doc = Jsoup.parse(result, UTF8) | ||
Element link = doc.getElementsByTag(ANCHOR_TAG).first() | ||
link.attr(HREF) == TARGET | ||
} | ||
|
||
def "a InlineMacroProcessor should be able to process table cells with asciidoc style"() { | ||
when: | ||
asciidoctor.javaExtensionRegistry().inlineMacro(AnnotatedLongInlineMacroProcessor) | ||
String result = asciidoctor.convert(INLINE_MACRO_DOCUMENT_ASCIIDOC_STYLE, OptionsBuilder.options().headerFooter(false)) | ||
|
||
then: | ||
Document doc = Jsoup.parse(result, UTF8) | ||
Element link = doc.getElementsByTag(ANCHOR_TAG).first() | ||
link.attr(HREF) == TARGET | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...n/src/test/java/org/asciidoctor/integrationguide/extension/ImageInlineMacroProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters