Skip to content

Commit

Permalink
allow retrieving doi code from rtd (pymc-devs#269)
Browse files Browse the repository at this point in the history
* allow retrieving doi code from rtd

* update page_footer

* rename env var to something allowed
  • Loading branch information
OriolAbril authored Jan 10, 2022
1 parent 7af5789 commit e927d9e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
21 changes: 18 additions & 3 deletions examples/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@
"page_sidebar_items": ["postcard", "page-toc", "edit-this-page"],
}
version = os.environ.get("READTHEDOCS_VERSION", "")
version = version if "-" in version else "main"
version = version if "." in version else "main"
doi_code = os.environ.get("DOI_READTHEDOCS", "10.5281/zenodo.5654871")
html_context = {
"github_url": "https://github.com",
"github_user": "pymc-devs",
"github_repo": "pymc-examples",
"github_version": version,
"doc_path": "examples/",
"sandbox_repo": f"pymc-devs/pymc-sandbox/{version}",
"doi_url": "https://doi.org/10.5281/zenodo.5654871",
"doi_code": "10.5281/zenodo.5654871",
"doi_url": f"https://doi.org/{doi_code}",
"doi_code": doi_code,
}


Expand Down Expand Up @@ -117,10 +118,24 @@

# MyST config
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath", "substitution"]
citation_code = f"""
```bibtex
@incollection{{citekey,
author = "<notebook authors, see above>"
title = "<notebook title>",
editor = "PyMC Team",
booktitle = "PyMC examples",
doi = "{doi_code}"
}}
```
"""


myst_substitutions = {
"pip_dependencies": "{{ extra_dependencies }}",
"conda_dependencies": "{{ extra_dependencies }}",
"extra_install_notes": "",
"citation_code": citation_code,
}
jupyter_execute_notebooks = "off"

Expand Down
10 changes: 1 addition & 9 deletions examples/page_footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ Also remember to cite the relevant libraries used by your code.

Here is an citation template in bibtex:

```bibtex
@incollection{citekey,
author = "<notebook authors, see above>"
title = "<notebook title>",
editor = "PyMC Team",
booktitle = "PyMC examples",
doi = "10.5281/zenodo.5654871"
}
```
{{ citation_code }}

which once rendered could look like:

Expand Down

0 comments on commit e927d9e

Please sign in to comment.