Class: Asciidoctor::AbstractBlock

Inherits:
AbstractNode show all
Defined in:
lib/asciidoctor/abstract_block.rb

Direct Known Subclasses

Block, Document, List, ListItem, Section, Table, Table::Cell

Constant Summary

Constants included from Substitutors

Substitutors::CAN, Substitutors::CGI, Substitutors::DEL, Substitutors::ESC_R_SB, Substitutors::HighlightedPassSlotRx, Substitutors::PASS_END, Substitutors::PASS_START, Substitutors::PLUS, Substitutors::PassSlotRx, Substitutors::QuotedTextSniffRx, Substitutors::RS, Substitutors::R_SB, Substitutors::SUB_GROUPS, Substitutors::SUB_HINTS, Substitutors::SUB_OPTIONS, Substitutors::SpecialCharsRx, Substitutors::SpecialCharsTr

Instance Attribute Summary collapse

Attributes inherited from AbstractNode

#attributes, #context, #document, #id, #node_name, #parent

Instance Method Summary collapse

Methods inherited from AbstractNode

#add_role, #attr, #attr?, #converter, #enabled_options, #generate_data_uri, #generate_data_uri_from_uri, #has_role?, #icon_uri, #image_uri, #is_uri?, #media_uri, #normalize_asset_path, #normalize_system_path, #normalize_web_path, #option?, #read_asset, #read_contents, #reftext, #reftext?, #remove_attr, #remove_role, #role, #role?, #roles, #set_attr, #set_option, #update_attributes

Methods included from Substitutors

#apply_header_subs, #apply_normal_subs, #apply_reftext_subs, #apply_subs, #expand_subs, #extract_passthroughs, #highlight_source, #resolve_block_subs, #resolve_lines_to_highlight, #resolve_pass_subs, #resolve_subs, #restore_passthroughs, #sub_attributes, #sub_callouts, #sub_macros, #sub_post_replacements, #sub_quotes, #sub_replacements, #sub_source, #sub_specialchars

Methods included from Logging

#logger, #message_with_context

Constructor Details

#initialize(parent, context, opts = {}) ⇒ AbstractBlock

Returns a new instance of AbstractBlock.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/asciidoctor/abstract_block.rb', line 35

def initialize parent, context, opts = {}
  super
  @content_model = :compound
  @blocks = []
  @subs = []
  @id = @title = @caption = @numeral = @style = @default_subs = @source_location = nil
  if context == :document || context == :section
    @level = @next_section_index = 0
    @next_section_ordinal = 1
  elsif AbstractBlock === parent
    @level = parent.level
  else
    @level = nil
  end
end

Instance Attribute Details

#blocks ⇒ Object (readonly)

Get the Array of Asciidoctor::AbstractBlock child blocks for this block. Only applies if content model is :compound.



5
6
7
# File 'lib/asciidoctor/abstract_block.rb', line 5

def blocks
  @blocks
end

#caption ⇒ String

Gets the caption for this block.

This method routes the deprecated use of the caption method on an admonition block to the textlabel attribute.

Returns:

  • (String) —

    Returns the String caption for this block (or the value of the textlabel attribute if this is an admonition block).



238
239
240
# File 'lib/asciidoctor/abstract_block.rb', line 238

def caption
  @context == :admonition ? @attributes['textlabel'] : @caption
end

#content_model ⇒ Object

Describes the type of content this block accepts and how it should be converted. Acceptable values are:

  • :compound - this block contains other blocks
  • :simple - this block holds a paragraph of prose that receives normal substitutions
  • :verbatim - this block holds verbatim text (displayed "as is") that receives verbatim substitutions
  • :raw - this block holds unprocessed content passed directly to the output with no sustitutions applied
  • :empty - this block has no content


16
17
18
# File 'lib/asciidoctor/abstract_block.rb', line 16

def content_model
  @content_model
end

#level ⇒ Object

Set the Integer level of this Section or the level of the Section to which this Asciidoctor::AbstractBlock belongs.



