mirror of
https://github.com/moparisthebest/xeps
synced 2025-02-16 07:10:15 -05:00
checkdeadlinks: Output the list of dead links on exit.
This commit is contained in:
parent
230bab3bf9
commit
62348c310b
@ -80,18 +80,17 @@ def main():
|
|||||||
xepfile = 'xep-' + xepnum + '.xml'
|
xepfile = 'xep-' + xepnum + '.xml'
|
||||||
thexep = parse(xepfile)
|
thexep = parse(xepfile)
|
||||||
|
|
||||||
deadlinks = 0
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'Checking XEP-' + xepnum + ':'
|
print 'Checking XEP-' + xepnum + ':'
|
||||||
|
|
||||||
urls = [link.getAttribute("url") for link in thexep.getElementsByTagName("link")]
|
urls = [link.getAttribute("url") for link in thexep.getElementsByTagName("link")]
|
||||||
urls += [image.getAttribute("src") for image in thexep.getElementsByTagName("img")]
|
urls += [image.getAttribute("src") for image in thexep.getElementsByTagName("img")]
|
||||||
|
|
||||||
for url in set(urls):
|
deadlinks = [url for url in set(urls) if is_dead(url)]
|
||||||
if is_dead(url):
|
|
||||||
deadlinks += 1
|
|
||||||
|
|
||||||
if deadlinks > 0:
|
if deadlinks:
|
||||||
|
for url in deadlinks:
|
||||||
|
print url
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user