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
Public Class Methods
Source
# 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
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]
Source
# File lib/paru/filter/ordered_list.rb, line 42 def initialize(contents) super contents[1] @list_attributes = ListAttributes.new contents[0] end
Create a new OrderedList
node based on the contents
@param contents [Array]
Calls superclass method
Paru::PandocFilter::List::new
Public Instance Methods
Source
# File lib/paru/filter/ordered_list.rb, line 50 def ast_contents() [ @list_attributes.to_ast, super ] end
The AST contents
@return [Array]
Calls superclass method
Paru::PandocFilter::List#ast_contents