Package com.github.rjeschke.txtmark
Class Block
- java.lang.Object
-
- com.github.rjeschke.txtmark.Block
-
class Block extends java.lang.ObjectThis class represents a block of lines.
-
-
Field Summary
Fields Modifier and Type Field Description BlockblocksHead and tail of child blocks.BlockblockTailHead and tail of child blocks.inthlDepthDepth of headline BlockType.java.lang.StringidID for headlines and list itemsLinelinesHead and tail of linked lines.LinelineTailHead and tail of linked lines.java.lang.StringmetaBlock meta informationBlocknextNext block.BlockTypetypeThis block's type.
-
Constructor Summary
Constructors Constructor Description Block()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendLine(Line line)Appends the given line to this block.voidexpandListParagraphs()Changes all Blocks of typeNONEtoPARAGRAPHif this Block is a List and any of the ListItems contains a paragraph.booleanhasLines()voidremoveBlockQuotePrefix()Used for nested block quotes.booleanremoveLeadingEmptyLines()Removes leading empty lines.voidremoveLine(Line line)Removes the given line from this block.voidremoveListIndent(Configuration configuration)Used for nested lists.voidremoveSurroundingEmptyLines()Removes leading and trailing empty lines.voidremoveTrailingEmptyLines()Removes trailing empty lines.Blocksplit(Line line)Splits this block's lines, creating a new child block having 'line' as it's lineTail.voidtransfromHeadline()SetshlDepthand takes care of '#' chars.
-
-
-
Field Detail
-
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 java.lang.String id
ID for headlines and list items
-
meta
public java.lang.String meta
Block meta information
-
-
Method Detail
-
hasLines
public boolean hasLines()
- Returns:
trueif this block contains lines.
-
removeSurroundingEmptyLines
public void removeSurroundingEmptyLines()
Removes leading and trailing empty lines.
-
transfromHeadline
public void transfromHeadline()
SetshlDepthand 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:
trueif 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 typeNONEtoPARAGRAPHif this Block is a List and any of the ListItems contains a paragraph.
-
-