checkdeadlinks: Output the list of dead links on exit.

This commit is contained in:
Emmanuel Gil Peyrot 2016-10-03 23:02:11 +01:00
parent 230bab3bf9
commit 62348c310b
1 changed files with 4 additions and 5 deletions

View File

@ -80,18 +80,17 @@ def main():
xepfile = 'xep-' + xepnum + '.xml'
thexep = parse(xepfile)
deadlinks = 0
if verbose:
print 'Checking XEP-' + xepnum + ':'
urls = [link.getAttribute("url") for link in thexep.getElementsByTagName("link")]
urls += [image.getAttribute("src") for image in thexep.getElementsByTagName("img")]
for url in set(urls):
if is_dead(url):
deadlinks += 1
deadlinks = [url for url in set(urls) if is_dead(url)]
if deadlinks > 0:
if deadlinks:
for url in deadlinks:
print url
sys.exit(1)
if __name__ == "__main__":