Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Making the code a little more robust
  • Loading branch information
Greg Wilson committed Jul 13, 2016
1 parent 466c28d commit cf51440
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/extract_figures.py
Expand Up @@ -58,7 +58,8 @@ def find_image_nodes(doc, result):

if (doc['type'] == 'img') or \
((doc['type'] == 'html_element') and (doc['value'] == 'img')):
result.append({'alt': doc['attr']['alt'], 'src': doc['attr']['src']})
alt = doc['attr'].get('alt', '')
result.append({'alt': alt, 'src': doc['attr']['src']})
else:
for child in doc.get('children', []):
find_image_nodes(child, result)
Expand Down

0 comments on commit cf51440

Please sign in to comment.