Class AsciiDocModel

java.lang.Object
pro.verron.asciidoc.core.AsciiDocModel

public final class AsciiDocModel extends Object

Represents a minimal in-memory model of an AsciiDoc document.

This model intentionally supports a compact subset sufficient for rendering to WordprocessingML and JavaFX Scene:

  • Headings (levels 1..6) using leading = markers
  • Paragraphs separated by blank lines
  • Inline emphasis for bold and italic using AsciiDoc-like markers: *bold*, _italic_
  • Method Details

    • of

      public static AsciiDocModel of(List<Block> blocks)
      Creates a new AsciiDocModel from the provided blocks.
      Parameters:
      blocks - ordered content blocks
      Returns:
      immutable AsciiDocModel
    • of

      public static AsciiDocModel of(Map<String,String> attributes, List<Block> blocks)
      Creates a new AsciiDocModel from the provided attributes and blocks.
      Parameters:
      attributes - document attributes
      blocks - ordered content blocks
      Returns:
      immutable AsciiDocModel
    • of

      public static AsciiDocModel of(Map<String,String> attributes, Block... blocks)
      Creates a new AsciiDocModel from the provided attributes and varargs blocks.
      Parameters:
      attributes - document attributes
      blocks - ordered content blocks
      Returns:
      immutable AsciiDocModel
    • of

      public static AsciiDocModel of(Block... blocks)
      Creates a new AsciiDocModel from the provided varargs blocks.
      Parameters:
      blocks - ordered content blocks
      Returns:
      immutable AsciiDocModel
    • getBlocks

      public List<Block> getBlocks()
      Returns the ordered list of blocks comprising the document.
      Returns:
      immutable list of blocks
    • getAttributes

      public Map<String,String> getAttributes()
      Returns the document attributes.
      Returns:
      immutable map of attributes
    • getAttribute

      public Optional<String> getAttribute(String name)
      Returns the document attribute by name.
      Parameters:
      name - attribute name
      Returns:
      the attribute value wrapped in Optional, or Optional.empty()