Class OptionsBuilder


  • public class OptionsBuilder
    extends java.lang.Object
    Fluent Options API for AsciidoctorJ.
    See Also:
    Options
    • Method Detail

      • backend

        public OptionsBuilder backend​(java.lang.String backend)
        Sets backend option.
        Parameters:
        backend - value.
        Returns:
        this instance.
      • docType

        public OptionsBuilder docType​(java.lang.String docType)
        Sets doctype option. Valid options are article, book, manpage and inline. Default article.
        Parameters:
        docType - value.
        Returns:
        this instance.
      • inPlace

        public OptionsBuilder inPlace​(boolean inPlace)
        Sets in place attribute.
        Parameters:
        inPlace - value.
        Returns:
        this instance.
      • standalone

        public OptionsBuilder standalone​(boolean standalone)
        Sets standalone option.
        Parameters:
        standalone - true to generate a standalone output document (which includes the shell around the body content, such as the header and footer). Defaults to true when converting a file only, otherwise is false.
        Returns:
        this instance.
      • templateDirs

        public OptionsBuilder templateDirs​(java.io.File... templateDirs)
        Sets template directories.
        Parameters:
        templateDirs - directories where templates are stored.
        Returns:
        this instance.
      • templateEngine

        public OptionsBuilder templateEngine​(java.lang.String templateEngine)
        Sets the template engine.
        Parameters:
        templateEngine - used to render the document.
        Returns:
        this instance.
      • templateCache

        public OptionsBuilder templateCache​(boolean templateCache)
        Sets if Asciidoctor should use template cache or not.
        Parameters:
        templateCache - true if template cache is required, false otherwise.
        Returns:
        this instance.
      • attributes

        public OptionsBuilder attributes​(Attributes attributes)
        Sets attributes used for rendering input.
        Parameters:
        attributes - map.
        Returns:
        this instance.
      • toFile

        public OptionsBuilder toFile​(boolean toFile)
        Sets to file value. This toggles writing output to a file or returning output as a string. If writing to a string, the header and footer are omitted from the output by default.
        Parameters:
        toFile - true to write output to a file, false to write output to a string.
        Returns:
        this instance.
      • toFile

        public OptionsBuilder toFile​(java.io.File toFile)
        Sets to file value. This is the destination file name.
        Parameters:
        toFile - name of output file.
        Returns:
        this instance.
      • toStream

        public OptionsBuilder toStream​(java.io.OutputStream toStream)
      • toDir

        public OptionsBuilder toDir​(java.io.File directory)
        Sets to dir value. This is the destination directory.
        Parameters:
        directory - where output is generated.
        Returns:
        this instance.
      • mkDirs

        public OptionsBuilder mkDirs​(boolean mkDirs)
        Sets if asciidoctor should create output directory if it does not exist or not.
        Parameters:
        mkDirs - true if directory must be created, false otherwise.
        Returns:
        this instance.
      • safe

        public OptionsBuilder safe​(SafeMode safeMode)
        Sets the safe mode.
        Parameters:
        safeMode - to run asciidoctor.
        Returns:
        this instance.
      • sourcemap

        public OptionsBuilder sourcemap​(boolean sourcemap)
        Keeps track of the file and line number for each parsed block. Useful for tooling applications where the association between the converted output and the source file is important.
        Parameters:
        sourcemap - value.
        Returns:
        this instance.
      • eruby

        public OptionsBuilder eruby​(java.lang.String eruby)
        Sets eruby implementation.
        Parameters:
        eruby - implementation.
        Returns:
        this instance.
      • catalogAssets

        public OptionsBuilder catalogAssets​(boolean catalogAssets)
        If true, tells the parser to capture images and links in the reference table. Normally only IDs, footnotes and indexterms are included. The reference table is available via the references property on the document AST object. (Experimental).
        Parameters:
        catalogAssets - value.
        Returns:
        this instance.
      • compact

        public OptionsBuilder compact​(boolean compact)
        Compact the output removing blank lines.
        Parameters:
        compact - value.
        Returns:
        this instance.
      • parse

        public OptionsBuilder parse​(boolean parse)
        If true, the source is parsed eagerly (i.e., as soon as the source is passed to the load or load_file API). If false, parsing is deferred until the parse method is explicitly invoked.
        Parameters:
        parse - value.
        Returns:
        this instance.
      • parseHeaderOnly

        public OptionsBuilder parseHeaderOnly​(boolean parseHeaderOnly)
        Sets parse header only falg.
        Parameters:
        parseHeaderOnly - value.
        Returns:
        this instance.
      • option

        public OptionsBuilder option​(java.lang.String option,
                                     java.lang.Object value)
        Sets a custom or unlisted option.
        Parameters:
        option - name.
        value - for given option.
        Returns:
        this instance.
      • baseDir

        public OptionsBuilder baseDir​(java.io.File baseDir)
        Sets base dir for working directory.
        Parameters:
        baseDir - working directory.
        Returns:
        this instance.
      • build

        public Options build()
        Returns a valid Options instance.
        Returns:
        options instance.