INNER CODE UNIT · Python

find_target

awesome-android-root/awesome-android-root · scripts/check_links.py:58

def find_target(path, dirn):
    """Resolve an in-doc link target to a file path."""
    if path.startswith('/'):
        if path.endswith('/'):
            return os.path.join(DOCS, path.lstrip('/'), 'index.md')
        p = path.lstrip('/')
        cand = os.path.join(DOCS, p)
        if os.path.isfile(cand):
            return cand
        for ext in ('', '.md', '/index.md'):
            c = cand + ext
            if os.path.isfile(c):
                return c
        return None
    base = os.path.normpath(os.path.join(dirn, path))
    if os.path.isfile(base):
        return base
    for ext in ('', '.md', '/index.md', '/index.html'):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…