Class: Asciidoctor::Inline
- Inherits:
-
AbstractNode
- Object
- AbstractNode
- Asciidoctor::Inline
- Defined in:
- lib/asciidoctor/inline.rb
Overview
Methods for managing inline elements in AsciiDoc block
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
-
#target ⇒ Object
Get/Set the target (e.g., uri) of this inline element.
-
#text ⇒ Object
Get the text of this inline element.
-
#type ⇒ Object
readonly
Get the type (qualifier) of this inline element.
Attributes inherited from AbstractNode
#attributes, #context, #document, #id, #node_name, #parent
Instance Method Summary collapse
-
#alt ⇒ String
Returns the converted alt text for this inline image.
- #block? ⇒ Boolean
- #convert ⇒ Object (also: #render)
-
#initialize(parent, context, text = nil, opts = {}) ⇒ Inline
constructor
A new instance of Inline.
- #inline? ⇒ Boolean
-
#reftext ⇒ Object
For a reference node (:ref or :bibref), the text is the reftext (and the reftext attribute is not set).
-
#reftext? ⇒ Boolean
For a reference node (:ref or :bibref), the text is the reftext (and the reftext attribute is not set).
-
#xreftext(xrefstyle = nil) ⇒ String
Generate cross reference text (xreftext) that can be used to refer to this inline node.
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, #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, text = nil, opts = {}) ⇒ Inline
Returns a new instance of Inline.
14 15 16 17 18 19 20 21 |
# File 'lib/asciidoctor/inline.rb', line 14 def initialize(parent, context, text = nil, opts = {}) super(parent, context, opts) @node_name = %(inline_#{context}) @text = text @id = opts[:id] @type = opts[:type] @target = opts[:target] end |
Instance Attribute Details
#target ⇒ Object
Get/Set the target (e.g., uri) of this inline element
12 13 14 |
# File 'lib/asciidoctor/inline.rb', line 12 def target @target end |
#text ⇒ Object
Get the text of this inline element
6 7 8 |
# File 'lib/asciidoctor/inline.rb', line 6 def text @text end |
#type ⇒ Object (readonly)
Get the type (qualifier) of this inline element
9 10 11 |
# File 'lib/asciidoctor/inline.rb', line 9 def type @type end |
Instance Method Details
#alt ⇒ String
Returns the converted alt text for this inline image.
41 42 43 |
# File 'lib/asciidoctor/inline.rb', line 41 def alt (attr 'alt') || '' end |
#block? ⇒ Boolean
23 24 25 |
# File 'lib/asciidoctor/inline.rb', line 23 def block? false end |
#convert ⇒ Object Also known as: render
31 32 33 |
# File 'lib/asciidoctor/inline.rb', line 31 def convert converter.convert self end |
#inline? ⇒ Boolean
27 28 29 |
# File 'lib/asciidoctor/inline.rb', line 27 def inline? true end |
#reftext ⇒ Object
For a reference node (:ref or :bibref), the text is the reftext (and the reftext attribute is not set).
(see AbstractNode#reftext)
55 56 57 |
# File 'lib/asciidoctor/inline.rb', line 55 def reftext (val = @text) ? (apply_reftext_subs val) : nil end |
#reftext? ⇒ Boolean
For a reference node (:ref or :bibref), the text is the reftext (and the reftext attribute is not set).
(see AbstractNode#reftext?)
48 49 50 |
# File 'lib/asciidoctor/inline.rb', line 48 def reftext? @text && (@type == :ref || @type == :bibref) end |
#xreftext(xrefstyle = nil) ⇒ String
Generate cross reference text (xreftext) that can be used to refer to this inline node.
Use the explicit reftext for this inline node, if specified, retrieved by calling the reftext method. Otherwise, returns nil.
69 70 71 |
# File 'lib/asciidoctor/inline.rb', line 69 def xreftext xrefstyle = nil reftext end |