Skip to content

Handle a case with no examples #99

@Erik-McKee

Description

@Erik-McKee

The while loop here (line 200) needs an additional condition because there could be no next sibling found:

def parse_examples(self, word_contents):
    definition_id_list = self.get_id_list(word_contents, 'definitions')
    example_list = []
    for def_index, def_id, def_type in definition_id_list:
        span_tag = self.soup.find_all('span', {'id': def_id})[0]
        table = span_tag.parent
        **while table.name != 'ol':**
            table = table.find_next_sibling()

it should be:

def parse_examples(self, word_contents):
    definition_id_list = self.get_id_list(word_contents, 'definitions')
    example_list = []
    for def_index, def_id, def_type in definition_id_list:
        span_tag = self.soup.find_all('span', {'id': def_id})[0]
        table = span_tag.parent
        **while table and table.name != 'ol':**
            table = table.find_next_sibling()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions