class Paru::PandocFilter::OrderedList

An OrderedList Node

@example In markdown an ordered list looks like

1. this is the first item
2. this the second
3. and so on

It has an ListAttributes object and a list of items

@!attribute list_attributes

@return [ListAttributes]

Attributes

list_attributes[RW]

Public Class Methods

from_array(items, **config ) click to toggle source

Create a new OrderedList from an array of markdown strings

@param items [String an array of markdown strings @param config [Hash] configuration of the list. Can have properties :start (Int), :style (String), and :delim (String)

@return [OrderedList]

# File lib/paru/filter/ordered_list.rb, line 64
def self.from_array(items, **config )
    start = if config.has_key? :start then config[:start] else 1 end
    style = if config.has_key? :style then config[:style] else "Decimal" end
    delim = if config.has_key? :delim then config[:delim] else "Period" end
    ast_items = items.map {|item| [Block.from_markdown(item).to_ast]}
    OrderedList.new [[start, {"t" => style}, {"t" => delim}], ast_items]
end
new(contents) click to toggle source

Create a new OrderedList node based on the contents

@param contents [Array]

Calls superclass method Paru::PandocFilter::List::new
# File lib/paru/filter/ordered_list.rb, line 42
def initialize(contents)
    super contents[1]
    @list_attributes = ListAttributes.new contents[0]
end

Public Instance Methods

ast_contents() click to toggle source

The AST contents

@return [Array]

Calls superclass method Paru::PandocFilter::List#ast_contents
# File lib/paru/filter/ordered_list.rb, line 50
def ast_contents()
    [
        @list_attributes.to_ast,
        super
    ] 
end