Class JRubyProcessor
- java.lang.Object
-
- org.asciidoctor.jruby.extension.internal.JRubyProcessor
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>configstatic java.lang.StringCONTENT_MODEL_EMPTY
-
Constructor Summary
Constructors Constructor Description JRubyProcessor()JRubyProcessor(java.util.Map<java.lang.String,java.lang.Object> config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockcreateBlock(StructuralNode parent, java.lang.String context, java.lang.String content)BlockcreateBlock(StructuralNode parent, java.lang.String context, java.lang.String content, java.util.Map<java.lang.String,java.lang.Object> attributes)BlockcreateBlock(StructuralNode parent, java.lang.String context, java.lang.String content, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)BlockcreateBlock(StructuralNode parent, java.lang.String context, java.util.List<java.lang.String> content)BlockcreateBlock(StructuralNode parent, java.lang.String context, java.util.List<java.lang.String> content, java.util.Map<java.lang.String,java.lang.Object> attributes)BlockcreateBlock(StructuralNode parent, java.lang.String context, java.util.List<java.lang.String> content, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)BlockcreateBlock(StructuralNode parent, java.lang.String context, java.util.Map<java.lang.Object,java.lang.Object> options)DocumentcreateDocument(Document parentDocument)Creates an inner document for the given parent document.ListcreateList(StructuralNode parent, java.lang.String context)Creates a new List.ListcreateList(StructuralNode parent, java.lang.String context, java.util.Map<java.lang.Object,java.lang.Object> options)Creates a new List.ListcreateList(StructuralNode parent, java.lang.String context, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)Creates a new List.ListItemcreateListItem(DescriptionList parent, java.lang.String text)ListItemcreateListItem(List parent, java.lang.String text)PhraseNodecreatePhraseNode(ContentNode parent, java.lang.String context, java.lang.String text)PhraseNodecreatePhraseNode(ContentNode parent, java.lang.String context, java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> attributes)PhraseNodecreatePhraseNode(ContentNode parent, java.lang.String context, java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.String,java.lang.Object> options)PhraseNodecreatePhraseNode(ContentNode parent, java.lang.String context, java.util.List<java.lang.String> text)PhraseNodecreatePhraseNode(ContentNode parent, java.lang.String context, java.util.List<java.lang.String> text, java.util.Map<java.lang.String,java.lang.Object> attributes)PhraseNodecreatePhraseNode(ContentNode parent, java.lang.String context, java.util.List<java.lang.String> text, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)SectioncreateSection(StructuralNode parent)SectioncreateSection(StructuralNode parent, boolean numbered, java.util.Map<java.lang.Object,java.lang.Object> options)SectioncreateSection(StructuralNode parent, int level, boolean numbered, java.util.Map<java.lang.Object,java.lang.Object> options)SectioncreateSection(StructuralNode parent, java.lang.Integer level, boolean numbered, java.util.Map<java.lang.Object,java.lang.Object> options)SectioncreateSection(StructuralNode parent, java.util.Map<java.lang.Object,java.lang.Object> options)TablecreateTable(StructuralNode parent)TablecreateTable(StructuralNode parent, java.util.Map<java.lang.String,java.lang.Object> attributes)CellcreateTableCell(Column column, java.lang.String text)CellcreateTableCell(Column column, java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> attributes)CellcreateTableCell(Column column, Document innerDocument)CellcreateTableCell(Column column, Document innerDocument, java.util.Map<java.lang.String,java.lang.Object> attributes)ColumncreateTableColumn(Table parent, int index)ColumncreateTableColumn(Table parent, int index, java.util.Map<java.lang.String,java.lang.Object> attributes)RowcreateTableRow(Table parent)JRubyAsciidoctorgetAsciidoctor()java.util.Map<java.lang.String,java.lang.Object>getConfig()voidlog(LogRecord logRecord)voidparseContent(StructuralNode parent, java.util.List<java.lang.String> lines)Parses the given raw asciidoctor content, parses it and appends it as children to the given parent block.voidsetAsciidoctor(JRubyAsciidoctor asciidoctor)voidsetConfig(java.util.Map<java.lang.String,java.lang.Object> config)voidsetConfigFinalized()<T> Tunwrap(java.lang.Class<T> clazz)voidupdateConfig(java.util.Map<java.lang.String,java.lang.Object> config)
-
-
-
Field Detail
-
CONTENT_MODEL_EMPTY
public static final java.lang.String CONTENT_MODEL_EMPTY
- See Also:
- Constant Field Values
-
config
protected java.util.Map<java.lang.String,java.lang.Object> config
-
-
Method Detail
-
getConfig
public java.util.Map<java.lang.String,java.lang.Object> getConfig()
-
setConfig
public final void setConfig(java.util.Map<java.lang.String,java.lang.Object> config)
-
updateConfig
public final void updateConfig(java.util.Map<java.lang.String,java.lang.Object> config)
- Specified by:
updateConfigin interfaceProcessor
-
setConfigFinalized
public final void setConfigFinalized()
-
createTable
public Table createTable(StructuralNode parent)
- Specified by:
createTablein interfaceProcessor
-
createTable
public Table createTable(StructuralNode parent, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createTablein interfaceProcessor
-
createTableRow
public Row createTableRow(Table parent)
- Specified by:
createTableRowin interfaceProcessor
-
createTableColumn
public Column createTableColumn(Table parent, int index, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createTableColumnin interfaceProcessor
-
createTableCell
public Cell createTableCell(Column column, Document innerDocument, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createTableCellin interfaceProcessor
-
createTableCell
public Cell createTableCell(Column column, java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createTableCellin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.lang.String content, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.util.List<java.lang.String> content, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createBlockin interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, java.lang.String context, java.util.List<java.lang.String> text, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, java.lang.String context, java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.String,java.lang.Object> options)
- Specified by:
createPhraseNodein interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createBlockin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent, java.lang.Integer level, boolean numbered, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createSectionin interfaceProcessor
-
createDocument
public Document createDocument(Document parentDocument)
Creates 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.
-
createList
public List createList(StructuralNode parent, java.lang.String context)
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, java.lang.String context, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.Map<java.lang.Object,java.lang.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
public List createList(StructuralNode parent, java.lang.String context, java.util.Map<java.lang.Object,java.lang.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,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
public ListItem createListItem(List parent, java.lang.String text)
- Specified by:
createListItemin interfaceProcessor
-
createListItem
public ListItem createListItem(DescriptionList parent, java.lang.String text)
- Specified by:
createListItemin interfaceProcessor
-
parseContent
public void parseContent(StructuralNode parent, java.util.List<java.lang.String> lines)
Parses 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
public Column createTableColumn(Table parent, int index)
- Specified by:
createTableColumnin interfaceProcessor
-
createTableCell
public Cell createTableCell(Column column, java.lang.String text)
- Specified by:
createTableCellin interfaceProcessor
-
createTableCell
public Cell createTableCell(Column column, Document innerDocument)
- Specified by:
createTableCellin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.lang.String content)
- Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.lang.String content, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.util.List<java.lang.String> content)
- Specified by:
createBlockin interfaceProcessor
-
createBlock
public Block createBlock(StructuralNode parent, java.lang.String context, java.util.List<java.lang.String> content, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createBlockin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent)
- Specified by:
createSectionin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createSectionin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent, boolean numbered, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createSectionin interfaceProcessor
-
createSection
public Section createSection(StructuralNode parent, int level, boolean numbered, java.util.Map<java.lang.Object,java.lang.Object> options)
- Specified by:
createSectionin interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, java.lang.String context, java.util.List<java.lang.String> text)
- Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, java.lang.String context, java.util.List<java.lang.String> text, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, java.lang.String context, java.lang.String text)
- Specified by:
createPhraseNodein interfaceProcessor
-
createPhraseNode
public PhraseNode createPhraseNode(ContentNode parent, java.lang.String context, java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createPhraseNodein interfaceProcessor
-
getAsciidoctor
public JRubyAsciidoctor getAsciidoctor()
-
setAsciidoctor
public void setAsciidoctor(JRubyAsciidoctor asciidoctor)
-
-