diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index dc13493..6767edd 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -459,24 +459,44 @@ def check_headers(post_header): stat_links += 1 var_tag = 'link_%s'%stat_links + # NAME link_name = post_header[ln - 1].rsplit(tag)[1].lstrip() if not link_name: - logs.out("2", "Line %s (Name, %s)"%(ln, tag), False) + logs.out("2", 'L=%s. "%s %s" > %s'%( + ln, tag, tr.name, db.uri_file + ), False) post_err = True - if not isin(r'\b_%s\b'%link_name, post_bottom): - logs.out("6", "_%s"%link_name, False) + if not post_err and \ + not isin(r'\b_%s\b'%link_name, post_bottom): + logs.out("12", '"_%s%s" > %s'%( + tag, image_name, db.uri_file + ), False) post_err = True - link_url = post_header[ln].lstrip() - if link_url.startswith(tyto.headers): link_url = '' + # URL + try: + link_url = post_header[ln].lstrip() + if link_url.startswith(tyto.headers): link_url = '' + except: + link_url = '' + if not link_url: - logs.out("2", "Line %s (URL, %s)"%(ln + 1, tag), False) + logs.out("2", 'L=%s. "%s URL" > %s)'%( + ln + 1, tag, db.uri_file + ), False) post_err = True - - link_alt = post_header[ln + 1].lstrip() - if link_alt.startswith(tyto.headers): link_alt = '' + + # ALT + try: + link_alt = post_header[ln + 1].lstrip() + if link_alt.startswith(tyto.headers): link_alt = '' + except: + link_alt = '' + if not link_alt: - logs.out("2", "Line %s (Alt-Text, %s)"%(ln + 2, tag), False) + logs.out("2", 'L=%s. "%s Alt-Text" > %s'%( + ln + 2, tag, db.uri_file + ), False) post_err = True if not post_err: @@ -511,8 +531,12 @@ def check_headers(post_header): post_err = True # URI - image_uri = post_header[ln].lstrip() - if image_uri.startswith(tyto.headers): image_uri = '' + try: + image_uri = post_header[ln].lstrip() + if image_uri.startswith(tyto.headers): image_uri = '' + except: + image_uri = '' + if not image_uri: logs.out("2", 'L=%s. "%s URI" > %s)'%( ln + 1, tag, db.uri_file @@ -525,8 +549,12 @@ def check_headers(post_header): files_post = (files_post + "'%s', "%f_uri) # ALT - image_alt = post_header[ln + 1].lstrip() - if image_alt.startswith(tyto.headers): image_alt = '' + try: + image_alt = post_header[ln + 1].lstrip() + if image_alt.startswith(tyto.headers): image_alt = '' + except: + image_alt = '' + if not image_alt: logs.out("2", 'L=%s. "%s Alt-Text" > %s'%( ln + 2, tag, db.uri_file @@ -563,8 +591,12 @@ def check_headers(post_header): post_err = True # URI - raw_uri = post_header[ln].lstrip() - if raw_uri.startswith(tyto.headers): raw_uri = '' + try: + raw_uri = post_header[ln].lstrip() + if raw_uri.startswith(tyto.headers): raw_uri = '' + except: + raw_uri = '' + if not raw_uri: logs.out("2", 'L=%s. "%s URI" > %s)'%( ln + 1, tag, db.uri_file @@ -577,8 +609,12 @@ def check_headers(post_header): files_post = (files_post + "'%s', "%f_uri) # ALT - raw_alt = post_header[ln + 1].lstrip() - if raw_alt.startswith(tyto.headers): raw_alt = '' + try: + raw_alt = post_header[ln + 1].lstrip() + if raw_alt.startswith(tyto.headers): raw_alt = '' + except: + raw_alt = '' + if not raw_alt: logs.out("2", 'L=%s. "%s Alt-Text" > %s'%( ln + 2, tag, db.uri_file @@ -610,8 +646,12 @@ def check_headers(post_header): post_err = True # URI - file_uri = post_header[ln].lstrip() - if file_uri.startswith(tyto.headers): file_uri = '' + try: + file_uri = post_header[ln].lstrip() + if file_uri.startswith(tyto.headers): file_uri = '' + except: + file_uri = '' + if not file_uri: logs.out("2", 'L=%s. "%s URI" > %s)'%( ln + 1, tag, db.uri_file @@ -624,8 +664,12 @@ def check_headers(post_header): files_post = (files_post + "'%s', "%f_uri) # ALT - file_alt = post_header[ln + 1].lstrip() - if file_alt.startswith(tyto.headers): file_alt = '' + try: + file_alt = post_header[ln + 1].lstrip() + if file_alt.startswith(tyto.headers): file_alt = '' + except: + file_alt = '' + if not file_alt: logs.out("2", 'L=%s. "%s Alt-Text" > %s'%( ln + 2, tag, db.uri_file