Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension block_macro() not supported ? #193

Closed
davidB opened this issue Jun 16, 2016 · 5 comments
Closed

Extension block_macro() not supported ? #193

davidB opened this issue Jun 16, 2016 · 5 comments
Labels
2.x Issue related to the 2.x series documentation
Milestone

Comments

@davidB
Copy link

davidB commented Jun 16, 2016

Hi,

I'm new into asciidoctor, so maybe I did a miss configuration, but when I try to declare a block_macro the build failed. (it works with the sample bock())

./gradlew clean asciidoc
:clean
:asciidoctor FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/davidb/tmp/sandbox_jme_wiki/sandbox_wiki_jme/build.gradle' line: 37

* What went wrong:
Execution failed for task ':asciidoctor'.
> Could not find method block_macro() for arguments [{name=iframe}, build_5c1dmp5gvj1ykvv0yf67pkgtt$_run_closure2$_closure6$_closure7@46de1668] on root project 'sandbox_wiki_jme'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.433 secs

And the build.gradle fragment:

asciidoctor {
    resources {
        from('src/docs/images')
    }
    resources {
        from('src/docs/resources')
    }
    attributes 'build-gradle': file('build.gradle'),
        'sourcedir': project.sourceSets.main.java.srcDirs[0],
        'endpoint-url': 'http://davidb.github.io/sandbox_wiki_jme',
        'source-highlighter' : 'coderay',
        'linkcss': 'true',
        //'imagesdir':'/images',
        'toc':'left',
        'icons': 'font',
        'setanchors':'true',
        'idprefix':'',
        'idseparator':'-',
        'docinfo1':'true',
        'orgname':'jMonkeyEngine'
    options header_footer: true,
        template_dirs: [file('src/templates/slim').absolutePath]
    extensions {
        block_macro(name: 'iframe') {
            parent, target, attributes ->
            String content = """<iframe src="${target}"></iframe>""";
            createBlock(parent, "pass", [content], attributes, config);
        }
    }
}
@abelsromero
Copy link
Member

First, apologies, the DSL module is still in alpha and there's been some changes in some method names and that's not clear in the documentation.
The error appears because the asciidoctor-gradle-plugin is not using the last source of the DSL in which 'blockmacro' was replaced by 'block_macro' to align it the core Ruby module of Asciidoctor.

To fix it, just remove the underscore from the method name (use 'blockmacro') and your extension will work.
Reminder, the DSL module for extensions is Alpha, so if you see anything that could be improved feel free to open an issue in the project https://github.com/asciidoctor/asciidoctorj-groovy-dsl. All feedback is welcome :)

@mojavelinux
Copy link
Member

It's also possible to tell the plugin to use the latest release, right?

asciidoctorj {
  groovyDslVersion = '1.0.0.Alpha1'
}

This needs to be documented in the README, so I'm going to mark this as a documentation issue.

@abelsromero
Copy link
Member

It's also possible to tell the plugin to use the latest release, right?

I think so, but I am not sure if the changes have been published and what is published right now...
The history for the version file shows no changes.
The Alpha1 release was published on 1st April 15 (according to bintray), but the block_macro method was added on the 25th March 15. In theory it should be present, but I tested it and is not.

@robertpanzer can you help?

@mojavelinux
Copy link
Member

That configuration setting may not yet be available in a released version of the plugin. If I add the dependency explicitly, it works:

    classpath('org.asciidoctor:asciidoctorj-groovy-dsl:1.0.0.Alpha1') {
      exclude group: 'org.codehaus.groovy', module: 'groovy-all'
      exclude group: 'org.asciidoctor', module: 'asciidoctorj'
    }

@ysb33r ysb33r added 1.[56].x Issues related to the 1.5.x/1.6.x series 2.x Issue related to the 2.x series labels Jul 1, 2018
@ysb33r ysb33r added this to the 2.0.0 milestone Jul 1, 2018
@ysb33r ysb33r mentioned this issue Jul 2, 2018
28 tasks
@ysb33r ysb33r modified the milestones: 2.0.0, 2.1.0 Mar 22, 2019
@ysb33r ysb33r modified the milestones: 2.1.0, 2.2.0 Apr 11, 2019
@ysb33r ysb33r removed the 1.[56].x Issues related to the 1.5.x/1.6.x series label Apr 23, 2019
@ysb33r
Copy link
Member

ysb33r commented Apr 23, 2019

Use 2.1.0 of the plugin.

@ysb33r ysb33r closed this as completed Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issue related to the 2.x series documentation
Projects
None yet
Development

No branches or pull requests

4 participants