Some hacks on top of an upstream example script I found.
This commit is contained in:
parent
9940de3bde
commit
0c53f82635
1 changed files with 4 additions and 2 deletions
|
@ -29,11 +29,13 @@ for (text, link) in find_md_links(body_markdown):
|
||||||
errMsg = None
|
errMsg = None
|
||||||
if not re.match(r'^(mailto|http|ftp|#)', link, re.IGNORECASE):
|
if not re.match(r'^(mailto|http|ftp|#)', link, re.IGNORECASE):
|
||||||
path = Path(link)
|
path = Path(link)
|
||||||
if not path.is_file():
|
if not path.is_file() and not path.is_dir():
|
||||||
errMsg = "local file by that name does not exist for relative file link"
|
errMsg = "local file by that name does not exist for relative file link"
|
||||||
|
else:
|
||||||
|
print(path)
|
||||||
# FIXME: test other types of links
|
# FIXME: test other types of links
|
||||||
if errMsg:
|
if errMsg:
|
||||||
print("Bad link of \"%s\" (labeled as \"%s\") has error: %s" % (link, text, errMsg))
|
print("# Bad link of \"%s\" (labeled as \"%s\") has error: %s" % (link, text, errMsg))
|
||||||
|
|
||||||
exit(0)
|
exit(0)
|
||||||
# Below doesn't work, didn't have time to find out why
|
# Below doesn't work, didn't have time to find out why
|
||||||
|
|
Loading…
Add table
Reference in a new issue