Sha256: 888f615aca90057731211bed660ad59fbf8901f7a570ab7459ff1882c54f13f9

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

module Asciidoctor
# Public: Methods for managing inline elements in AsciiDoc block
class Inline < AbstractNode
  # Public: Get the text of this inline element
  attr_reader :text

  # Public: Get the type (qualifier) of this inline element
  attr_reader :type

  # Public: Get/Set the target (e.g., uri) of this inline element
  attr_accessor :target

  def initialize(parent, context, text = nil, opts = {})
    super(parent, context)

    @text = text 

    #@id = opts[:id] if opts.has_key?(:id)
    #@type = opts[:type] if opts.has_key?(:type)
    #@target = opts[:target] if opts.has_key?(:target)

    @id = opts[:id]
    @type = opts[:type]
    @target = opts[:target]
    
    if opts.has_key?(:attributes) && (attributes = opts[:attributes]).is_a?(Hash)
      update_attributes(opts[:attributes]) unless attributes.empty?
    end
  end

  def render
    renderer.render("inline_#{@context}", self).chomp
  end

end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
asciidoctor-0.1.3 lib/asciidoctor/inline.rb
asciidoctor-0.1.2 lib/asciidoctor/inline.rb
asciidoctor-0.1.1 lib/asciidoctor/inline.rb