Class | Asciidoctor::AbstractBlock |
In: |
lib/asciidoctor/abstract_block.rb
|
Parent: | AbstractNode |
blocks | [R] | Public: Get the Array of Asciidoctor::AbstractBlock sub-blocks for this block |
caption | [RW] | Public: Get/Set the caption for this block |
level | [RW] | Public: Set the Integer level of this Section or the Section level in which this Block resides |
title | [W] | Public: Set the String block title. |
Public: Append a content block to this block‘s list of blocks.
block - The new child block.
Examples
block = Block.new(parent, :preamble) block << Block.new(block, :paragraph, 'p1') block << Block.new(block, :paragraph, 'p2') block.blocks # => ["p1", "p2"]
Returns nothing.
Public: Get the element at i in the array of blocks.
i - The Integer array index number.
section = Section.new section << 'foo' section << 'bar' section[1] => "bar"
Public: Generate a caption and assign it to this block if one is not already assigned.
If the block has a title and a caption prefix is available for this block, then build a caption from this information, assign it a number and store it to the caption attribute on the block.
If an explicit caption has been specified on this block, then do nothing.
key - The prefix of the caption and counter attribute names.
If not provided, the name of the context for this block is used. (default: nil).
returns nothing
Internal: Assign the next index (0-based) to this section
Assign the next index of this section within the parent Block (in document order)
returns nothing
Public: Clear this Block‘s list of blocks.
section = Section.new section << 'foo' section << 'bar' section.blocks => ["foo", "bar"] section.clear_blocks section.blocks => []
Public: Delete the element at i in the array of section blocks, returning that element or nil if i is out of range.
i - The Integer array index number.
section = Section.new section << 'foo' section << 'bar' section.delete_at(1) => "bar" section.blocks => ["foo"]
Public: Insert a content block at the specified index in this block‘s list of blocks.
i - The Integer array index number. val = The content block to insert.
section = Section.new section << 'foo' section << 'baz' section.insert(1, 'bar') section.blocks ["foo", "bar", "baz"]
Public: Get the Array of child Section objects
Only applies to Document and Section instances
Examples
section = Section.new(parent) section << Block.new(section, :paragraph, 'paragraph 1') section << Section.new(parent) section << Block.new(section, :paragraph, 'paragraph 2') section.sections.size # => 1
returns an Array of Section objects
Public: Get the Integer number of blocks in this block
Examples
section = Section.new section.size => 0 section << 'foo' section << 'bar' section.size => 2
Public: Get the String title of this Block with title substitions applied
The following substitutions are applied to block and section titles:
:specialcharacters, :quotes, :replacements, :macros, :attributes and :post_replacements
Examples
block.title = "Foo 3^ # {two-colons} Bar(1)" block.title => "Foo 3^ # :: Bar(1)"