Skip to content

Commit d21b1f8

Browse files
committed
add auto footer with license and citation
1 parent 18d89a9 commit d21b1f8

File tree

6 files changed

+71
-18
lines changed

6 files changed

+71
-18
lines changed

_templates/page.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,20 @@
66
{% endif %}
77

88
{{ body }}
9+
10+
<!-- continuation of examples/page_footer.md -->
11+
{% if pagename in ablog %}
12+
<ul>
13+
<li>
14+
{% for coll in post.author %}
15+
{% if coll|length %}
16+
{{ coll }}
17+
{% if loop.index < post.author|length %},{% endif %}
18+
{% else %}
19+
{{ coll }}
20+
{% if loop.index < post.author|length %},{% endif %}
21+
{% endif %}
22+
{% endfor %}. "{{ title.split(' — ')[0] }}". In: <i>PyMC Examples</i>. DOI: <a href={{ doi_url }}>{{ doi_code }}</a></li>
23+
</ul>
24+
{% endif %}
925
{% endblock %}

_templates/postcard.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
<h3>Notebook metadata</h3>
55

66
<ul>
7-
{% if post.author %}
8-
<li id="author">
9-
<span><i class="fa-fw fa fa-user"></i></span>
10-
<a href="#authors">{% for coll in post.author %} {% if coll|length %}
11-
{{ coll }}{% if loop.index <
12-
post.author|length %},{% endif %} {% else %}{{ coll }}{% if loop.index <
13-
post.author|length %},{% endif %}{% endif %} {% endfor %}
14-
</a>
15-
</li>
16-
{% endif %}
177
{% if post.category %}
188
<li id="category">
199
<span><i class="fa-fw fa fa-folder-open"></i></span>

examples/conf.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import os
22

3-
43
# -- Project information -----------------------------------------------------
54
project = "PyMC"
65
copyright = "2021, PyMC Community"
76
author = "PyMC Community"
87

9-
108
# -- General configuration ---------------------------------------------------
119

1210
# Add any Sphinx extension module names here, as strings. They can be
@@ -110,7 +108,7 @@
110108
# post_auto_excerpt = 2
111109

112110
# MyST config
113-
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath"]
111+
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath", "substitution"]
114112
jupyter_execute_notebooks = "off"
115113

116114
# bibtex config
@@ -136,10 +134,10 @@ def ipython_cell_transform(source):
136134
"ipython3": ipython_cell_transform,
137135
}
138136
codeautolink_autodoc_inject = False
139-
codeautolink_global_preface = """
140-
import arviz as az
141-
import pymc3 as pm
142-
"""
137+
# codeautolink_global_preface = """
138+
# import arviz as az
139+
# import pymc3 as pm
140+
# """
143141

144142
# intersphinx mappings
145143
intersphinx_mapping = {

examples/getting_started.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3821,6 +3821,14 @@
38213821
"%load_ext watermark\n",
38223822
"%watermark -n -u -v -iv -w"
38233823
]
3824+
},
3825+
{
3826+
"cell_type": "markdown",
3827+
"metadata": {},
3828+
"source": [
3829+
":::{include} page_footer.md\n",
3830+
":::"
3831+
]
38243832
}
38253833
],
38263834
"metadata": {

examples/page_footer.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## License notice
2+
All the notebooks in this example gallery are provided under the
3+
[MIT License](https://github.com/pymc-devs/pymc-examples/blob/main/LICENSE)
4+
which allows modification, and redistribution for any
5+
use provided the copyright and license notices are preserved.
6+
7+
## Citing PyMC examples
8+
9+
To cite this notebook, use the DOI provided by Zenodo for the pymc-examples repository.
10+
Here is an citation template in bibtex:
11+
12+
```bibtex
13+
@incollection{citekey,
14+
author = "<notebook authors, see above>"
15+
title = "<notebook title>",
16+
booktitle = "PyMC examples",
17+
doi = "<doi_code>"
18+
}
19+
```
20+
21+
which once rendered could look like:
22+
23+
<!-- continues in _templates/page.html!!! -->
24+
<!-- I wanted to get some kind of automatation to the process,
25+
and html templates have access to many variables that are not available
26+
from jinja-myst -->

examples/splines/spline.ipynb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,21 @@
15311531
"%load_ext watermark\n",
15321532
"%watermark -n -u -v -iv -w -p theano,xarray,patsy"
15331533
]
1534+
},
1535+
{
1536+
"cell_type": "markdown",
1537+
"metadata": {},
1538+
"source": [
1539+
":::{include} ../page_footer.md\n",
1540+
":::"
1541+
]
1542+
},
1543+
{
1544+
"cell_type": "code",
1545+
"execution_count": null,
1546+
"metadata": {},
1547+
"outputs": [],
1548+
"source": []
15341549
}
15351550
],
15361551
"metadata": {
@@ -1549,7 +1564,7 @@
15491564
"name": "python",
15501565
"nbconvert_exporter": "python",
15511566
"pygments_lexer": "ipython3",
1552-
"version": "3.8.6"
1567+
"version": "3.9.7"
15531568
}
15541569
},
15551570
"nbformat": 4,

0 commit comments

Comments
 (0)