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=, #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.



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

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

#blocksObject (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

#captionString

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).



246
247
248
# File 'lib/asciidoctor/abstract_block.rb', line 246

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

#content_modelObject

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 substitutions applied
  • :empty - this block has no content


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

def content_model
  @content_model
end

#levelObject

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

#numeralObject

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_locationObject

Gets/Sets the location in the AsciiDoc source where this block begins. Tracking source location is not enabled by default, and is controlled by the sourcemap option.



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

def source_location
  @source_location
end

#styleObject

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



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

def style
  @style
end

#subsObject (readonly)

Substitutions to be applied to content in this block.



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

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



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

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

#altString

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.



226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/asciidoctor/abstract_block.rb', line 226

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"> 389 390 391 392 393 394 395 396</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 389</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_assign_caption identifier id'>assign_caption</span> <span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span> <span class='rubyid_caption_context identifier id'>caption_context</span> <span class='assign token'>=</span> <span class='rubyid_@context ivar id'>@context</span> <span class='rubyid_unless unless kw'>unless</span> <span class='rubyid_@caption ivar id'>@caption</span> <span class='orop op'>||</span> <span class='notop op'>!</span><span class='rubyid_@title ivar id'>@title</span> <span class='orop op'>||</span> <span class='lparen token'>(</span><span class='rubyid_@caption ivar id'>@caption</span> <span class='assign token'>=</span> <span class='rubyid_value identifier id'>value</span> <span class='orop op'>||</span> <span class='rubyid_@document ivar id'>@document</span><span class='dot token'>.</span><span class='rubyid_attributes identifier id'>attributes</span><span class='lbrack token'>[</span><span class='string val'>'caption'</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='rubyid_if if kw'>if</span> <span class='lparen token'>(</span><span class='rubyid_attr_name identifier id'>attr_name</span> <span class='assign token'>=</span> <span class='rubyid_CAPTION_ATTRIBUTE_NAMES constant id'>CAPTION_ATTRIBUTE_NAMES</span><span class='lbrack token'>[</span><span class='rubyid_caption_context identifier id'>caption_context</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='rubyid_prefix identifier id'>prefix</span> <span class='assign token'>=</span> <span class='rubyid_@document ivar id'>@document</span><span class='dot token'>.</span><span class='rubyid_attributes identifier id'>attributes</span><span class='lbrack token'>[</span><span class='rubyid_attr_name identifier id'>attr_name</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='rubyid_@caption ivar id'>@caption</span> <span class='assign token'>=</span> <span class='dstring node'>%(#{prefix} #{@numeral = @document.increment_and_store_counter %(#{caption_context}-number), self}. )</span> <span class='rubyid_nil nil kw'>nil</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_end end 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.22/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"> 52 53 54</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 52</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_block? fid id'>block?</span> <span class='rubyid_true true kw'>true</span> <span class='rubyid_end end 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.22/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"> 127 128 129</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 127</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_blocks? fid id'>blocks?</span> <span class='rubyid_@blocks ivar id'>@blocks</span><span class='dot token'>.</span><span class='rubyid_empty? fid id'>empty?</span> <span class='integer val'>? </span><span class='rubyid_false false kw'>false</span> <span class='colon op'>:</span> <span class='rubyid_true true kw'>true</span> <span class='rubyid_end end 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.22/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"> 260 261 262</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 260</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_captioned_title identifier id'>captioned_title</span> <span class='dstring node'>%(#{@caption}#{title})</span> <span class='rubyid_end end 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.22/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"> 84 85 86</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 84</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_content identifier id'>content</span> <span class='rubyid_@blocks ivar id'>@blocks</span><span class='dot token'>.</span><span class='rubyid_map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_b identifier id'>b</span><span class='bitor op'>|</span> <span class='rubyid_b identifier id'>b</span><span class='dot token'>.</span><span class='rubyid_convert identifier id'>convert</span> <span class='rbrace token'>}</span><span class='dot token'>.</span><span class='rubyid_join identifier id'>join</span> <span class='rubyid_LF constant id'>LF</span> <span class='rubyid_end end 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.22/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 specified Symbol context</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 95 96 97</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 95</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_context= identifier id'>context=</span> <span class='rubyid_context identifier id'>context</span> <span class='rubyid_@node_name ivar id'>@node_name</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_@context ivar id'>@context</span> <span class='assign token'>=</span> <span class='rubyid_context identifier id'>context</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span> <span class='rubyid_end end 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.22/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"> 74 75 76 77</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 74</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_convert identifier id'>convert</span> <span class='rubyid_@document ivar id'>@document</span><span class='dot token'>.</span><span class='rubyid_playback_attributes identifier id'>playback_attributes</span> <span class='rubyid_@attributes ivar id'>@attributes</span> <span class='rubyid_converter identifier id'>converter</span><span class='dot token'>.</span><span class='rubyid_convert identifier id'>convert</span> <span class='rubyid_self self kw'>self</span> <span class='rubyid_end end 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.22/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"> 61 62 63</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 61</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_file identifier id'>file</span> <span class='rubyid_@source_location ivar id'>@source_location</span> <span class='andop op'>&&</span> <span class='rubyid_@source_location ivar id'>@source_location</span><span class='dot token'>.</span><span class='rubyid_file identifier id'>file</span> <span class='rubyid_end end 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.22/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='rubyid_doc identifier id'>doc</span><span class='dot token'>.</span><span class='rubyid_find_by identifier id'>find_by</span> <span class='label val'>context:</span> <span class='symbol val'>:section</span> <span class='comment val'>#=> Asciidoctor::Section@14459860 { level: 0, title: "Hello, AsciiDoc!", blocks: 0 }</span> <span class='comment val'>#=> Asciidoctor::Section@14505460 { level: 1, title: "First Section", blocks: 1 }</span> </code></pre> <pre class="example code"><code><span class='rubyid_doc identifier id'>doc</span><span class='dot token'>.</span><span class='rubyid_find_by identifier id'>find_by</span><span class='lparen token'>(</span><span class='label val'>context:</span> <span class='symbol val'>:section</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_section identifier id'>section</span><span class='bitor op'>|</span> <span class='rubyid_section identifier id'>section</span><span class='dot token'>.</span><span class='rubyid_level identifier id'>level</span> <span class='eq op'>==</span> <span class='integer val'>1</span> <span class='rbrace token'>}</span> <span class='comment val'>#=> Asciidoctor::Section@14505460 { level: 1, title: "First Section", blocks: 1 }</span> </code></pre> <pre class="example code"><code><span class='rubyid_doc identifier id'>doc</span><span class='dot token'>.</span><span class='rubyid_find_by identifier id'>find_by</span> <span class='label val'>context:</span> <span class='symbol val'>:listing</span><span class='comma token'>,</span> <span class='label val'>style:</span> <span class='string val'>'source'</span> <span class='comment val'>#=> 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"> 176 177 178 179 180</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 176</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_find_by identifier id'>find_by</span> <span class='rubyid_selector identifier id'>selector</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span> <span class='rubyid_find_by_internal identifier id'>find_by_internal</span> <span class='rubyid_selector identifier id'>selector</span><span class='comma token'>,</span> <span class='lparen token'>(</span><span class='rubyid_result identifier id'>result</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span> <span class='rubyid_rescue rescue kw'>rescue</span> <span class='colon2 op'>::</span><span class='rubyid_StopIteration constant id'>StopIteration</span> <span class='rubyid_result identifier id'>result</span> <span class='rubyid_end end 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.22/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"> 56 57 58</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 56</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_inline? fid id'>inline?</span> <span class='rubyid_false false kw'>false</span> <span class='rubyid_end end 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.22/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"> 66 67 68</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 66</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_lineno identifier id'>lineno</span> <span class='rubyid_@source_location ivar id'>@source_location</span> <span class='andop op'>&&</span> <span class='rubyid_@source_location ivar id'>@source_location</span><span class='dot token'>.</span><span class='rubyid_lineno identifier id'>lineno</span> <span class='rubyid_end end 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.22/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.22/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.22/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"> 271 272 273</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 271</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_list_marker_keyword identifier id'>list_marker_keyword</span> <span class='rubyid_list_type identifier id'>list_type</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span> <span class='rubyid_ORDERED_LIST_KEYWORDS constant id'>ORDERED_LIST_KEYWORDS</span><span class='lbrack token'>[</span><span class='rubyid_list_type identifier id'>list_type</span> <span class='orop op'>||</span> <span class='rubyid_@style ivar id'>@style</span><span class='rbrack token'>]</span> <span class='rubyid_end end 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.22/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"> 186 187 188 189 190 191 192 193 194</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 186</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_next_adjacent_block identifier id'>next_adjacent_block</span> <span class='rubyid_unless unless kw'>unless</span> <span class='rubyid_@context ivar id'>@context</span> <span class='eq op'>==</span> <span class='symbol val'>:document</span> <span class='rubyid_if if kw'>if</span> <span class='lparen token'>(</span><span class='rubyid_p identifier id'>p</span> <span class='assign token'>=</span> <span class='rubyid_@parent ivar id'>@parent</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_context identifier id'>context</span> <span class='eq op'>==</span> <span class='symbol val'>:dlist</span> <span class='andop op'>&&</span> <span class='rubyid_@context ivar id'>@context</span> <span class='eq op'>==</span> <span class='symbol val'>:list_item</span> <span class='lparen token'>(</span><span class='rubyid_sib identifier id'>sib</span> <span class='assign token'>=</span> <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_items identifier id'>items</span><span class='lbrack token'>[</span><span class='lparen token'>(</span><span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_items identifier id'>items</span><span class='dot token'>.</span><span class='rubyid_find_index identifier id'>find_index</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_terms identifier id'>terms</span><span class='comma token'>,</span> <span class='rubyid_desc identifier id'>desc</span><span class='bitor op'>|</span> <span class='lparen token'>(</span><span class='rubyid_terms identifier id'>terms</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span> <span class='rubyid_self self kw'>self</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='rubyid_desc identifier id'>desc</span> <span class='eq op'>==</span> <span class='rubyid_self self kw'>self</span> <span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>1</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_sib identifier id'>sib</span> <span class='colon op'>:</span> <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_next_adjacent_block identifier id'>next_adjacent_block</span> <span class='rubyid_else else kw'>else</span> <span class='lparen token'>(</span><span class='rubyid_sib identifier id'>sib</span> <span class='assign token'>=</span> <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_blocks identifier id'>blocks</span><span class='lbrack token'>[</span><span class='lparen token'>(</span><span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_blocks identifier id'>blocks</span><span class='dot token'>.</span><span class='rubyid_find_index identifier id'>find_index</span> <span class='rubyid_self self kw'>self</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>1</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_sib identifier id'>sib</span> <span class='colon op'>:</span> <span class='rubyid_p identifier id'>p</span><span class='dot token'>.</span><span class='rubyid_next_adjacent_block identifier id'>next_adjacent_block</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_end end 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.22/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"> 143 144 145</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 143</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_number identifier id'>number</span> <span class='lparen token'>(</span><span class='rubyid_Integer constant id'>Integer</span> <span class='rubyid_@numeral ivar id'>@numeral</span><span class='rparen token'>)</span> <span class='rubyid_rescue rescue kw'>rescue</span> <span class='rubyid_@numeral ivar id'>@numeral</span> <span class='rubyid_end end kw'>end</span> </pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="number=-instance_method"> #<strong>number=</strong>(val) ⇒ <tt>Object</tt> </h3><script> document.getElementById("number=-instance_method").insertAdjacentHTML( "afterbegin", '<a class="permalink" href="/gems/asciidoctor/2.0.22/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 set the numeral of this section by coercing the value to a String.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 148 149 150</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 148</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_number= identifier id'>number=</span> <span class='rubyid_val identifier id'>val</span> <span class='rubyid_@numeral ivar id'>@numeral</span> <span class='assign token'>=</span> <span class='rubyid_val identifier id'>val</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span> <span class='rubyid_end end 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.22/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"> 324 325 326 327</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 324</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_remove_sub identifier id'>remove_sub</span> <span class='rubyid_sub identifier id'>sub</span> <span class='rubyid_@subs ivar id'>@subs</span><span class='dot token'>.</span><span class='rubyid_delete identifier id'>delete</span> <span class='rubyid_sub identifier id'>sub</span> <span class='rubyid_nil nil kw'>nil</span> <span class='rubyid_end end 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.22/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.22/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='rubyid_doc identifier id'>doc</span> <span class='lshft op'><<</span> <span class='lparen token'>(</span><span class='rubyid_sect1 identifier id'>sect1</span> <span class='assign token'>=</span> <span class='rubyid_Section constant id'>Section</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_doc identifier id'>doc</span><span class='comma token'>,</span> <span class='integer val'>1</span><span class='rparen token'>)</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='dot token'>.</span><span class='rubyid_title identifier id'>title</span> <span class='assign token'>=</span> <span class='string val'>'Section 1'</span> <span class='rubyid_para1 identifier id'>para1</span> <span class='assign token'>=</span> <span class='rubyid_Block constant id'>Block</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='comma token'>,</span> <span class='symbol val'>:paragraph</span><span class='comma token'>,</span> <span class='label val'>source:</span> <span class='string val'>'Paragraph 1'</span> <span class='rubyid_para2 identifier id'>para2</span> <span class='assign token'>=</span> <span class='rubyid_Block constant id'>Block</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='comma token'>,</span> <span class='symbol val'>:paragraph</span><span class='comma token'>,</span> <span class='label val'>source:</span> <span class='string val'>'Paragraph 2'</span> <span class='rubyid_sect1 identifier id'>sect1</span> <span class='lshft op'><<</span> <span class='rubyid_para1 identifier id'>para1</span> <span class='lshft op'><<</span> <span class='rubyid_para2 identifier id'>para2</span> <span class='rubyid_sect1 identifier id'>sect1</span> <span class='lshft op'><<</span> <span class='lparen token'>(</span><span class='rubyid_sect1_1 identifier id'>sect1_1</span> <span class='assign token'>=</span> <span class='rubyid_Section constant id'>Section</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='comma token'>,</span> <span class='integer val'>2</span><span class='rparen token'>)</span> <span class='rubyid_sect1_1 identifier id'>sect1_1</span><span class='dot token'>.</span><span class='rubyid_title identifier id'>title</span> <span class='assign token'>=</span> <span class='string val'>'Section 1.1'</span> <span class='rubyid_sect1_1 identifier id'>sect1_1</span> <span class='lshft op'><<</span> <span class='lparen token'>(</span><span class='rubyid_Block constant id'>Block</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_sect1_1 identifier id'>sect1_1</span><span class='comma token'>,</span> <span class='symbol val'>:paragraph</span><span class='comma token'>,</span> <span class='label val'>source:</span> <span class='string val'>'Paragraph 3'</span><span class='rparen token'>)</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='dot token'>.</span><span class='rubyid_blocks? fid id'>blocks?</span> <span class='comment val'># => true</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='dot token'>.</span><span class='rubyid_blocks identifier id'>blocks</span><span class='dot token'>.</span><span class='rubyid_size identifier id'>size</span> <span class='comment val'># => 3</span> <span class='rubyid_sect1 identifier id'>sect1</span><span class='dot token'>.</span><span class='rubyid_sections identifier id'>sections</span><span class='dot token'>.</span><span class='rubyid_size identifier id'>size</span> <span class='comment val'># => 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.22/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"> 218 219 220</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 218</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_sections identifier id'>sections</span> <span class='rubyid_@blocks ivar id'>@blocks</span><span class='dot token'>.</span><span class='rubyid_select identifier id'>select</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_block identifier id'>block</span><span class='bitor op'>|</span> <span class='rubyid_block identifier id'>block</span><span class='dot token'>.</span><span class='rubyid_context identifier id'>context</span> <span class='eq op'>==</span> <span class='symbol val'>:section</span> <span class='rbrace token'>}</span> <span class='rubyid_end end 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.22/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>Acts an an abstract method that always returns false unless this block is an instance of Document or Section. Both Document and Section provide overrides for this method.</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>false</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 138 139 140</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 138</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_sections? fid id'>sections?</span> <span class='rubyid_false false kw'>false</span> <span class='rubyid_end end 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.22/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"> 315 316 317</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 315</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_sub? fid id'>sub?</span> <span class='rubyid_name identifier id'>name</span> <span class='rubyid_@subs ivar id'>@subs</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span> <span class='rubyid_name identifier id'>name</span> <span class='rubyid_end end 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.22/Asciidoctor%2FAbstractBlock:title">permalink</a>' ); </script> <div class="docstring"> <div class="discussion"> <p>Get the String title of this Block with title substitutions 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><span class='rubyid_block identifier id'>block</span><span class='dot token'>.</span><span class='rubyid_title identifier id'>title</span> <span class='assign token'>=</span> <span class='string val'>"Foo 3^ # {two-colons} Bar(1)"</span> <span class='rubyid_block identifier id'>block</span><span class='dot token'>.</span><span class='rubyid_title identifier id'>title</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>"Foo 3^ # :: Bar(1)"</span> </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"> 288 289 290 291</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 288</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_title identifier id'>title</span> <span class='comment val'># prevent substitutions from being applied to title multiple times</span> <span class='rubyid_@converted_title ivar id'>@converted_title</span> <span class='opasgn op'>||=</span> <span class='rubyid_@title ivar id'>@title</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='rubyid_apply_title_subs identifier id'>apply_title_subs</span> <span class='rubyid_@title ivar id'>@title</span><span class='rparen token'>)</span> <span class='rubyid_end end 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.22/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 specified String title</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 303 304 305 306</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 303</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_title= identifier id'>title=</span> <span class='rubyid_val identifier id'>val</span> <span class='rubyid_@converted_title ivar id'>@converted_title</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span> <span class='rubyid_@title ivar id'>@title</span> <span class='assign token'>=</span> <span class='rubyid_val identifier id'>val</span> <span class='rubyid_end end 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.22/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"> 296 297 298</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 296</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_title? fid id'>title?</span> <span class='rubyid_@title ivar id'>@title</span> <span class='question op'>?</span> <span class='rubyid_true true kw'>true</span> <span class='colon op'>:</span> <span class='rubyid_false false kw'>false</span> <span class='rubyid_end end 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.22/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.22/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.22/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.22/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.22/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"> 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/asciidoctor/abstract_block.rb', line 345</span> <span class='rubyid_def def kw'>def</span> <span class='rubyid_xreftext identifier id'>xreftext</span> <span class='rubyid_xrefstyle identifier id'>xrefstyle</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span> <span class='rubyid_if if kw'>if</span> <span class='lparen token'>(</span><span class='rubyid_val identifier id'>val</span> <span class='assign token'>=</span> <span class='rubyid_reftext identifier id'>reftext</span><span class='rparen token'>)</span> <span class='andop op'>&&</span> <span class='notop op'>!</span><span class='rubyid_val identifier id'>val</span><span class='dot token'>.</span><span class='rubyid_empty? fid id'>empty?</span> <span class='rubyid_val identifier id'>val</span> <span class='comment val'># NOTE xrefstyle only applies to blocks with a title and a caption or number</span> <span class='rubyid_elsif elsif kw'>elsif</span> <span class='rubyid_xrefstyle identifier id'>xrefstyle</span> <span class='andop op'>&&</span> <span class='rubyid_@title ivar id'>@title</span> <span class='andop op'>&&</span> <span class='notop op'>!</span><span class='rubyid_@caption ivar id'>@caption</span><span class='dot token'>.</span><span class='rubyid_nil_or_empty? fid id'>nil_or_empty?</span> <span class='rubyid_case case kw'>case</span> <span class='rubyid_xrefstyle identifier id'>xrefstyle</span> <span class='rubyid_when when kw'>when</span> <span class='string val'>'full'</span> <span class='rubyid_quoted_title identifier id'>quoted_title</span> <span class='assign token'>=</span> <span class='rubyid_sub_placeholder identifier id'>sub_placeholder</span> <span class='lparen token'>(</span><span class='rubyid_sub_quotes identifier id'>sub_quotes</span> <span class='rubyid_@document ivar id'>@document</span><span class='dot token'>.</span><span class='rubyid_compat_mode identifier id'>compat_mode</span> <span class='integer val'>? </span><span class='mod op'>%</span><span class='rubyid_q identifier id'>q</span><span class='lparen token'>(</span><span class='xstring val'>``</span><span class='mod op'>%</span><span class='rubyid_s identifier id'>s</span><span class='string val'>''</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='string val'>'"`%s`"'</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_title identifier id'>title</span> <span class='rubyid_if if kw'>if</span> <span class='rubyid_@numeral ivar id'>@numeral</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='rubyid_caption_attr_name identifier id'>caption_attr_name</span> <span class='assign token'>=</span> <span class='rubyid_CAPTION_ATTRIBUTE_NAMES constant id'>CAPTION_ATTRIBUTE_NAMES</span><span class='lbrack token'>[</span><span class='rubyid_@context ivar id'>@context</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='rubyid_prefix identifier id'>prefix</span> <span class='assign token'>=</span> <span class='rubyid_@document ivar id'>@document</span><span class='dot token'>.</span><span class='rubyid_attributes identifier id'>attributes</span><span class='lbrack token'>[</span><span class='rubyid_caption_attr_name identifier id'>caption_attr_name</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='dstring node'>%(#{prefix} #{@numeral}, #{quoted_title})</span> <span class='rubyid_else else kw'>else</span> <span class='dstring node'>%(#{@caption.chomp '. '}, #{quoted_title})</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_when when kw'>when</span> <span class='string val'>'short'</span> <span class='rubyid_if if kw'>if</span> <span class='rubyid_@numeral ivar id'>@numeral</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='rubyid_caption_attr_name identifier id'>caption_attr_name</span> <span class='assign token'>=</span> <span class='rubyid_CAPTION_ATTRIBUTE_NAMES constant id'>CAPTION_ATTRIBUTE_NAMES</span><span class='lbrack token'>[</span><span class='rubyid_@context ivar id'>@context</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='andop op'>&&</span> <span class='lparen token'>(</span><span class='rubyid_prefix identifier id'>prefix</span> <span class='assign token'>=</span> <span class='rubyid_@document ivar id'>@document</span><span class='dot token'>.</span><span class='rubyid_attributes identifier id'>attributes</span><span class='lbrack token'>[</span><span class='rubyid_caption_attr_name identifier id'>caption_attr_name</span><span class='rbrack token'>]</span><span class='rparen token'>)</span> <span class='dstring node'>%(#{prefix} #{@numeral})</span> <span class='rubyid_else else kw'>else</span> <span class='rubyid_@caption ivar id'>@caption</span><span class='dot token'>.</span><span class='rubyid_chomp identifier id'>chomp</span> <span class='string val'>'. '</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_else else kw'>else</span> <span class='comment val'># 'basic'</span> <span class='rubyid_title identifier id'>title</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_else else kw'>else</span> <span class='rubyid_title identifier id'>title</span> <span class='rubyid_end end kw'>end</span> <span class='rubyid_end end kw'>end</span> </pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Sun Sep 20 17:57:32 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>