lib/kramdown/parser/kramdown/list.rb in kramdown-0.6.0 vs lib/kramdown/parser/kramdown/list.rb in kramdown-0.7.0

- old
+ new

@@ -21,10 +21,11 @@ # require 'kramdown/parser/kramdown/blank_line' require 'kramdown/parser/kramdown/eob' require 'kramdown/parser/kramdown/horizontal_rule' +require 'kramdown/parser/kramdown/attribute_list' module Kramdown module Parser class Kramdown @@ -57,11 +58,11 @@ if @tree.children.last && @tree.children.last.type == :p # last element must not be a paragraph return false end type, list_start_re = (@src.check(LIST_START_UL) ? [:ul, LIST_START_UL] : [:ol, LIST_START_OL]) - list = Element.new(type) + list = new_block_el(type) item = nil indent_re = nil content_re = nil eob_found = false @@ -72,10 +73,15 @@ elsif @src.scan(list_start_re) item = Element.new(:li) item.value, indentation, content_re, indent_re = parse_first_list_line(@src[1].length, @src[2]) list.children << item + item.value.sub!(/^#{IAL_SPAN_START}/) do |match| + parse_attribute_list($~[1], item.options[:ial] ||= {}) + '' + end + list_start_re = (type == :ul ? /^( {0,#{[3, indentation - 1].min}}[+*-])([\t| ].*?\n)/ : /^( {0,#{[3, indentation - 1].min}}\d+\.)([\t| ].*?\n)/) nested_list_found = false elsif result = @src.scan(content_re) result.sub!(/^(\t+)/) { " "*4*($1 ? $1.length : 0) } @@ -144,10 +150,10 @@ (children.length >= 2 && children[-1].type != :p && (children[-1].type != :blank || children[-1].value != "\n" || children[-2].type != :p)) return false end first_as_para = false - deflist = Element.new(:dl) + deflist = new_block_el(:dl) para = @tree.children.pop if para.type == :blank para = @tree.children.pop first_as_para = true end