Commit 24df3ad7 authored by Martin Larralde's avatar Martin Larralde
Browse files

Use `sphinx.ext.extlinks` to provide publication links via DOI and PMID

parent 6f0ebead
......@@ -107,7 +107,8 @@ The original R `Peptides` package was written by [Daniel Osorio](https://orcid.o
[Paola Rondón-Villarreal](https://orcid.org/0000-0001-8209-3885) and
[Rodrigo Torres](https://orcid.org/0000-0003-1113-3020), and is licensed under
the terms of the [GNU General Public License v2.0](https://choosealicense.com/licenses/gpl-2.0/).
The [EMBOSS] applications are released under the [GNU General Public License v1.0](https://www.gnu.org/licenses/old-licenses/gpl-1.0.html).
The [EMBOSS](http://emboss.bioinformatics.nl/cgi-bin/emboss/) applications are
released under the [GNU General Public License v1.0](https://www.gnu.org/licenses/old-licenses/gpl-1.0.html).
*This project is in no way not affiliated, sponsored, or otherwise endorsed
by the [original `Peptides` authors](https://github.com/dosorio). It was developed
......
......@@ -33,7 +33,37 @@ sys.modules['peptides.tables'] = types.ModuleType('peptides.tables')
# -- Sphinx Setup ------------------------------------------------------------
# import docutils.nodes
# import docutils.utils
# import sphinx.transforms
#
# def doi_role(role, rawtext, text, lineno, inliner, options=None, content=None):
# node = docutils.nodes.reference(
# rawtext,
# "doi:{}".format(docutils.utils.unescape(text)),
# refuri="https://doi.org/{}".format(text),
# )
# return [node], []
#
# def pmid_role(row, rawtext, text, lineno, inliner, options=None, content=None):
# try:
# pmid = int(text)
# except ValueError:
# msg = inliner.reporter.error("Invalid PMID: {!r}".format(text), line=lineno)
# prb = inliner.problematic(rawtext, rawtext, msg)
# return [prb], [msg]
# node = docutils.nodes.reference(
# rawtext,
# "PMID:{}".format(pmid),
# refuri="https://pubmed.ncbi.nlm.nih.gov/{}".format(pmid),
# )
# return [node], []
#
def setup(app):
# Add roles for DOI and PMID
# app.add_role("doi", doi_role)
# app.add_role("pmid", pmid_role)
# Add custom stylesheet
app.add_css_file(os.path.join("_static/css/main.css"))
# app.add_js_file("js/apitoc.js")
......@@ -88,6 +118,7 @@ extensions = [
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.todo",
"sphinx.ext.extlinks",
"sphinx_bootstrap_theme",
"recommonmark",
]
......@@ -173,6 +204,14 @@ htmlhelp_basename = peptides.__name__
# -- Extension configuration -------------------------------------------------
# -- Options for extlinks extension ------------------------------------------
extlinks = {
'doi': ('https://doi.org/%s', 'doi:%s'),
'pmid': ('https://pubmed.ncbi.nlm.nih.gov/%s', 'PMID:%s'),
}
# -- Options for imgmath extension -------------------------------------------
imgmath_image_format = "svg"
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment