X-Git-Url: https://git.arvados.org/rnaseq-cwl-training.git/blobdiff_plain/5520175060add65af31ac11a5d13a90c3b3f0d07..d0b3cf479e28a9c308fa9c2040b749c969edfe6a:/bin/extract_figures.py diff --git a/bin/extract_figures.py b/bin/extract_figures.py index 7eb55f0..63a7752 100755 --- a/bin/extract_figures.py +++ b/bin/extract_figures.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +from __future__ import print_function import sys import os import glob @@ -7,7 +8,6 @@ from optparse import OptionParser from util import Reporter, read_markdown, IMAGE_FILE_SUFFIX - def main(): """Main driver.""" @@ -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)