Class: Paru::PandocFilter::Figure

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

Overview

A Figure node consisting of an attribute object, a caption, and a list of Block nodes.

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_children?, #has_class?, #has_inline?, #has_parent?, #has_string?, #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) ⇒ Figure

Create a new Figure node based on the contents

Parameters:

  • contents (Array)


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

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

Instance Attribute Details

#attrAttr

Returns:



39
40
41
# File 'lib/paru/filter/figure.rb', line 39

def attr
  @attr
end

#captionObject

Returns Caption.

Returns:

  • Caption



39
# File 'lib/paru/filter/figure.rb', line 39

attr_accessor :attr, :caption

Instance Method Details

#ast_contentsObject

Create an AST representation of this Figure node.



51
52
53
54
55
56
57
# File 'lib/paru/filter/figure.rb', line 51

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

#has_block?Boolean

Has this Figure node Blocks as children?

Returns:

  • (Boolean)

    true



62
63
64
# File 'lib/paru/filter/figure.rb', line 62

def has_block?
  true
end