Class: Paru::PandocFilter::RawBlock

Inherits:
Block
  • Object
show all
Includes:
InnerMarkdown
Defined in:
lib/paru/filter/raw_block.rb

Overview

A RawBlock node has a format and a string contents

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #parent

Instance Method Summary collapse

Methods included from InnerMarkdown

#inner_markdown, #inner_markdown=

Methods inherited from Block

#is_block?

Methods inherited from Node

#ast_type, #can_act_as_both_block_and_inline?, #each, from_markdown, #get_replacement, #has_been_replaced?, #has_block?, #has_children?, #has_class?, #has_inline?, #has_parent?, #is_block?, #is_inline?, #is_leaf?, #is_node?, #is_root?, #markdown, #markdown=, #toMetadata, #to_ast, #to_s, #type

Methods included from ASTManipulation

#append, #delete, #each_depth_first, #find_index, #get, #insert, #prepend, #remove_at, #replace, #replace_at

Constructor Details

#initialize(contents) ⇒ RawBlock

Create a new RawBlock node based on the contents

Parameters:

  • contents (Array)


38
39
40
# File 'lib/paru/filter/raw_block.rb', line 38

def initialize(contents)
    @format, @string = contents
end

Instance Attribute Details

#formatString

Returns:

  • (String)


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

class RawBlock < Block
    include InnerMarkdown
    attr_accessor :format, :string

    # Create a new RawBlock node based on the contents
    #
    # @param contents [Array]
    def initialize(contents)
        @format, @string = contents
    end

    # Create an AST representation of this RawBlock node
    def ast_contents()
        [
            @format,
            @string
        ]
    end

    # Has this RawBlock node a string value?
    #
    # @return [Boolean] true
    def has_string?
        true
    end
end

#stringString

Returns:

  • (String)


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

class RawBlock < Block
    include InnerMarkdown
    attr_accessor :format, :string

    # Create a new RawBlock node based on the contents
    #
    # @param contents [Array]
    def initialize(contents)
        @format, @string = contents
    end

    # Create an AST representation of this RawBlock node
    def ast_contents()
        [
            @format,
            @string
        ]
    end

    # Has this RawBlock node a string value?
    #
    # @return [Boolean] true
    def has_string?
        true
    end
end

Instance Method Details

#ast_contentsObject

Create an AST representation of this RawBlock node



43
44
45
46
47
48
# File 'lib/paru/filter/raw_block.rb', line 43

def ast_contents()
    [
        @format,
        @string
    ]
end

#has_string?Boolean

Has this RawBlock node a string value?

Returns:

  • (Boolean)

    true



53
54
55
# File 'lib/paru/filter/raw_block.rb', line 53

def has_string?
    true
end