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.
Fixes asciidoctor#450, Pass a RubyAttributesMapDecorator to Processors.
- Loading branch information
1 parent
24872b9
commit a2967ea
Showing
8 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
...orj-core/src/test/groovy/org/asciidoctor/extension/AttributeCheckingBlockProcessor.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,15 @@ | ||
package org.asciidoctor.extension | ||
|
||
import org.asciidoctor.ast.StructuralNode | ||
|
||
@Contexts([Contexts.CONTEXT_PARAGRAPH]) | ||
@Name('checkattributes') | ||
class AttributeCheckingBlockProcessor extends BlockProcessor { | ||
|
||
|
||
@Override | ||
Object process(StructuralNode parent, Reader reader, Map<String, Object> attributes) { | ||
attributes.keySet().each { assert it in String } | ||
parent | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...-core/src/test/groovy/org/asciidoctor/extension/WhenAJavaExtensionChecksAttributes.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,35 @@ | ||
package org.asciidoctor.extension | ||
|
||
import org.asciidoctor.Asciidoctor | ||
import org.asciidoctor.OptionsBuilder | ||
import org.asciidoctor.SafeMode | ||
import org.jboss.arquillian.spock.ArquillianSputnik | ||
import org.jboss.arquillian.test.api.ArquillianResource | ||
import org.junit.runner.RunWith | ||
import spock.lang.Issue | ||
import spock.lang.Specification | ||
|
||
@Issue('https://github.com/asciidoctor/asciidoctorj/issues/450') | ||
@RunWith(ArquillianSputnik) | ||
class WhenAJavaExtensionChecksAttributes extends Specification { | ||
|
||
|
||
private static final String DOCUMENT = '''= Test document | ||
[checkattributes,avalue] | ||
Check me | ||
''' | ||
|
||
@ArquillianResource | ||
private Asciidoctor asciidoctor | ||
|
||
def "a BlockProcessor should only get String attribute keys"() { | ||
when: | ||
asciidoctor.javaExtensionRegistry().block(AttributeCheckingBlockProcessor) | ||
asciidoctor.convert(DOCUMENT, OptionsBuilder.options().headerFooter(true).safe(SafeMode.SERVER)) | ||
|
||
then: | ||
noExceptionThrown() | ||
} | ||
} |