diff --git a/.gitignore b/.gitignore index 3b83c9748..f01b81e36 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ config.log coverage/ coverage.info doc/sphinx/cython/examples/*.rst +doc/sphinx/matlab/examples/*.rst diff --git a/doc/SConscript b/doc/SConscript index 094fde00f..8e433d840 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -34,4 +34,15 @@ if localenv['sphinx_docs']: build(b) localenv.Depends(sphinxdocs, b) + # Matlab examples: create individual documentation pages with the source + # for each example + for f in mglob(env, '#samples/matlab', 'm'): + tmpenv = env.Clone() + tmpenv['script_name'] = f.name + tmpenv['script_path'] = '../../../../samples/matlab/%s' % f.name + b = tmpenv.SubstFile('#doc/sphinx/matlab/examples/%s.rst' % f.name[:-2], + '#doc/sphinx/matlab/examples/example-script.rst.in') + build(b) + localenv.Depends(sphinxdocs, b) + localenv.AlwaysBuild(sphinxdocs) diff --git a/doc/sphinx/matlab/examples.rst b/doc/sphinx/matlab/examples.rst new file mode 100644 index 000000000..62d55ba1a --- /dev/null +++ b/doc/sphinx/matlab/examples.rst @@ -0,0 +1,23 @@ +.. _sec-cython-examples: + +.. py:currentmodule:: cantera + +Index of Examples +================= + +This is an index of the examples included with the Cantera Matlab Toolbox. + +Tutorials +--------- +.. toctree:: + :glob: + + examples/tut* + +Examples +-------- + +.. toctree:: + :glob: + + examples/[!tut]* diff --git a/doc/sphinx/matlab/examples/example-script.rst.in b/doc/sphinx/matlab/examples/example-script.rst.in new file mode 100644 index 000000000..861ebd7f8 --- /dev/null +++ b/doc/sphinx/matlab/examples/example-script.rst.in @@ -0,0 +1,5 @@ +@script_name@ +======================================================================= + +.. literalinclude:: @script_path@ + :language: matlab diff --git a/doc/sphinx/matlab/index.rst b/doc/sphinx/matlab/index.rst index 1758e0a60..dea27c75c 100644 --- a/doc/sphinx/matlab/index.rst +++ b/doc/sphinx/matlab/index.rst @@ -7,3 +7,4 @@ Matlab Interface User's Guide :maxdepth: 2 input-tutorial + examples