19
20
21
# File 'lib/asciidoctor/abstract_block.rb', line 19

def level
  @level
end

#numeral ⇒ Object

Get/Set the String numeral of this block (if section, relative to parent, otherwise absolute). Only assigned to section if automatic section numbering is enabled. Only assigned to formal block (block with title) if corresponding caption attribute is present.



24
25
26
# File 'lib/asciidoctor/abstract_block.rb', line 24

def numeral
  @numeral
end

#source_location ⇒ Object

Gets/Sets the location in the AsciiDoc source where this block begins.



27
28
29
# File 'lib/asciidoctor/abstract_block.rb', line 27

def source_location
  @source_location
end

#style ⇒ Object

Get/Set the String style (block type qualifier) for this block.



30
31
32
# File 'lib/asciidoctor/abstract_block.rb', line 30

def style
  @style
end

#subs ⇒ Object (readonly)

Substitutions to be applied to content in this block.



33
34
35
# File 'lib/asciidoctor/abstract_block.rb', line 33

def subs
  @subs
end

Instance Method Details

#<<(block) ⇒ The Also known as: append

Append a content block to this block's list of blocks.

Examples:

block = Block.new(parent, :preamble, content_model: :compound)
block << Block.new(block, :paragraph, source: 'p1')
block << Block.new(block, :paragraph, source: 'p2')
block.blocks?
# => true
block.blocks.size
# => 2

Parameters:

  • block —

    The new child block.

Returns:

  • (The) —

    parent Block



114
115
116
117
118
# File 'lib/asciidoctor/abstract_block.rb', line 114

def << block
  block.parent = self unless block.parent == self
  @blocks << block
  self
end

#alt ⇒ String

Returns the converted alt text for this block image.

Returns:

  • (String) —

    Returns the String value of the alt attribute with XML special character and replacement substitutions applied.



218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/asciidoctor/abstract_block.rb', line 218

def alt
  if (text = @attributes['alt'])
    if text == @attributes['default-alt']
      sub_specialchars text
    else
      text = sub_specialchars text
      (ReplaceableTextRx.match? text) ? (sub_replacements text) : text
    end
  else
    ''
  end
end

#assign_caption(value, caption_context = @context) ⇒ void

This method returns an undefined value.

Generate and assign caption to block if 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 a caption has already been assigned to this block, do nothing.

