lib/maruku/input/parse_block.rb
# Reads one list item, either ordered or unordered.
Reads one list item, either ordered or unordered.
Reads one list item either ordered or unordered .
def read_list_item(src)
    parent_offset = src.cur_index
    item_type = src.cur_line.md_type
    first = src.shift_line
    indentation, ial = spaces_before_first_char(first)
    al = read_attribute_list(CharSource.new(ial, src)) if ial
    ial_offset = ial ? ial.length + 3 : 0
    lines, want_my_paragraph = read_indented_content(src, indentation, [], item_type, ial_offset)
    if !lines.empty? && [:ulist, :olist].include?(MaRuKu::MDLine.new(lines.first).md_type)
      lines.unshift ""
    end
    first_changed = first.gsub(/([^\t]*)(\t)/) { $1 + " " * (TAB_SIZE - $1.length % TAB_SIZE) }
    stripped = first_changed[indentation, first_changed.size - 1]
    lines.unshift stripped
    src2 = LineSource.new(lines, src, parent_offset)
    children = parse_blocks(src2)
    md_li(children, want_my_paragraph, al)
  end
def read_list_item ( src ) parent_offset = src . cur_index item_type = src . cur_line . md_type first = src . shift_line indentation , ial = spaces_before_first_char ( first ) al = read_attribute_list ( CharSource . new ( ial , src ) ) if ial ial_offset = ial ? ial . length + 3 : 0 lines , want_my_paragraph = read_indented_content ( src , indentation , [ ] , item_type , ial_offset ) if ! lines . empty? && [ :ulist , :olist ] . include? ( MaRuKu :: MDLine . new ( lines . first ) . md_type ) lines . unshift "" end first_changed = first . gsub ( / ([^ \t ]*)( \t ) / ) { $1 + " " * ( TAB_SIZE - $1 . length % TAB_SIZE ) } stripped = first_changed [ indentation , first_changed . size - 1 ] lines . unshift stripped src2 = LineSource . new ( lines , src , parent_offset ) children = parse_blocks ( src2 ) md_li ( children , want_my_paragraph , al ) end
Reads one list item, either ordered or unordered.
Reads one list item either ordered or unordered .
# in case there is a second line and this line starts a new list, format it. # add first line # Strip first '*', '-', '+' from first line
src