Handle a case with no examples
Erik-McKee opened this issue · comments
Erik-McKee commented
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()