class Paru::PandocFilter::List

A List node is a base node for various List node types

Public Class Methods

new(contents, node_class = Block) click to toggle source

Create a new List node based on contents

@param contents [Array] the contents of the list @param node_class [Node = PandocFilter::Block] the contents are {Inline} nodes

Calls superclass method
# File lib/paru/filter/list.rb, line 31
def initialize(contents, node_class = Block)
    super []
    contents.each do |item|
        child = node_class.new(item)
        child.parent = self

        @children.push child
    end
end

Public Instance Methods

ast_contents() click to toggle source

Create an AST representation of this List node

# File lib/paru/filter/list.rb, line 42
def ast_contents()
    @children.map {|child| child.ast_contents}
end
has_block?() click to toggle source

Has this List node block contents?

@return [Boolean] true

# File lib/paru/filter/list.rb, line 49
def has_block?()
    true
end
to_array() click to toggle source

Convert this List to an array of markdown strings

@return [String

# File lib/paru/filter/list.rb, line 56
def to_array()
    @children.map do |block|
        block.children.map{|c| c.markdown.strip}.join("\n")
    end
end