all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x1f9a7684>

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x1f9a7684>

ch007m
Hi

Why the following asciidoctorj java code when it includes a preprocessor extension generates the following error ?

Apr 09, 2020 7:07:38 PM org.asciidoctor.jruby.internal.JRubyAsciidoctor convertFile
SEVERE: (NoMethodError) asciidoctor: FAILED: /Users/dabou/Code/github/cmoulliard/playbook-doc/asciidoctor/all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x69d2e517>
Exception in thread "main" org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.NoMethodError: (NoMethodError) asciidoctor: FAILED: /Users/dabou/Code/github/cmoulliard/playbook-doc/asciidoctor/all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x69d2e517>
        at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:400)
        at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:419)
        at dev.snowdrop.AsciidoctorGenerator.main(AsciidoctorGenerator.java:25)
Caused by: org.jruby.exceptions.NoMethodError: (NoMethodError) asciidoctor: FAILED: /Users/dabou/Code/github/cmoulliard/playbook-doc/asciidoctor/all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x69d2e517>

public class AsciidoctorGenerator {

    public static void main(String[] args) {
        String adocFile = args[0];
        Asciidoctor asciidoctor = Asciidoctor.Factory.create();

        // Include the Table extension
        asciidoctor.javaExtensionRegistry()
                .preprocessor(FindRolesPreProcessor.class)
                .block(GenerateTableBlockProcessor.class);
        // Generate HTML
        asciidoctor.convertFile(
                new File(adocFile),
                OptionsBuilder.options()
                        .toFile(true)
                        .safe(SafeMode.UNSAFE));

Best

Charles
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard
Reply | Threaded
Open this post in threaded view
|

Re: all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x1f9a7684>

mojavelinux
Administrator
Charles,

It would really be better if you asked these types of questions in the gitter channel rather than inundating the mailinglist with individual posts. It will not only keep the traffic here under control, you'll likely get better support.


Thanks for your cooperation!

Cheers,

-Dan

On Thu, Apr 9, 2020 at 11:08 AM ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi

Why the following asciidoctorj java code when it includes a preprocessor extension generates the following error ?

Apr 09, 2020 7:07:38 PM org.asciidoctor.jruby.internal.JRubyAsciidoctor convertFile
SEVERE: (NoMethodError) asciidoctor: FAILED: /Users/dabou/Code/github/cmoulliard/playbook-doc/asciidoctor/all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x69d2e517>
Exception in thread "main" org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.NoMethodError: (NoMethodError) asciidoctor: FAILED: /Users/dabou/Code/github/cmoulliard/playbook-doc/asciidoctor/all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x69d2e517>
        at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:400)
        at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:419)
        at dev.snowdrop.AsciidoctorGenerator.main(AsciidoctorGenerator.java:25)
Caused by: org.jruby.exceptions.NoMethodError: (NoMethodError) asciidoctor: FAILED: /Users/dabou/Code/github/cmoulliard/playbook-doc/asciidoctor/all.adoc: Failed to load AsciiDoc document - undefined method `document' for #<Asciidoctor::PreprocessorReader:0x69d2e517>

public class AsciidoctorGenerator {

    public static void main(String[] args) {
        String adocFile = args[0];
        Asciidoctor asciidoctor = Asciidoctor.Factory.create();

        // Include the Table extension
        asciidoctor.javaExtensionRegistry()
                .preprocessor(FindRolesPreProcessor.class)
                .block(GenerateTableBlockProcessor.class);
        // Generate HTML
        asciidoctor.convertFile(
                new File(adocFile),
                OptionsBuilder.options()
                        .toFile(true)
                        .safe(SafeMode.UNSAFE));

Best

Charles
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard



To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux