Class | Asciidoctor::Block |
In: |
lib/asciidoctor/block.rb
|
Parent: | AbstractBlock |
Public: Methods for managing blocks of Asciidoc content in a section.
Examples
block = Asciidoctor::Block.new(parent, :paragraph, :source => '_This_ is a <test>') block.content => "<em>This</em> is a <test>"
DEFAULT_CONTENT_MODEL | = | { # TODO should probably fill in all known blocks :audio => :empty, :image => :empty, :listing => :verbatim, :literal => :verbatim, :stem => :raw, :open => :compound, :page_break => :empty, :pass => :raw, :thematic_break => :empty, :video => :empty |
context | -> | blockname |
Public: Create alias for context to be consistent w/ AsciiDoc |
Public: Initialize an Asciidoctor::Block object.
parent - The parent AbstractBlock with a compound content model to which this Block will be appended. context - The Symbol context name for the type of content (e.g., :paragraph). opts - a Hash of options to customize block initialization: (default: {})
* :content_model indicates whether blocks can be nested in this Block (:compound), otherwise how the lines should be processed (:simple, :verbatim, :raw, :empty). (default: :simple) * :attributes a Hash of attributes (key/value pairs) to assign to this Block. (default: {}) * :source a String or Array of raw source for this Block. (default: nil)
IMPORTANT: If you don‘t specify the `:subs` option, you must explicitly call the `lock_in_subs` method to resolve and assign the substitutions to this block (which are resolved from the `subs` attribute, if specified, or the default substitutions based on this block‘s context). If you want to use the default subs for a block, pass the option `:subs => :default`. You can override the default subs using the `:default_subs` option.
Public: Get the converted result of the child blocks by converting the children appropriate to content model that this block supports.
Examples
doc = Asciidoctor::Document.new block = Asciidoctor::Block.new(doc, :paragraph, :source => '_This_ is what happens when you <meet> a stranger in the <alps>!') block.content => "<em>This</em> is what happens when you <meet> a stranger in the <alps>!"