Class: Paru::PandocFilter::Cite

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

Overview

A Cite node, consisting of a list of Citation nodes, and a list of Inline nodes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ Cite

Create a new Cite node

Parameters:

  • contents (Array)

    an array containing a list of citations and a list of inline nodes



36
37
38
39
40
41
42
# File 'lib/paru/filter/cite.rb', line 36

def initialize(contents)
    super contents[1]
    @citations = []
    contents[0].each do |citation|
        @citations.push Citation.new(citation)
    end
end

Instance Attribute Details

#citationsArray<Citation>

Returns:



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

class Cite < Inline
    attr_accessor :citations

    # Create a new Cite node
    #
    # @param contents [Array] an array containing a list of citations
    #   and a list of inline nodes
    def initialize(contents)
        super contents[1]
        @citations = []
        contents[0].each do |citation|
            @citations.push Citation.new(citation)
        end
    end

    # Create an AST representation of this Cite node.
    def ast_contents()
        [
            @citations.map {|citation| citation.to_ast},
            super
        ]
    end

    #undef_method :inner_markdown
    #undef_method :inner_markdown=
end

Instance Method Details

#ast_contentsObject

Create an AST representation of this Cite node.



45
46
47
48
49
50
# File 'lib/paru/filter/cite.rb', line 45

def ast_contents()
    [
        @citations.map {|citation| citation.to_ast},
        super
    ]
end