def _build_list_items(self, matches):
assert len(matches) > <NUM_LIT:0>, "<STR_LIT>"<EOL>lines = []<EOL>current_level = matches[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>while matches and current_level <= matches[<NUM_LIT:0>][<NUM_LIT:0>]:<EOL><INDENT>level, _, tag_id, title = matches[<NUM_LIT:0>]<EOL>if current_level < level:<EOL><INDENT>lines.extend(self._build_list(matches, level))<EOL>continue<EOL><DEDENT>if tag_id:<EOL><INDENT>lines.append('<STR_LIT>'.format(tag_id, title))<EOL><DEDENT>else:<EOL><INDENT>lines.append('<STR_LIT>'.format(title))<EOL><DEDENT>matches.pop(<NUM_LIT:0>)<EOL><DEDENT>return lines<EOL>
Returns the HTML list items for the next matches that have a larger (or equal) header
        compared to the first header's level.

        This method mutatively removes elements from the front of matches as it processes each
        element. This method assumes matches contains at least one match.

        PARAMETERS:
        matches -- list of tuples; each tuple corresponds to the groups matched by the header_regex.

        RETURNS:
        list of str; the table of contents as a list of lines.