Package org.asciidoctor.extension
Class BaseProcessor
java.lang.Object
org.asciidoctor.extension.BaseProcessor
- All Implemented Interfaces:
Processor
- Direct Known Subclasses:
BlockProcessor,DocinfoProcessor,IncludeProcessor,MacroProcessor,Postprocessor,Preprocessor,Treeprocessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateBlock(StructuralNode parent, String context, String content) createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes) createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes, Map<Object, Object> options) createBlock(StructuralNode parent, String context, List<String> content) createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes) createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes, Map<Object, Object> options) createBlock(StructuralNode parent, String context, Map<Object, Object> options) createDocument(Document parentDocument) Creates an inner document for the given parent document.createList(StructuralNode parent, String context) Creates a new List.createList(StructuralNode parent, String context, Map<Object, Object> options) Creates a new List.createList(StructuralNode parent, String context, Map<String, Object> attributes, Map<Object, Object> options) Creates a new List.createListItem(DescriptionList parent, String text) createListItem(List parent, String text) createPhraseNode(ContentNode parent, String context, String text) createPhraseNode(ContentNode parent, String context, String text, Map<String, Object> attributes) createPhraseNode(ContentNode parent, String context, String text, Map<String, Object> attributes, Map<String, Object> options) createPhraseNode(ContentNode parent, String context, List<String> text) createPhraseNode(ContentNode parent, String context, List<String> text, Map<String, Object> attributes) createPhraseNode(ContentNode parent, String context, List<String> text, Map<String, Object> attributes, Map<Object, Object> options) createSection(StructuralNode parent) createSection(StructuralNode parent, boolean numbered, Map<Object, Object> options) createSection(StructuralNode parent, int level, boolean numbered, Map<Object, Object> options) createSection(StructuralNode parent, Integer level, boolean numbered, Map<Object, Object> options) createSection(StructuralNode parent, Map<Object, Object> options) createTable(StructuralNode parent) createTable(StructuralNode parent, Map<String, Object> attributes) createTableCell(Column column, String text) createTableCell(Column column, Document innerDocument) createTableColumn(Table parent, int index) createTableColumn(Table parent, int index, Map<String, Object> attributes) createTableRow(Table parent) voidvoidparseContent(StructuralNode parent, List<String> lines) Parses the given raw asciidoctor content, parses it and appends it as children to the given parent block.final voidfinal <T> Tfinal voidupdateConfig(Map<String, Object> config)
-
Constructor Details
-
BaseProcessor
public BaseProcessor() -
BaseProcessor
-
-
Method Details
-
getConfig
-
setConfig
-
updateConfig
- Specified by:
updateConfigin interfaceProcessor
-
unwrap
-
log
-
createTable
- Specified by:
createTablein interfaceProcessor
-
createTable
- Specified by:
createTablein interfaceProcessor
-
createTableRow
- Specified by:
createTableRowin interfaceProcessor
-
createTableColumn
- Specified by:
createTableColumnin interfaceProcessor
-
createTableCell
- Specified by:
createTableCellin interfaceProcessor
-
createTableCell
- Specified by:
createTableCellin interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, String context, List<String> text, Map<String, Object> attributes, Map<Object, Object> options) - Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, String context, String text, Map<String, Object> attributes, Map<String, Object> options) - Specified by:
createPhraseNodein interfaceProcessor
-
createBlock
- Specified by:
createBlockin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent, Integer level, boolean numbered, Map<Object, Object> options) - Specified by:
createSectionin interfaceProcessor
-
createDocument
Description copied from interface:ProcessorCreates an inner document for the given parent document. Inner documents are used for tables cells with styleasciidoc.- Specified by:
createDocumentin interfaceProcessor- Parameters:
parentDocument- The parent document of the new document.- Returns:
- A new inner document.
-
createListItem
- Specified by:
createListItemin interfaceProcessor
-
createList
Description copied from interface:ProcessorCreates a new List. This method is experimental and may change in future minor releases until declared to be stable.- Specified by:
createListin interfaceProcessor- Parameters:
parent- The block to which the parsed content should be added as children.context- Either"olist",ulist,colistordlist- Returns:
- A List node that can be added to the AST of a document.
-
createList
public List createList(StructuralNode parent, String context, Map<String, Object> attributes, Map<Object, Object> options) Description copied from interface:ProcessorCreates a new List. This method is experimental and may change in future minor releases until declared to be stable.- Specified by:
createListin interfaceProcessor- Parameters:
parent- The block to which the parsed content should be added as children.context- Either"olist",ulist,colistordlistattributes- Additional attributes to be set on the new list node, e.g.Collections.singletonMap("start", "2").options- Additional options to be set on the new list node.- Returns:
- A List node that can be added to the AST of a document.
-
createList
Description copied from interface:ProcessorCreates a new List. This method is experimental and may change in future minor releases until declared to be stable.- Specified by:
createListin interfaceProcessor- Parameters:
parent- The block to which the parsed content should be added as children.context- Either"olist",ulist,colistordlistoptions- Additional options to be set on the new list node.- Returns:
- A List node that can be added to the AST of a document.
-
createListItem
- Specified by:
createListItemin interfaceProcessor
-
parseContent
Description copied from interface:ProcessorParses the given raw asciidoctor content, parses it and appends it as children to the given parent block.The following example will add two paragraphs with the role
newcontentto all top level sections of a document:Asciidoctor asciidoctor = ... asciidoctor.javaExtensionRegistry().treeprocessor(new Treeprocessor() { DocumentRuby process(DocumentRuby document) { for (AbstractBlock block: document.getBlocks()) { if (block instanceof Section) { parseContent(block, Arrays.asList(new String[]{ "[newcontent]", "This is new content" "", "[newcontent]", "This is also new content"})); } } } }); - Specified by:
parseContentin interfaceProcessor- Parameters:
parent- The block to which the parsed content should be added as children.lines- Raw asciidoctor content
-
createTableColumn
- Specified by:
createTableColumnin interfaceProcessor
-
createTableCell
- Specified by:
createTableCellin interfaceProcessor
-
createTableCell
- Specified by:
createTableCellin interfaceProcessor
-
createBlock
- Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes) - Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes, Map<Object, Object> options) - Specified by:
createBlockin interfaceProcessor
-
createBlock
- Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes) - Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes, Map<Object, Object> options) - Specified by:
createBlockin interfaceProcessor
-
createSection
- Specified by:
createSectionin interfaceProcessor
-
createSection
- Specified by:
createSectionin interfaceProcessor
-
createSection
- Specified by:
createSectionin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent, int level, boolean numbered, Map<Object, Object> options) - Specified by:
createSectionin interfaceProcessor
-
createPhraseNode
- Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, String context, List<String> text, Map<String, Object> attributes) - Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
- Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, String context, String text, Map<String, Object> attributes) - Specified by:
createPhraseNodein interfaceProcessor
-