Class JRubyAsciidoctor

    • Field Detail

      • rubyRuntime

        protected org.jruby.Ruby rubyRuntime
    • Constructor Detail

      • JRubyAsciidoctor

        public JRubyAsciidoctor()
    • Method Detail

      • create

        public static JRubyAsciidoctor create​(java.util.List<java.lang.String> loadPaths)
      • create

        public static JRubyAsciidoctor create​(java.lang.ClassLoader classloader)
      • create

        public static JRubyAsciidoctor create​(java.lang.ClassLoader classloader,
                                              java.lang.String gemPath)
      • create

        public static JRubyAsciidoctor create​(java.util.List<java.lang.String> loadPaths,
                                              java.lang.String gemPath)
      • close

        public void close()
        Specified by:
        close in interface Asciidoctor
        Specified by:
        close in interface java.lang.AutoCloseable
      • getRubyRuntime

        public org.jruby.Ruby getRubyRuntime()
      • requireLibrary

        public void requireLibrary​(java.lang.String... library)
        Description copied from interface: Asciidoctor
        Loads the given Ruby gem(s) by name.
        Specified by:
        requireLibrary in interface Asciidoctor
      • requireLibraries

        public void requireLibraries​(java.util.Collection<java.lang.String> libraries)
        Description copied from interface: Asciidoctor
        Loads the given Ruby gem in requiredLibraries by name.
        Specified by:
        requireLibraries in interface Asciidoctor
      • syntaxHighlighterRegistry

        public SyntaxHighlighterRegistry syntaxHighlighterRegistry()
        Description copied from interface: Asciidoctor
        Creates a registry for registering Java syntax highlighter.

        This API is experimental and might change in an incompatible way in a minor version update!

        Specified by:
        syntaxHighlighterRegistry in interface Asciidoctor
        Returns:
        Converter Registry object.
      • shutdown

        public void shutdown()
        Description copied from interface: Asciidoctor
        This method frees all resources consumed by AsciidoctorJ module. Keep in mind that if this method is called, instance becomes unusable and you should create another instance.
        Specified by:
        shutdown in interface Asciidoctor
      • asciidoctorVersion

        public java.lang.String asciidoctorVersion()
        Description copied from interface: Asciidoctor
        Method that gets the asciidoctor version which is being used..
        Specified by:
        asciidoctorVersion in interface Asciidoctor
        Returns:
        Version number.
      • convert

        public <T> T convert​(java.lang.String content,
                             java.util.Map<java.lang.String,​java.lang.Object> options,
                             java.lang.Class<T> expectedResult)
      • convert

        public java.lang.String convert​(java.lang.String content,
                                        Options options)
        Description copied from interface: Asciidoctor
        Parse the AsciiDoc source input into a Document Document and convert it to the specified backend format.

        Accepts input as String object.

        Specified by:
        convert in interface Asciidoctor
        Parameters:
        content - the AsciiDoc source as String.
        options - options to control processing (default: empty).
        Returns:
        the rendered output String is returned
      • convert

        public <T> T convert​(java.lang.String content,
                             Options options,
                             java.lang.Class<T> expectedResult)
        Description copied from interface: Asciidoctor
        Parse the AsciiDoc source input into a Document Document and convert it to the specified backend format.

        Accepts input as String object.

        Specified by:
        convert in interface Asciidoctor
        Parameters:
        content - the AsciiDoc source as String.
        options - options to control processing (default: empty).
        expectedResult - the expected return type. Usually String for HTML based formats. In this case Asciidoctor.convert(String, Options) is the same. The type must match the one generated by Asciidoctor based on the Options used, or the type returned by a Java converter (AbstractConverter) No coercion is applied.
        Returns:
        the rendered output String is returned
      • convert

        public void convert​(java.io.Reader contentReader,
                            java.io.Writer rendererWriter,
                            Options options)
                     throws java.io.IOException
        Description copied from interface: Asciidoctor
        Parse the document read from reader sending the converted result to writer.
        Specified by:
        convert in interface Asciidoctor
        Parameters:
        contentReader - where asciidoc content is read.
        rendererWriter - where rendered content is written. Writer is flushed, but not closed.
        options - options to control processing (default: empty).
        Throws:
        java.io.IOException - if an error occurs while writing rendered content, this exception is thrown.
      • convertFile

        public <T> T convertFile​(java.io.File file,
                                 java.util.Map<java.lang.String,​java.lang.Object> options,
                                 java.lang.Class<T> expectedResult)
      • convertFile

        public java.lang.String convertFile​(java.io.File file,
                                            Options options)
        Description copied from interface: Asciidoctor
        Parse the AsciiDoc source input into a Document Document and convert it to the specified backend format.

        Accepts input as File.

        If the :in_place option is true, and the input is a File, the output is written to a file adjacent to the input file, having an extension that corresponds to the backend format. Otherwise, if the :to_file option is specified, the file is written to that file. If :to_file is not an absolute path, it is resolved relative to :to_dir, if given, otherwise the Document#base_dir. If the target directory does not exist, it will not be created unless the :mkdirs option is set to true. If the file cannot be written because the target directory does not exist, or because it falls outside of the Document#base_dir in safe mode, an IOError is raised.

        Specified by:
        convertFile in interface Asciidoctor
        Parameters:
        file - an input Asciidoctor file.
        options - options to control processing (default: empty).
        Returns:
        returns nothing if the rendered output String is written to a file.
      • convertFile

        public <T> T convertFile​(java.io.File file,
                                 Options options,
                                 java.lang.Class<T> expectedResult)
        Description copied from interface: Asciidoctor
        Parse the AsciiDoc source input into a Document Document and convert it to the specified backend format.

        Accepts input as File.

        If the :in_place option is true, and the input is a File, the output is written to a file adjacent to the input file, having an extension that corresponds to the backend format. Otherwise, if the :to_file option is specified, the file is written to that file. If :to_file is not an absolute path, it is resolved relative to :to_dir, if given, otherwise the Document#base_dir. If the target directory does not exist, it will not be created unless the :mkdirs option is set to true. If the file cannot be written because the target directory does not exist, or because it falls outside of the Document#base_dir in safe mode, an IOError is raised.

        Specified by:
        convertFile in interface Asciidoctor
        Parameters:
        file - an input Asciidoctor file.
        options - options to control processing (default: empty).
        expectedResult - the expected return type. Usually String for HTML based formats. In this case Asciidoctor.convertFile(File, Options) is the same.
        Returns:
        returns nothing if the rendered output is written to a file.
      • convertDirectory

        public java.lang.String[] convertDirectory​(java.lang.Iterable<java.io.File> directoryWalker,
                                                   Options options)
        Description copied from interface: Asciidoctor
        Convert all AsciiDoc files found in directoryWalker. See AsciiDocDirectoryWalker for reference strategy.
        Specified by:
        convertDirectory in interface Asciidoctor
        Parameters:
        directoryWalker - strategy used to retrieve all files to be rendered.
        options - options to control processing (default: empty).
        Returns:
        returns an array of 0 positions if the rendered output is written to a file.
      • convertFiles

        public java.lang.String[] convertFiles​(java.util.Collection<java.io.File> asciidoctorFiles,
                                               Options options)
        Description copied from interface: Asciidoctor
        Convert all files from a collection.
        Specified by:
        convertFiles in interface Asciidoctor
        Parameters:
        asciidoctorFiles - to be converted.
        options - options to control processing (default: empty).
        Returns:
        returns an array of 0 positions if the rendered output is written to a file.
      • load

        public Document load​(java.lang.String content,
                             Options options)
        Description copied from interface: Asciidoctor
        Loads AsciiDoc content and returns the Document object.
        Specified by:
        load in interface Asciidoctor
        Parameters:
        content - to be parsed.
        options - options to control processing (default: empty).
        Returns:
        Document of given content.
      • loadFile

        public Document loadFile​(java.io.File file,
                                 Options options)
        Description copied from interface: Asciidoctor
        Loads AsciiDoc content from file and returns the Document object.
        Specified by:
        loadFile in interface Asciidoctor
        Parameters:
        file - to be parsed.
        options - options to control processing (default: empty).
        Returns:
        Document of given content.
      • createGroup

        public ExtensionGroup createGroup()
        Description copied from interface: Asciidoctor
        Creates an ExtensionGroup that can be used to register and unregister multiples extensions all at once.
        Specified by:
        createGroup in interface Asciidoctor
        Returns:
        Extension Group instance.
      • createGroup

        public ExtensionGroup createGroup​(java.lang.String groupName)
        Description copied from interface: Asciidoctor
        Creates an ExtensionGroup that can be used to register and unregister multiples extensions all at once.
        Specified by:
        createGroup in interface Asciidoctor
        Parameters:
        groupName - to assign to the ExtensionGroup.
        Returns:
        Extension Group instance.
      • log

        public void log​(LogRecord logRecord)
        Description copied from interface: LogHandler
        Process a log record. This method is called during conversion and will abort completely if an exception is thrown from within.
        Specified by:
        log in interface LogHandler