Package org.asciidoctor

Examples of org.asciidoctor.Asciidoctor$Factory


        if (asciidoctorCliOptions.isHelp() || parameters.length == 0) {
            jCommander.setProgramName("asciidoctor");
            jCommander.usage();
        } else {

            Asciidoctor asciidoctor = null;
           
            asciidoctor = buildAsciidoctorJInstance(asciidoctorCliOptions);
           
            if(asciidoctorCliOptions.isVersion()) {
                System.out.println("Asciidoctor "+asciidoctor.asciidoctorVersion()+" [http://asciidoctor.org]");
            }
           
            List<File> inputFiles = getInputFiles(asciidoctorCliOptions);

            if (inputFiles.isEmpty()) {
View Full Code Here


            }
        }
    }

    private Asciidoctor buildAsciidoctorJInstance(AsciidoctorCliOptions asciidoctorCliOptions) {
        Asciidoctor asciidoctor;
        if(asciidoctorCliOptions.isLoadPaths()) {
         asciidoctor = JRubyAsciidoctor.create(asciidoctorCliOptions.getLoadPaths());  
        } else {
            asciidoctor = JRubyAsciidoctor.create();
        }
View Full Code Here

    public static Asciidoctor create() {
        Map<String, Object> env = new HashMap<String, Object>();
        // ideally, we want to clear GEM_PATH by default, but for backwards compatibility we play nice
        //env.put(GEM_PATH, null);
        Asciidoctor asciidoctor = createJRubyAsciidoctorInstance(env);
        registerExtensions(asciidoctor);

        return asciidoctor;
    }
View Full Code Here

    public static Asciidoctor create(String gemPath) {
        Map<String, Object> env = new HashMap<String, Object>();
        // a null value will clear the GEM_PATH and GEM_HOME
        env.put(GEM_PATH, gemPath);

        Asciidoctor asciidoctor = createJRubyAsciidoctorInstance(env);
        registerExtensions(asciidoctor);

        return asciidoctor;
    }
View Full Code Here

        return asciidoctor;
    }

    public static Asciidoctor create(List<String> loadPaths) {
        Asciidoctor asciidoctor = createJRubyAsciidoctorInstance(loadPaths);
        registerExtensions(asciidoctor);

        return asciidoctor;
    }
View Full Code Here

        return asciidoctor;
    }

    public static Asciidoctor create(ClassLoader classloader) {
        Asciidoctor asciidoctor = createJRubyAsciidoctorInstance(classloader);
        registerExtensions(asciidoctor);

        return asciidoctor;
    }
View Full Code Here

    @Ignore("Test is ignored because currently it is not possible to register two block extensions in same instance. This may require deep changes on Asciidoctor Extensions API")
    @Test
    public void extensions_should_be_correctly_added() throws IOException {

       
        Asciidoctor asciidoctor = JRubyAsciidoctor.create();
       
        //To avoid registering the same extension over and over for all tests, service is instantiated manually.
        new ArrowsAndBoxesExtension().register(asciidoctor);
       
        Options options = options().inPlace(false)
                .toFile(new File(testFolder.getRoot(), "rendersample.html"))
                .safe(SafeMode.UNSAFE).get();

        asciidoctor.renderFile(new File(
                "target/test-classes/arrows-and-boxes-example.ad"), options);

        File renderedFile = new File(testFolder.getRoot(), "rendersample.html");
        Document doc = Jsoup.parse(renderedFile, "UTF-8");
       
View Full Code Here

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        ensureOutputExists();

        final Asciidoctor asciidoctorInstance = getAsciidoctorInstance(gemPath);

        if (requires.size() > 0) {
            for (String require : requires) {
                // FIXME AsciidoctorJ should provide a public API for requiring paths in the Ruby runtime
                RubyUtils.requireLibrary(JRubyRuntimeContext.get(), require);
View Full Code Here

            throw new MojoExecutionException("Unable to locate output directory", e);
        }
    }

    protected Asciidoctor getAsciidoctorInstance(String gemPath) throws MojoExecutionException {
        Asciidoctor asciidoctor = null;
        if (gemPath == null) {
             asciidoctor = Asciidoctor.Factory.create();
        }
        else {
            // Replace Windows path separator to avoid paths with mixed \ and /.
View Full Code Here

        return engine;
    }

    @Override
    public void processHeader(final ParserContext context) {
        final Asciidoctor asciidoctor = getEngine();
        DocumentHeader header = asciidoctor.readDocumentHeader(context.getFile());
        Map<String, Object> contents = context.getContents();
        if (header.getDocumentTitle() != null) {
            contents.put("title", header.getDocumentTitle().getMain());
        }
        Map<String, Object> attributes = header.getAttributes();
View Full Code Here

TOP

Related Classes of org.asciidoctor.Asciidoctor$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.