예제 #1
0
def get_asset_links(contents, zettel_path):
    assert os.path.isabs(zettel_path) or zettel_path == ''

    links = Links()
    for link_match in re.finditer(asset_link_pattern, contents):
        link_dict = link_match.groupdict()

        # URLs that end with '.html' or '.htm' could be in the list.
        # Ignore them, but not locally saved files with those endings.
        if link_dict['link'].endswith('.html') or link_dict['link'].endswith(
                '.htm'):
            if html_link_is_URL(link_dict['link']):
                continue

        links.append(link_dict['link'], link_dict['name'], zettel_path)

    return links