[Examples] Remove building Matlab examples into the docs

They have moved to the new website
This commit is contained in:
Bryan W. Weber 2018-06-08 19:03:55 -04:00 committed by Ray Speth
parent 71072c43db
commit e81cac9582
4 changed files with 3 additions and 69 deletions

View file

@ -25,21 +25,6 @@ def extract_python_docstring(pyfile, summary_only=True):
return doc
def extract_matlab_summary(mfile):
""" Returns a one-line summary comment from a .m file """
doc = ''
with open(mfile) as f:
for line in f:
line = line.strip()
if line.startswith('%'):
doc = line.strip('%').strip()
if doc:
break
name = os.path.basename(mfile)[:-2].replace('_', ' ')
if doc.lower().replace('_', ' ').startswith(name):
doc = doc[len(name):].strip()
return doc
# Set up functions to pseudo-autodoc the MATLAB toolbox
def extract_matlab_docstring(mfile, level):
@ -100,9 +85,10 @@ def extract_matlab_docstring(mfile, level):
return docstring + '\n'
def get_function_name(str):
"""
Return the function or classdef signature, assuming that
Return the Matlab function or classdef signature, assuming that
the string starts with either 'function ' or 'classdef '.
"""
if str.startswith('function '):
@ -206,7 +192,7 @@ if localenv['sphinx_docs']:
# Set the title header
title = page.title
tempenv['title'] = '='*len(title) + '\n' + title + '\n' + '='*len(title)
tempenv['title'] = '='*len(title) + '\n' + title + '\n' + '='*len(title)
doc = ''
# The base directory of the MATLAB toolbox relative to the sphinx build directory
@ -246,30 +232,4 @@ if localenv['sphinx_docs']:
build(c)
localenv.Depends(sphinxdocs, c)
# Matlab examples: create individual documentation pages with the source
# for each example
examples = []
tutorials = []
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/example-script.rst.in')
build(b)
localenv.Depends(sphinxdocs, b)
summary = [':doc:`{0} <examples/{1}>`:'.format(f.name, f.name[:-2]),
extract_matlab_summary(f.abspath),
'']
if f.name.startswith('tut'):
tutorials.extend(summary)
else:
examples.extend(summary)
localenv['matlab_tutorials'] = '\n'.join(tutorials)
localenv['matlab_examples'] = '\n'.join(examples)
b = localenv.SubstFile('#doc/sphinx/matlab/examples.rst',
'#doc/sphinx/matlab/examples.rst.in')
build(b)
localenv.Depends(sphinxdocs, b)
localenv.AlwaysBuild(sphinxdocs)

View file

@ -1,9 +0,0 @@
:orphan:
.. _matlab-example-@script_name@:
@script_name@
=======================================================================
.. literalinclude:: @script_path@
:language: matlab

View file

@ -1,16 +0,0 @@
.. _sec-matlab-examples:
Index of Matlab Examples
========================
This is an index of the examples included with the Cantera Matlab Toolbox.
Tutorials
---------
@matlab_tutorials@
Examples
--------
@matlab_examples@

View file

@ -16,4 +16,3 @@ Matlab Interface User's Guide
code-docs/one-dim
code-docs/data
code-docs/utilities
examples