Class AsciiDoc
java.lang.Object
org.forgerock.api.markup.asciidoc.AsciiDoc
Root builder for AsciiDoc markup. All operations may be applied at the current linear position within the
document being built, such that markup that must appear at the top should be added first.
This class is not thread-safe.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionInserts a cross-reference anchor.Inserts a cross-reference anchor, with a custom xreflabel.static AsciiDoc
asciiDoc()
Creates a new builder instance.blockTitle
(String title) Inserts a block title.Inserts bold text.documentTitle
(String title) Inserts a document title.exampleBlock
(String content) Inserts an example-block.Inserts a horizontal-rule divider.Inserts an include-directive, given a relative path to a file.Inserts italic text.Inserts a cross-reference link.Inserts a cross-reference link, with a custom xreflabel.Inserts a list-continuation, for adding complex formatted content to a list.listingBlock
(String content) Inserts a listing-block.listingBlock
(String content, String sourceType) Inserts a listing-block, with the source-code type (e.g., java, json, etc.) noted for formatting purposes.literalBlock
(String content) Inserts a literal-block.Inserts monospaced (e.g., code) text.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.passthroughBlock
(String content) Inserts a pass-through-block.Inserts raw line (may contain markup), and will insert one newline-characters above and below, if those newlines do not already exist.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].Inserts raw text (may contain markup or only whitespace).sectionTitle
(String title, int level) Inserts a section title, at a given level.sectionTitle1
(String title) Inserts a section title, level 1.sectionTitle2
(String title) Inserts a section title, level 2.sectionTitle3
(String title) Inserts a section title, level 3.sectionTitle4
(String title) Inserts a section title, level 4.sectionTitle5
(String title) Inserts a section title, level 5.sidebarBlock
(String content) Inserts a sidebar-block.Starts a table at the current position.void
Saves builder content to a file.toString()
Converts builder content to aString
.unorderedList1
(String content) Inserts a line for an unordered list, at level 1 indentation.
-
Field Details
-
INCLUDE_PATTERN
Regex for finding Include-directives, where group 1 contains the path-value.- See Also:
-
-
Method Details
-
asciiDoc
Creates a new builder instance.- Returns:
- builder
-
newline
Inserts a UNIX newline character, where two adjacent newlines will create a new paragraph. As a best-practice, they suggest one-sentence-per-line style.- Returns:
- builder
-
rawText
Inserts raw text (may contain markup or only whitespace).- Parameters:
text
- Raw text/markup- Returns:
- builder
-
rawLine
Inserts raw line (may contain markup), and will insert one newline-characters above and below, if those newlines do not already exist.- Parameters:
text
- Raw text/markup- Returns:
- builder
-
rawParagraph
Inserts raw paragraph (may contain markup), and will insert two newline-characters above and below, if those newlines do not already exist [ref].- Parameters:
text
- Raw text/markup- Returns:
- builder
-
boldText
Inserts bold text.- Parameters:
text
- Text to make bold- Returns:
- builder
-
italic
Inserts italic text.- Parameters:
text
- Text to make bold- Returns:
- Doc builder
-
mono
Inserts monospaced (e.g., code) text.- Parameters:
text
- Text to make monospaced- Returns:
- Doc builder
-
documentTitle
Inserts a document title.- Parameters:
title
- Document title- Returns:
- Doc builder
-
blockTitle
Inserts a block title.- Parameters:
title
- Block title- Returns:
- Doc builder
-
sectionTitle
Inserts a section title, at a given level.- Parameters:
title
- Section titlelevel
- Section level [1-5]- Returns:
- Doc builder
-
sectionTitle1
Inserts a section title, level 1.- Parameters:
title
- Section title- Returns:
- Doc builder
-
sectionTitle2
Inserts a section title, level 2.- Parameters:
title
- Section title- Returns:
- Doc builder
-
sectionTitle3
Inserts a section title, level 3.- Parameters:
title
- Section title- Returns:
- Doc builder
-
sectionTitle4
Inserts a section title, level 4.- Parameters:
title
- Section title- Returns:
- Doc builder
-
sectionTitle5
Inserts a section title, level 5.- Parameters:
title
- Section title- Returns:
- Doc builder
-
exampleBlock
Inserts an example-block.- Parameters:
content
- Content- Returns:
- Doc builder
-
listingBlock
Inserts a listing-block.- Parameters:
content
- Content- Returns:
- Doc builder
-
listingBlock
Inserts a listing-block, with the source-code type (e.g., java, json, etc.) noted for formatting purposes.- Parameters:
content
- ContentsourceType
- Type of source-code in the listing- Returns:
- Doc builder
-
literalBlock
Inserts a literal-block.- Parameters:
content
- Content- Returns:
- Doc builder
-
passthroughBlock
Inserts a pass-through-block.- Parameters:
content
- Content- Returns:
- Doc builder
-
sidebarBlock
Inserts a sidebar-block.- Parameters:
content
- Content- Returns:
- Doc builder
-
anchor
Inserts a cross-reference anchor.- Parameters:
id
- Anchor ID- Returns:
- Doc builder
-
anchor
Inserts a cross-reference anchor, with a custom xreflabel.- Parameters:
id
- Anchor IDxreflabel
- Custom cross-reference link- Returns:
- Doc builder
-
link
Inserts a cross-reference link.- Parameters:
anchorId
- Anchor ID- Returns:
- Doc builder
-
link
Inserts a cross-reference link, with a custom xreflabel.- Parameters:
anchorId
- Anchor IDxreflabel
- Custom cross-reference link- Returns:
- Doc builder
-
unorderedList1
Inserts a line for an unordered list, at level 1 indentation.- Parameters:
content
- Line of content- Returns:
- Doc builder
-
listContinuation
Inserts a list-continuation, for adding complex formatted content to a list.- Returns:
- Doc builder
-
horizontalRule
Inserts a horizontal-rule divider.- Returns:
- Doc builder
-
tableStart
Starts a table at the current position.- Returns:
- Table builder
-
include
Inserts an include-directive, given a relative path to a file.- Parameters:
path
- Relative path segments- Returns:
- Doc builder
-
toFile
Saves builder content to a file.- Parameters:
outputDirPath
- Output directoryfilename
- Filename- Throws:
IOException
- When error occurs while saving.
-
toString
Converts builder content to aString
. -
normalizeName
Normalizes a name such that it can be used as a unique filename and/or anchor in AsciiDoc. Names are converted to lower-case, unsupported characters are collapsed to a single underscore-character, and parts are separated by an underscore.- Parameters:
parts
- Name-parts to normalize- Returns:
- Normalized name
-