The parts of a complete caption are: . This partial caption represents the part the precedes the title.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>value</span> <span class='type'></span> — <div class='inline'><p>The String caption to assign to this block or nil to use document attribute.</p></div> </li> <li> <span class='name'>caption_context</span> <span class='type'></span> <em class="default">(defaults to: <tt>@context</tt>)</em> — <div class='inline'><p>The Symbol context to use when resolving caption-related attributes. If not provided, the name of the context for this block is used. Only certain contexts allow the caption to be looked up. (default: @context)</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 381 382 383 384 385 386 387 388</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 381</span> <span class='kw'>def</span> <span class='id identifier rubyid_assign_caption'>assign_caption</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_caption_context'>caption_context</span> <span class='op'>=</span> <span class='ivar'>@context</span> <span class='kw'>unless</span> <span class='ivar'>@caption</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@title</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='ivar'>@caption</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>||</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>caption</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_attr_name'>attr_name</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor#CAPTION_ATTR_NAMES-constant" title="Asciidoctor::CAPTION_ATTR_NAMES (constant)">CAPTION_ATTR_NAMES</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_caption_context'>caption_context</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr_name'>attr_name</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='ivar'>@caption</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>%(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prefix'>prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@numeral</span> <span class='op'>=</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_increment_and_store_counter'>increment_and_store_counter</span> <span class='tstring'><span class='tstring_beg'>%(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_caption_context'>caption_context</span><span class='embexpr_end'>}</span><span class='tstring_content'>-number</span><span class='tstring_end'>)</span></span><span class='comma'>,</span> <span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>. </span><span class='tstring_end'>)</span></span> <span class='kw'>nil</span> <span class='kw'>end</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="block?-instance_method"> #<strong>block?</strong> ⇒ <tt>Boolean</tt> </h3><script> document.getElementById("block?-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:block%3F">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 51 52 53</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 51</span> <span class='kw'>def</span> <span class='id identifier rubyid_block?'>block?</span> <span class='kw'>true</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="blocks?-instance_method"> #<strong>blocks?</strong> ⇒ <tt>A</tt> </h3><script> document.getElementById("blocks?-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:blocks%3F">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Determine whether this Block contains block content</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>A</tt>)</span> — <div class='inline'><p>Boolean indicating whether this Block has block content</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 126 127 128</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 126</span> <span class='kw'>def</span> <span class='id identifier rubyid_blocks?'>blocks?</span> <span class='ivar'>@blocks</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='kw'>true</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="captioned_title-instance_method"> #<strong>captioned_title</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("captioned_title-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:captioned_title">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Convenience method that returns the interpreted title of the Block with the caption prepended.</p> <p>Concatenates the value of this Block's caption instance variable and the return value of this Block's title method. No space is added between the two values. If the Block does not have a caption, the interpreted title is returned.</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'></span> <div class='inline'><p>the converted String title prefixed with the caption, or just the converted String title if no caption is set</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 252 253 254</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 252</span> <span class='kw'>def</span> <span class='id identifier rubyid_captioned_title'>captioned_title</span> <span class='tstring'><span class='tstring_beg'>%(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@caption</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_title'>title</span><span class='embexpr_end'>}</span><span class='tstring_end'>)</span></span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="content-instance_method"> #<strong>content</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("content-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:content">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the converted result of the child blocks by converting the children appropriate to content model that this block supports.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 83 84 85</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 83</span> <span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span> <span class='ivar'>@blocks</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_convert'>convert</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor#LF-constant" title="Asciidoctor::LF (constant)">LF</a></span></span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="context=-instance_method"> #<strong>context=</strong>(context) ⇒ <tt>Object</tt> </h3><script> document.getElementById("context=-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:context=">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Update the context of this block.</p> <p>This method changes the context of this block. It also updates the node name accordingly.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>context</span> <span class='type'></span> — <div class='inline'><p>the context Symbol context to assign to this block</p></div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'></span> <div class='inline'><p>the new context Symbol assigned to this block</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 94 95 96</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 94</span> <span class='kw'>def</span> <span class='id identifier rubyid_context='>context=</span> <span class='id identifier rubyid_context'>context</span> <span class='ivar'>@node_name</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@context</span> <span class='op'>=</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="convert-instance_method"> #<strong>convert</strong> ⇒ <tt>Object</tt> <span class="aliases">Also known as: <span class="names"><span id='render-instance_method'>render</span></span> </span> </h3><script> document.getElementById("convert-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:convert">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the converted String content for this Block. If the block has child blocks, the content method should cause them to be converted and returned as content that can be included in the parent block's template.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 73 74 75 76</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 73</span> <span class='kw'>def</span> <span class='id identifier rubyid_convert'>convert</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_playback_attributes'>playback_attributes</span> <span class='ivar'>@attributes</span> <span class='id identifier rubyid_converter'>converter</span><span class='period'>.</span><span class='id identifier rubyid_convert'>convert</span> <span class='kw'>self</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="file-instance_method"> #<strong>file</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("file-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:file">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the source file where this block started</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 60 61 62</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 60</span> <span class='kw'>def</span> <span class='id identifier rubyid_file'>file</span> <span class='ivar'>@source_location</span> <span class='op'>&&</span> <span class='ivar'>@source_location</span><span class='period'>.</span><span class='id identifier rubyid_file'>file</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="find_by-instance_method"> #<strong>find_by</strong>(selector = {}, &block) ⇒ <tt>An</tt> <span class="aliases">Also known as: <span class="names"><span id='query-instance_method'>query</span></span> </span> </h3><script> document.getElementById("find_by-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:find_by">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Walk the document tree and find all block-level nodes that match the specified selector (context, style, id, role, and/or custom filter).</p> <p>If a Ruby block is given, it's applied as a supplemental filter. If the filter returns true (which implies :accept), the node is accepted and node traversal continues. If the filter returns false (which implies :skip), the node is skipped, but its children are still visited. If the filter returns :reject, the node and all its descendants are rejected. If the filter returns :prune, the node is accepted, but its descendants are rejected. If no selector or filter block is supplied, all block-level nodes in the tree are returned.</p> </div> </div> <div class="tags"> <div class="examples"> <h4 class="tag_title">Examples:</h4> <pre class="example code"><code><span class='id identifier rubyid_doc'>doc</span><span class='period'>.</span><span class='id identifier rubyid_find_by'>find_by</span> <span class='label'>context:</span> <span class='symbol'>:section</span> <span class='comment'>#=> Asciidoctor::Section@14459860 { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } </span><span class='comment'>#=> Asciidoctor::Section@14505460 { level: 1, title: "First Section", blocks: 1 }</span></code></pre> <pre class="example code"><code><span class='id identifier rubyid_doc'>doc</span><span class='period'>.</span><span class='id identifier rubyid_find_by'>find_by</span><span class='lparen'>(</span><span class='label'>context:</span> <span class='symbol'>:section</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_section'>section</span><span class='op'>|</span> <span class='id identifier rubyid_section'>section</span><span class='period'>.</span><span class='id identifier rubyid_level'>level</span> <span class='op'>==</span> <span class='int'>1</span> <span class='rbrace'>}</span> <span class='comment'>#=> Asciidoctor::Section@14505460 { level: 1, title: "First Section", blocks: 1 }</span></code></pre> <pre class="example code"><code><span class='id identifier rubyid_doc'>doc</span><span class='period'>.</span><span class='id identifier rubyid_find_by'>find_by</span> <span class='label'>context:</span> <span class='symbol'>:listing</span><span class='comma'>,</span> <span class='label'>style:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>source</span><span class='tstring_end'>'</span></span> <span class='comment'>#=> Asciidoctor::Block@13136720 { context: :listing, content_model: :verbatim, style: "source", lines: 1 }</span></code></pre> </div> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>An</tt>)</span> — <div class='inline'><p>Array of block-level nodes that match the filter or an empty Array if no matches are found -- TODO support jQuery-style selector (e.g., image.thumb)</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 168 169 170 171 172</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 168</span> <span class='kw'>def</span> <span class='id identifier rubyid_find_by'>find_by</span> <span class='id identifier rubyid_selector'>selector</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span> <span class='id identifier rubyid_find_by_internal'>find_by_internal</span> <span class='id identifier rubyid_selector'>selector</span><span class='comma'>,</span> <span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span> <span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>StopIteration</span> <span class='id identifier rubyid_result'>result</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="inline?-instance_method"> #<strong>inline?</strong> ⇒ <tt>Boolean</tt> </h3><script> document.getElementById("inline?-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:inline%3F">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 55 56 57</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 55</span> <span class='kw'>def</span> <span class='id identifier rubyid_inline?'>inline?</span> <span class='kw'>false</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="lineno-instance_method"> #<strong>lineno</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("lineno-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:lineno">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the source line number where this block started</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 65 66 67</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 65</span> <span class='kw'>def</span> <span class='id identifier rubyid_lineno'>lineno</span> <span class='ivar'>@source_location</span> <span class='op'>&&</span> <span class='ivar'>@source_location</span><span class='period'>.</span><span class='id identifier rubyid_lineno'>lineno</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="list_marker_keyword-instance_method"> #<strong>list_marker_keyword</strong>(list_type = nil) ⇒ <tt><span class='object_link'><a href="/gems/asciidoctor/2.0.9/String" title="String (class)">String</a></span></tt> </h3><script> document.getElementById("list_marker_keyword-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:list_marker_keyword">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Retrieve the list marker keyword for the specified list type.</p> <p>For use in the HTML type attribute.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>list_type</span> <span class='type'></span> <em class="default">(defaults to: <tt>nil</tt>)</em> — <div class='inline'><p>the type of list; default to the @style if not specified</p></div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="/gems/asciidoctor/2.0.9/String" title="String (class)">String</a></span></tt>)</span> — <div class='inline'><p>Returns the single-character String keyword that represents the marker for the specified list type</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 263 264 265</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 263</span> <span class='kw'>def</span> <span class='id identifier rubyid_list_marker_keyword'>list_marker_keyword</span> <span class='id identifier rubyid_list_type'>list_type</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor#ORDERED_LIST_KEYWORDS-constant" title="Asciidoctor::ORDERED_LIST_KEYWORDS (constant)">ORDERED_LIST_KEYWORDS</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_list_type'>list_type</span> <span class='op'>||</span> <span class='ivar'>@style</span><span class='rbracket'>]</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="next_adjacent_block-instance_method"> #<strong>next_adjacent_block</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("next_adjacent_block-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:next_adjacent_block">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Move to the next adjacent block in document order. If the current block is the last item in a list, this method will return the following sibling of the list block.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 178 179 180 181 182 183 184 185 186</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 178</span> <span class='kw'>def</span> <span class='id identifier rubyid_next_adjacent_block'>next_adjacent_block</span> <span class='kw'>unless</span> <span class='ivar'>@context</span> <span class='op'>==</span> <span class='symbol'>:document</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span> <span class='op'>=</span> <span class='ivar'>@parent</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_context'>context</span> <span class='op'>==</span> <span class='symbol'>:dlist</span> <span class='op'>&&</span> <span class='ivar'>@context</span> <span class='op'>==</span> <span class='symbol'>:list_item</span> <span class='lparen'>(</span><span class='id identifier rubyid_sib'>sib</span> <span class='op'>=</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='lbracket'>[</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_terms'>terms</span><span class='comma'>,</span> <span class='id identifier rubyid_desc'>desc</span><span class='op'>|</span> <span class='lparen'>(</span><span class='id identifier rubyid_terms'>terms</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_desc'>desc</span> <span class='op'>==</span> <span class='kw'>self</span> <span class='rbrace'>}</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_sib'>sib</span> <span class='op'>:</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_next_adjacent_block'>next_adjacent_block</span> <span class='kw'>else</span> <span class='lparen'>(</span><span class='id identifier rubyid_sib'>sib</span> <span class='op'>=</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_blocks'>blocks</span><span class='lbracket'>[</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_blocks'>blocks</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_sib'>sib</span> <span class='op'>:</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_next_adjacent_block'>next_adjacent_block</span> <span class='kw'>end</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="number-instance_method"> #<strong>number</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("number-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:number">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <div class="note deprecated"><strong>Deprecated.</strong> <div class='inline'><p>Do not use this in new code, and replace it when updating old code.</p></div></div> <p>Legacy property to get the String or Integer numeral of this section.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 140 141 142</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 140</span> <span class='kw'>def</span> <span class='id identifier rubyid_number'>number</span> <span class='lparen'>(</span><span class='const'>Integer</span> <span class='ivar'>@numeral</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='ivar'>@numeral</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="remove_sub-instance_method"> #<strong>remove_sub</strong>(sub) ⇒ <tt>void</tt> </h3><script> document.getElementById("remove_sub-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:remove_sub">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p class="note returns_void">This method returns an undefined value.</p><p>Remove a substitution from this block</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>sub</span> <span class='type'></span> — <div class='inline'><p>The Symbol substitution name</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 316 317 318 319</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 316</span> <span class='kw'>def</span> <span class='id identifier rubyid_remove_sub'>remove_sub</span> <span class='id identifier rubyid_sub'>sub</span> <span class='ivar'>@subs</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_sub'>sub</span> <span class='kw'>nil</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="sections-instance_method"> #<strong>sections</strong> ⇒ <tt><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Array" title="Array (class)">Array</a></span></tt> </h3><script> document.getElementById("sections-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:sections">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the Array of child Section objects</p> <p>Only applies to Document and Section instances</p> </div> </div> <div class="tags"> <div class="examples"> <h4 class="tag_title">Examples:</h4> <pre class="example code"><code><span class='id identifier rubyid_doc'>doc</span> <span class='op'><<</span> <span class='lparen'>(</span><span class='id identifier rubyid_sect1'>sect1</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Section" title="Asciidoctor::Section (class)">Section</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Section#initialize-instance_method" title="Asciidoctor::Section#initialize (method)">new</a></span></span> <span class='id identifier rubyid_doc'>doc</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> <span class='id identifier rubyid_sect1'>sect1</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Section 1</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_para1'>para1</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Block" title="Asciidoctor::Block (class)">Block</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Block#initialize-instance_method" title="Asciidoctor::Block#initialize (method)">new</a></span></span> <span class='id identifier rubyid_sect1'>sect1</span><span class='comma'>,</span> <span class='symbol'>:paragraph</span><span class='comma'>,</span> <span class='label'>source:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Paragraph 1</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_para2'>para2</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Block" title="Asciidoctor::Block (class)">Block</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Block#initialize-instance_method" title="Asciidoctor::Block#initialize (method)">new</a></span></span> <span class='id identifier rubyid_sect1'>sect1</span><span class='comma'>,</span> <span class='symbol'>:paragraph</span><span class='comma'>,</span> <span class='label'>source:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Paragraph 2</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_sect1'>sect1</span> <span class='op'><<</span> <span class='id identifier rubyid_para1'>para1</span> <span class='op'><<</span> <span class='id identifier rubyid_para2'>para2</span> <span class='id identifier rubyid_sect1'>sect1</span> <span class='op'><<</span> <span class='lparen'>(</span><span class='id identifier rubyid_sect1_1'>sect1_1</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Section" title="Asciidoctor::Section (class)">Section</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Section#initialize-instance_method" title="Asciidoctor::Section#initialize (method)">new</a></span></span> <span class='id identifier rubyid_sect1'>sect1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='id identifier rubyid_sect1_1'>sect1_1</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Section 1.1</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_sect1_1'>sect1_1</span> <span class='op'><<</span> <span class='lparen'>(</span><span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Block" title="Asciidoctor::Block (class)">Block</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Block#initialize-instance_method" title="Asciidoctor::Block#initialize (method)">new</a></span></span> <span class='id identifier rubyid_sect1_1'>sect1_1</span><span class='comma'>,</span> <span class='symbol'>:paragraph</span><span class='comma'>,</span> <span class='label'>source:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Paragraph 3</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='id identifier rubyid_sect1'>sect1</span><span class='period'>.</span><span class='id identifier rubyid_blocks?'>blocks?</span> <span class='comment'># => true </span><span class='id identifier rubyid_sect1'>sect1</span><span class='period'>.</span><span class='id identifier rubyid_blocks'>blocks</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='comment'># => 3 </span><span class='id identifier rubyid_sect1'>sect1</span><span class='period'>.</span><span class='id identifier rubyid_sections'>sections</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='comment'># => 1</span></code></pre> </div> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Array" title="Array (class)">Array</a></span></tt>)</span> — <div class='inline'><p>Returns an Array of Section objects</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 210 211 212</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 210</span> <span class='kw'>def</span> <span class='id identifier rubyid_sections'>sections</span> <span class='ivar'>@blocks</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_block'>block</span><span class='op'>|</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_context'>context</span> <span class='op'>==</span> <span class='symbol'>:section</span> <span class='rbrace'>}</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="sections?-instance_method"> #<strong>sections?</strong> ⇒ <tt>Boolean</tt> </h3><script> document.getElementById("sections?-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:sections%3F">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Check whether this block has any child Section objects.</p> <p>Only applies to Document and Section instances</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> — <div class='inline'><p>Returns A Boolean to indicate whether this block has child Section objects</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 135 136 137</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 135</span> <span class='kw'>def</span> <span class='id identifier rubyid_sections?'>sections?</span> <span class='ivar'>@next_section_index</span> <span class='op'>></span> <span class='int'>0</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="sub?-instance_method"> #<strong>sub?</strong>(name) ⇒ <tt>A</tt> </h3><script> document.getElementById("sub?-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:sub%3F">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>A convenience method that checks whether the specified substitution is enabled for this block.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>name</span> <span class='type'></span> — <div class='inline'><p>The Symbol substitution name</p></div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>A</tt>)</span> — <div class='inline'><p>Boolean indicating whether the specified substitution is enabled for this block</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 307 308 309</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 307</span> <span class='kw'>def</span> <span class='id identifier rubyid_sub?'>sub?</span> <span class='id identifier rubyid_name'>name</span> <span class='ivar'>@subs</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_name'>name</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="title-instance_method"> #<strong>title</strong> ⇒ <tt>Object</tt> </h3><script> document.getElementById("title-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:title">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the String title of this Block with title substitions applied</p> <p>The following substitutions are applied to block and section titles:</p> <p>:specialcharacters, :quotes, :replacements, :macros, :attributes and :post_replacements</p> </div> </div> <div class="tags"> <div class="examples"> <h4 class="tag_title">Examples:</h4> <pre class="example code"><code>block.title = "Foo 3^ # {two-colons} Bar(1)" block.title => "Foo 3^ # :: Bar(1)"</code></pre> </div> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'></span> <div class='inline'><p>the converted String title for this Block, or nil if the source title is falsy</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 280 281 282 283</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 280</span> <span class='kw'>def</span> <span class='id identifier rubyid_title'>title</span> <span class='comment'># prevent substitutions from being applied to title multiple times </span> <span class='ivar'>@converted_title</span> <span class='op'>||=</span> <span class='ivar'>@title</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_apply_title_subs'>apply_title_subs</span> <span class='ivar'>@title</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="title=-instance_method"> #<strong>title=</strong>(val) ⇒ <tt>Object</tt> </h3><script> document.getElementById("title=-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:title=">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Set the String block title.</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'></span> <div class='inline'><p>the new String title assigned to this Block</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 295 296 297 298</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 295</span> <span class='kw'>def</span> <span class='id identifier rubyid_title='>title=</span> <span class='id identifier rubyid_val'>val</span> <span class='ivar'>@converted_title</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="title?-instance_method"> #<strong>title?</strong> ⇒ <tt>Boolean</tt> </h3><script> document.getElementById("title?-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:title%3F">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>A convenience method that checks whether the title of this block is defined.</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> — <div class='inline'><p>Returns a Boolean indicating whether this block has a title.</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 288 289 290</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 288</span> <span class='kw'>def</span> <span class='id identifier rubyid_title?'>title?</span> <span class='ivar'>@title</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="xreftext-instance_method"> #<strong>xreftext</strong>(xrefstyle = nil) ⇒ <tt><span class='object_link'><a href="/gems/asciidoctor/2.0.9/String" title="String (class)">String</a></span></tt> </h3><script> document.getElementById("xreftext-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.9/Asciidoctor%2FAbstractBlock:xreftext">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Generate cross reference text (xreftext) that can be used to refer to this block.</p> <p>Use the explicit reftext for this block, if specified, retrieved from the <span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/AbstractNode#reftext-instance_method" title="Asciidoctor::AbstractNode#reftext (method)">Asciidoctor::AbstractNode#reftext</a></span> method. Otherwise, if this is a section or captioned block (a block with both a title and caption), generate the xreftext according to the value of the xrefstyle argument (e.g., full, short). This logic may leverage the <span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor/Substitutors#sub_quotes-instance_method" title="Asciidoctor::Substitutors#sub_quotes (method)">Substitutors#sub_quotes</a></span> method to apply formatting to the text. If this is not a captioned block, return the title, if present, or nil otherwise.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>xrefstyle</span> <span class='type'></span> <em class="default">(defaults to: <tt>nil</tt>)</em> — <div class='inline'><p>An optional String that specifies the style to use to format the xreftext ('full', 'short', or 'basic') (default: nil).</p></div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="/gems/asciidoctor/2.0.9/String" title="String (class)">String</a></span></tt>)</span> — <div class='inline'><p>Returns the generated String xreftext used to refer to this block or nothing if there isn't sufficient information to generate one.</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 337</span> <span class='kw'>def</span> <span class='id identifier rubyid_xreftext'>xreftext</span> <span class='id identifier rubyid_xrefstyle'>xrefstyle</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='id identifier rubyid_reftext'>reftext</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='id identifier rubyid_val'>val</span> <span class='comment'># NOTE xrefstyle only applies to blocks with a title and a caption or number </span> <span class='kw'>elsif</span> <span class='id identifier rubyid_xrefstyle'>xrefstyle</span> <span class='op'>&&</span> <span class='ivar'>@title</span> <span class='op'>&&</span> <span class='ivar'>@caption</span> <span class='kw'>case</span> <span class='id identifier rubyid_xrefstyle'>xrefstyle</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>full</span><span class='tstring_end'>'</span></span> <span class='id identifier rubyid_quoted_title'>quoted_title</span> <span class='op'>=</span> <span class='id identifier rubyid_sub_placeholder'>sub_placeholder</span> <span class='lparen'>(</span><span class='id identifier rubyid_sub_quotes'>sub_quotes</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_compat_mode'>compat_mode</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>%q(</span><span class='tstring_content'>``%s''</span><span class='tstring_end'>)</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>"`%s`"</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_title'>title</span> <span class='kw'>if</span> <span class='ivar'>@numeral</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_caption_attr_name'>caption_attr_name</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor#CAPTION_ATTR_NAMES-constant" title="Asciidoctor::CAPTION_ATTR_NAMES (constant)">CAPTION_ATTR_NAMES</a></span></span><span class='lbracket'>[</span><span class='ivar'>@context</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_caption_attr_name'>caption_attr_name</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='tstring'><span class='tstring_beg'>%(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prefix'>prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@numeral</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_quoted_title'>quoted_title</span><span class='embexpr_end'>}</span><span class='tstring_end'>)</span></span> <span class='kw'>else</span> <span class='tstring'><span class='tstring_beg'>%(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@caption</span><span class='period'>.</span><span class='id identifier rubyid_chomp'>chomp</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>. </span><span class='tstring_end'>'</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_quoted_title'>quoted_title</span><span class='embexpr_end'>}</span><span class='tstring_end'>)</span></span> <span class='kw'>end</span> <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>short</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='ivar'>@numeral</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_caption_attr_name'>caption_attr_name</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="/gems/asciidoctor/2.0.9/Asciidoctor#CAPTION_ATTR_NAMES-constant" title="Asciidoctor::CAPTION_ATTR_NAMES (constant)">CAPTION_ATTR_NAMES</a></span></span><span class='lbracket'>[</span><span class='ivar'>@context</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='ivar'>@document</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_caption_attr_name'>caption_attr_name</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='tstring'><span class='tstring_beg'>%(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_prefix'>prefix</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@numeral</span><span class='embexpr_end'>}</span><span class='tstring_end'>)</span></span> <span class='kw'>else</span> <span class='ivar'>@caption</span><span class='period'>.</span><span class='id identifier rubyid_chomp'>chomp</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>. </span><span class='tstring_end'>'</span></span> <span class='kw'>end</span> <span class='kw'>else</span> <span class='comment'># 'basic' </span> <span class='id identifier rubyid_title'>title</span> <span class='kw'>end</span> <span class='kw'>else</span> <span class='id identifier rubyid_title'>title</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Thu Oct 1 11:10:38 2026 by <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.45 (ruby-4.0.7). </div> </div> </body> </html>