INNER CODE UNIT · Python
main
awesome-android-root/awesome-android-root · scripts/check_links.py:82
def main():
files = sorted(glob.glob(os.path.join(DOCS, '**', '*.md'), recursive=True))
errors = []
checked = 0
for f in files:
rel = os.path.relpath(f, DOCS).replace(os.sep, '/')
text = open(f, encoding='utf-8').read()
ids = heading_ids(text)
dirn = os.path.dirname(f)
for m in re.finditer(r'(?<!!)\[([^\]]*)\]\(([^)\s]+?)(?:\s+["\'][^)]*?["\'])?\)', strip_code(text)):
dest = m.group(2)
label = m.group(1)
checked += 1
if dest.startswith(('http://', 'https://', 'mailto:', 'tel:', '//', 'data:')):
continue
if dest.startswith('#'):
anchor = dest[1:]
if anchor and anchor not in ids: