aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2019-04-11 18:42:34 -0700
committerBryan Newbold <bnewbold@archive.org>2019-04-11 18:42:34 -0700
commit3eaf3739ab959b48624b61ebe0c2ade761aa9662 (patch)
tree03127493f8699a2f0d09bc6d66c7f69cb6c814ab
parentf91aa887de7c86248cf1bcecf1879f891f4b38ab (diff)
downloadsqlite-notebook-3eaf3739ab959b48624b61ebe0c2ade761aa9662.tar.gz
sqlite-notebook-3eaf3739ab959b48624b61ebe0c2ade761aa9662.zip
add support for PMC identifiers (like DOI) and ftp://
-rwxr-xr-xsqlite-notebook.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sqlite-notebook.py b/sqlite-notebook.py
index 3c9e72c..7f83f61 100755
--- a/sqlite-notebook.py
+++ b/sqlite-notebook.py
@@ -36,10 +36,12 @@ class SqliteMarkdownRenderer(mistune.Renderer):
for v in row:
if v is None:
v = ''
- if type(v) == str and (v.startswith("https://") or v.startswith("http://")):
+ if type(v) == str and (v.startswith("https://") or v.startswith("http://") or v.startswith("ftp://")):
ret += ' <td><a href="{}">{}</a></td>\n'.format(v, v)
elif type(v) == str and v.startswith("10."):
ret += ' <td><a href="https://doi.org/{}">{}</a></td>\n'.format(v, v)
+ elif type(v) == str and v.startswith("PMC") and v[3:].isdigit():
+ ret += ' <td><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/{}">{}</a></td>\n'.format(v, v)
else:
ret += ' <td>{}</td>\n'.format(v)
ret += "</tr>\n"