# File lib/asciidoctor/parser.rb, line 1254
  def self.next_list_item(reader, list_block, match, sibling_trait = nil)
    if (list_type = list_block.context) == :dlist
      list_term = ListItem.new(list_block, match[1])
      list_item = ListItem.new(list_block, match[3])
      has_text = !match[3].nil_or_empty?
    else
      # Create list item using first line as the text of the list item
      text = match[2]
      checkbox = false
      if list_type == :ulist && text.start_with?('[')
        if text.start_with?('[ ] ')
          checkbox = true
          checked = false
          text = text[3..-1].lstrip
        elsif text.start_with?('[x] ', '[*] ')
          checkbox = true
          checked = true
          text = text[3..-1].lstrip
        end
      end
      list_item = ListItem.new(list_block, text)

      if checkbox
        # FIXME checklist never makes it into the options attribute
        list_block.attributes['checklist-option'] = ''
        list_item.attributes['checkbox'] = ''
        list_item.attributes['checked'] = '' if checked
      end

      sibling_trait ||= resolve_list_marker(list_type, match[1], list_block.items.size, true, reader)
      list_item.marker = sibling_trait
      has_text = true
    end

    # first skip the line with the marker / term
    reader.shift
    list_item_reader = Reader.new read_lines_for_list_item(reader, list_type, sibling_trait, has_text), reader.cursor
    if list_item_reader.has_more_lines?
      # NOTE peek on the other side of any comment lines
      comment_lines = list_item_reader.skip_line_comments
      if (subsequent_line = list_item_reader.peek_line)
        list_item_reader.unshift_lines comment_lines unless comment_lines.empty?
        if (continuation_connects_first_block = subsequent_line.empty?)
          content_adjacent = false
        else
          content_adjacent = true
          # treat lines as paragraph text if continuation does not connect first block (i.e., has_text = false)
          has_text = false unless list_type == :dlist
        end
      else
        # NOTE we have no use for any trailing comment lines we might have found
        continuation_connects_first_block = false
        content_adjacent = false
      end

      # only relevant for :dlist
      options = {:text => !has_text}

      # we can look for blocks until lines are exhausted without worrying about
      # sections since reader is confined to boundaries of list
      while ((block = next_block list_item_reader, list_item, {}, options) && list_item << block) ||
          list_item_reader.has_more_lines?
      end

      list_item.fold_first(continuation_connects_first_block, content_adjacent)
    end

    if list_type == :dlist
      if list_item.text? || list_item.blocks?
        [list_term, list_item]
      else
        [list_term, nil]
      end
    else
      list_item
    end
  end