From 11bb09b0f1710d656e4463f31bd42899ff55cf91 Mon Sep 17 00:00:00 2001 From: James Hiebert Date: Tue, 25 Apr 2023 12:48:37 -0600 Subject: [PATCH 1/2] Configure docs to parametrize pyodide version --- docs/conf.py | 5 +++++ docs/tutorials/py-config-interpreter.md | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 872b204f908..64469985e78 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -105,4 +105,9 @@ "colon_fence", "smartquotes", "replacements", + "substitution", ] + +myst_substitutions = { + "v_pyodide": "0.22.0a3", +} diff --git a/docs/tutorials/py-config-interpreter.md b/docs/tutorials/py-config-interpreter.md index bfe06de3642..9d083bc40df 100644 --- a/docs/tutorials/py-config-interpreter.md +++ b/docs/tutorials/py-config-interpreter.md @@ -25,7 +25,7 @@ To get started, let's create a new `index.html` file and import `pyscript.js`. ``` -We are using the pyodide CDN to setup our interpreter, but you can also download the files from [the pyodide GitHub release](https://github.com/pyodide/pyodide/releases/tag/0.22.0a3), unzip them and use the `pyodide.js` file as your interpreter. +We are using the pyodide CDN to setup our interpreter, but you can also download the files from {{ '[the pyodide GitHub release](https://github.com/pyodide/pyodide/releases/tag/{})'.format(v_pyodide) }}, unzip them and use the `pyodide.js` file as your interpreter. ## Setting the interpreter @@ -47,8 +47,8 @@ To set the interpreter, you can use the `interpreter` configuration in the `py-c [[interpreters]] - src = "https://cdn.jsdelivr.net/pyodide/v0.22.0a3/full/pyodide.js" - name = "pyodide-0.22.0a3" + src = "https://cdn.jsdelivr.net/pyodide/v{{ v_pyodide }}/full/pyodide.js" + name = "pyodide-{{ v_pyodide }}" lang = "python" From 2f9590c3002b5999f68842a4aae5a274eb16a34b Mon Sep 17 00:00:00 2001 From: James Hiebert Date: Tue, 25 Apr 2023 12:53:05 -0600 Subject: [PATCH 2/2] Attempt to use pyodide version w/in code blocks According to the docs, MyST substutitions don't work w/in code blocks, so this doesn't actually work (but demonstrates the problem). https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#substitutions-with-jinja2 --- docs/tutorials/py-config-interpreter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/py-config-interpreter.md b/docs/tutorials/py-config-interpreter.md index 9d083bc40df..dec930cc827 100644 --- a/docs/tutorials/py-config-interpreter.md +++ b/docs/tutorials/py-config-interpreter.md @@ -75,8 +75,8 @@ To confirm that the interpreter is set correctly, you can open the DevTools and [[interpreters]] - src = "https://cdn.jsdelivr.net/pyodide/v0.22.0a3/full/pyodide.js" - name = "pyodide-0.22.0a3" + src = "https://cdn.jsdelivr.net/pyodide/v{{ v_pyodide }}/full/pyodide.js" + name = "pyodide-{{ v_pyodide }}}" lang = "python"