Class: Paru::PandocFilter::Link

Inherits:
Inline show all
Defined in:
lib/paru/filter/link.rb

Overview

A Link node has an attribute object, an Inline description and a target

Direct Known Subclasses

Image

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ Link

Create a new Link node with contents

Parameters:

  • contents (Array)

    an array with attributes, description, and target information



40
41
42
43
44
# File 'lib/paru/filter/link.rb', line 40

def initialize(contents)
    @attr = Attr.new contents[0]
    super contents[1]
    @target = Target.new contents[2]
end

Instance Attribute Details

#attrAttr

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/paru/filter/link.rb', line 33

class Link < Inline
    attr_accessor :attr, :target

    # Create a new Link node with contents
    #
    # @param contents [Array] an array with attributes, description,
    #   and target information
    def initialize(contents)
        @attr = Attr.new contents[0]
        super contents[1]
        @target = Target.new contents[2]
    end

    # Create an AST representation of this Link node
    def ast_contents
        [
            @attr.to_ast,
            super,
            @target.to_ast
        ]
    end

end

#targetTarget

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/paru/filter/link.rb', line 33

class Link < Inline
    attr_accessor :attr, :target

    # Create a new Link node with contents
    #
    # @param contents [Array] an array with attributes, description,
    #   and target information
    def initialize(contents)
        @attr = Attr.new contents[0]
        super contents[1]
        @target = Target.new contents[2]
    end

    # Create an AST representation of this Link node
    def ast_contents
        [
            @attr.to_ast,
            super,
            @target.to_ast
        ]
    end

end

Instance Method Details

#ast_contentsObject

Create an AST representation of this Link node



47
48
49
50
51
52
53
# File 'lib/paru/filter/link.rb', line 47

def ast_contents
    [
        @attr.to_ast,
        super,
        @target.to_ast
    ]
end