Class: Paru::PandocFilter::Div

Inherits:
Block show all
Includes:
InnerMarkdown
Defined in:
lib/paru/filter/div.rb

Overview

A Div node consisting of an attribute object 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) ⇒ Div

Create a new Div node based on the contents

Parameters:

  • contents (Array)

    an array containing the attribute object and the contents of this div.



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

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

Instance Attribute Details

#attrAttr

Returns:



35
36
37
# File 'lib/paru/filter/div.rb', line 35

def attr
  @attr
end

Instance Method Details

#ast_contentsObject

Create an AST representation of this Div node.



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

def ast_contents
  [
    @attr.to_ast,
    super
  ]
end

#has_block?Boolean

Has this Div node Blocks as children?

Returns:

  • (Boolean)

    true



57
58
59
# File 'lib/paru/filter/div.rb', line 57

def has_block?
  true
end