Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python example location #219

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@
# the site. The format is a dictionary of {source: relative destination}.
# Default is:
EXAMPLES_FOLDERS = {
"../cantera/interfaces/cython/cantera/examples": "examples/python",
# "../cantera/samples/python": "examples/python", # starting with Cantera 3.0
"../cantera/interfaces/cython/cantera/examples": "examples/python", # Cantera 2.6
"../cantera-jupyter": "examples/jupyter",
"../cantera/samples/matlab": "examples/matlab",
"../cantera/samples/cxx": "examples/cxx",
Expand Down
2 changes: 1 addition & 1 deletion plugins/render_matlab_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
dictionary has keys with the source folder and values with the destination
folder (relative to the ``OUTPUT_FOLDER``). The relevant source folder is found
as the key associated with the value that contains the string ``matlab``,
typically ``"../cantera/interfaces/cython/cantera/examples": "examples/python"``.
typically ``"../cantera/samples/matlab": "examples/matlab"``.
"""
from pathlib import Path

Expand Down
8 changes: 4 additions & 4 deletions plugins/render_python_examples.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Render the Matlab examples from the Cantera repository into Nikola listings.
"""Render the Python examples from the Cantera repository into Nikola listings.

This plugin renders Matlab examples from the main Cantera repository into the
This plugin renders Python examples from the main Cantera repository into the
examples/matlab output folder. It looks for the examples in the folder configured
in the top-level conf.py file in the ``EXAMPLES_FOLDERS`` dictionary. That
dictionary has keys with the source folder and values with the destination
folder (relative to the ``OUTPUT_FOLDER``). The relevant source folder is found
as the key associated with the value that contains the string ``matlab``,
typically ``"../cantera/samples/matlab": "examples/matlab"``.
as the key associated with the value that contains the string ``python``,
typically ``"../cantera/samples/python": "examples/python"``.
"""
from pathlib import Path
import ast
Expand Down
10 changes: 3 additions & 7 deletions themes/cantera/templates/python-example-index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
{% block content %}
<h2 class="display-3">Index of Python Examples</h2>

<p>This is an index of the examples included with the Cantera Python module. They
can be found in the <code style="display: inline;">examples</code> subdirectory of the Cantera Python module's
installation directory. To determine the location of this directory, run the following in your Python interpreter:</p>
<p>This is an index of Python examples included with Cantera.</p>

<pre class="code python">
<span class="kn">import</span> <span class="nn">cantera</span><span class="o">.</span><span class="nn">examples</span>
<span class="k">print</span><span class="p">(</span><span class="n">cantera</span><span class="o">.</span><span class="n">examples</span><span class="o">.</span><span class="n">__path__</span><span class="p">)</span>
</pre>
<p>Cantera's Python examples can be downloaded by clicking the "Source" link at the top
of each example page.</p>

<h3>Table of Contents</h3>
<ul>
Expand Down