Login  Register

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

Posted by mojavelinux on Apr 09, 2020; 7:02pm
URL: https://discuss.asciidoctor.org/all-adoc-Failed-to-load-AsciiDoc-document-undefined-method-document-for-Asciidoctor-PreprocessorRead-tp7873p7877.html

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.

https://gitter.im/asciidoctor/asciidoctor

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



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/all-adoc-Failed-to-load-AsciiDoc-document-undefined-method-document-for-Asciidoctor-PreprocessorRead-tp7873.html
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