Class Block

java.lang.Object
com.github.rjeschke.txtmark.Block

class Block extends Object
This class represents a block of lines.
  • Field Details

    • type

      public BlockType type
      This block's type.
    • lines

      public Line lines
      Head and tail of linked lines.
    • lineTail

      public Line lineTail
      Head and tail of linked lines.
    • blocks

      public Block blocks
      Head and tail of child blocks.
    • blockTail

      public Block blockTail
      Head and tail of child blocks.
    • next

      public Block next
      Next block.
    • hlDepth

      public int hlDepth
      Depth of headline BlockType.
    • id

      public String id
      ID for headlines and list items
    • meta

      public String meta
      Block meta information
  • Constructor Details

    • Block

      public Block()
      Constructor.
  • Method Details

    • hasLines

      public boolean hasLines()
      Returns:
      true if this block contains lines.
    • removeSurroundingEmptyLines

      public void removeSurroundingEmptyLines()
      Removes leading and trailing empty lines.
    • transfromHeadline

      public void transfromHeadline()
      Sets hlDepth and takes care of '#' chars.
    • removeListIndent

      public void removeListIndent(Configuration configuration)
      Used for nested lists. Removes list markers and up to 4 leading spaces.
      Parameters:
      configuration - txtmark configuration
    • removeBlockQuotePrefix

      public void removeBlockQuotePrefix()
      Used for nested block quotes. Removes '>' char.
    • removeLeadingEmptyLines

      public boolean removeLeadingEmptyLines()
      Removes leading empty lines.
      Returns:
      true if an empty line was removed.
    • removeTrailingEmptyLines

      public void removeTrailingEmptyLines()
      Removes trailing empty lines.
    • split

      public Block split(Line line)
      Splits this block's lines, creating a new child block having 'line' as it's lineTail.
      Parameters:
      line - The line to split from.
      Returns:
      The newly created Block.
    • removeLine

      public void removeLine(Line line)
      Removes the given line from this block.
      Parameters:
      line - Line to remove.
    • appendLine

      public void appendLine(Line line)
      Appends the given line to this block.
      Parameters:
      line - Line to append.
    • expandListParagraphs

      public void expandListParagraphs()
      Changes all Blocks of type NONE to PARAGRAPH if this Block is a List and any of the ListItems contains a paragraph.