public final class AsciiDoc extends Object
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
static Pattern |
INCLUDE_PATTERN
Regex for finding Include-directives,
where group 1 contains the path-value.
|
Modifier and Type | Method and Description |
---|---|
AsciiDoc |
anchor(String id)
Inserts a cross-reference anchor.
|
AsciiDoc |
anchor(String id,
String xreflabel)
Inserts a cross-reference anchor, with a custom
xreflabel.
|
static AsciiDoc |
asciiDoc()
Creates a new builder instance.
|
AsciiDoc |
blockTitle(String title)
Inserts a block title.
|
AsciiDoc |
boldText(String text)
Inserts bold text.
|
AsciiDoc |
documentTitle(String title)
Inserts a document title.
|
AsciiDoc |
exampleBlock(String content)
Inserts an example-block.
|
AsciiDoc |
horizontalRule()
Inserts a horizontal-rule divider.
|
AsciiDoc |
include(String... path)
Inserts an include-directive, given a relative path to a file.
|
AsciiDoc |
italic(String text)
Inserts italic text.
|
AsciiDoc |
link(String anchorId)
Inserts a cross-reference link.
|
AsciiDoc |
link(String anchorId,
String xreflabel)
Inserts a cross-reference link, with a custom
xreflabel.
|
AsciiDoc |
listContinuation()
Inserts a list-continuation,
for adding complex formatted content to a list.
|
AsciiDoc |
listingBlock(String content)
Inserts a listing-block.
|
AsciiDoc |
listingBlock(String content,
String sourceType)
Inserts a listing-block, with the source-code type (e.g., java, json, etc.) noted for formatting purposes.
|
AsciiDoc |
literalBlock(String content)
Inserts a literal-block.
|
AsciiDoc |
mono(String text)
Inserts monospaced (e.g., code) text.
|
AsciiDoc |
newline()
Inserts a UNIX newline character, where two adjacent newlines will create a new
paragraph.
|
static String |
normalizeName(String... parts)
Normalizes a name such that it can be used as a unique
filename
and/or anchor in AsciiDoc.
|
AsciiDoc |
passthroughBlock(String content)
Inserts a pass-through-block.
|
AsciiDoc |
rawLine(String text)
Inserts raw line (may contain markup), and will insert one newline-characters above and below, if those
newlines do not already exist.
|
AsciiDoc |
rawParagraph(String text)
Inserts raw paragraph (may contain markup), and will insert two newline-characters above and below, if those
newlines do not already exist [ref].
|
AsciiDoc |
rawText(String text)
Inserts raw text (may contain markup or only whitespace).
|
AsciiDoc |
sectionTitle(String title,
int level)
Inserts a section title, at a given level.
|
AsciiDoc |
sectionTitle1(String title)
Inserts a section title, level 1.
|
AsciiDoc |
sectionTitle2(String title)
Inserts a section title, level 2.
|
AsciiDoc |
sectionTitle3(String title)
Inserts a section title, level 3.
|
AsciiDoc |
sectionTitle4(String title)
Inserts a section title, level 4.
|
AsciiDoc |
sectionTitle5(String title)
Inserts a section title, level 5.
|
AsciiDoc |
sidebarBlock(String content)
Inserts a sidebar-block.
|
AsciiDocTable |
tableStart()
Starts a table at the current position.
|
void |
toFile(Path outputDirPath,
String filename)
Saves builder content to a file.
|
String |
toString()
Converts builder content to a
String . |
AsciiDoc |
unorderedList1(String content)
Inserts a line for an unordered list, at level 1 indentation.
|
public static final Pattern INCLUDE_PATTERN
include(String...)
public static AsciiDoc asciiDoc()
public AsciiDoc newline()
public AsciiDoc rawText(String text)
text
- Raw text/markuppublic AsciiDoc rawLine(String text)
text
- Raw text/markuppublic AsciiDoc rawParagraph(String text)
text
- Raw text/markuppublic AsciiDoc boldText(String text)
text
- Text to make boldpublic AsciiDoc italic(String text)
text
- Text to make boldpublic AsciiDoc mono(String text)
text
- Text to make monospacedpublic AsciiDoc documentTitle(String title)
title
- Document titlepublic AsciiDoc blockTitle(String title)
title
- Block titlepublic AsciiDoc sectionTitle(String title, int level)
title
- Section titlelevel
- Section level [1-5]public AsciiDoc sectionTitle1(String title)
title
- Section titlepublic AsciiDoc sectionTitle2(String title)
title
- Section titlepublic AsciiDoc sectionTitle3(String title)
title
- Section titlepublic AsciiDoc sectionTitle4(String title)
title
- Section titlepublic AsciiDoc sectionTitle5(String title)
title
- Section titlepublic AsciiDoc exampleBlock(String content)
content
- Contentpublic AsciiDoc listingBlock(String content)
content
- Contentpublic AsciiDoc listingBlock(String content, String sourceType)
content
- ContentsourceType
- Type of source-code in the listingpublic AsciiDoc literalBlock(String content)
content
- Contentpublic AsciiDoc passthroughBlock(String content)
content
- Contentpublic AsciiDoc sidebarBlock(String content)
content
- Contentpublic AsciiDoc anchor(String id)
id
- Anchor IDpublic AsciiDoc anchor(String id, String xreflabel)
id
- Anchor IDxreflabel
- Custom cross-reference linkpublic AsciiDoc link(String anchorId)
anchorId
- Anchor IDpublic AsciiDoc link(String anchorId, String xreflabel)
anchorId
- Anchor IDxreflabel
- Custom cross-reference linkpublic AsciiDoc unorderedList1(String content)
content
- Line of contentpublic AsciiDoc listContinuation()
public AsciiDoc horizontalRule()
public AsciiDocTable tableStart()
public AsciiDoc include(String... path)
path
- Relative path segmentspublic void toFile(Path outputDirPath, String filename) throws IOException
outputDirPath
- Output directoryfilename
- FilenameIOException
- When error occurs while saving.public String toString()
String
.
public static String normalizeName(String... parts)
parts
- Name-parts to normalizeCopyright 2010-2022 ForgeRock AS.