Skip to content

Commit

Permalink
Hot-fix for matlab_src_dir relative path. (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeced authored Dec 17, 2023
1 parent 65ccd09 commit 2fc26b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
sphinxcontrib-matlabdomain-0.21.2 (2023-12-17)
==============================================

* Interpret ``matlab_src_dir`` relative to the Sphinx source directory to be
compatible with `sphinx-multiversion`_.

.. _sphinx-multiversion: https://pypi.org/project/sphinx-multiversion/


sphinxcontrib-matlabdomain-0.21.1 (2023-12-16)
==============================================

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Additional Configuration
``matlab_src_dir``
In order for the Sphinx MATLAB domain to auto-document MATLAB source code,
set the config value of ``matlab_src_dir`` to an absolute path or a path
relative to the ``conf.py`` file. Currently only one MATLAB path can be
relative to the source directory. Currently only one MATLAB path can be
specified, but that folder and all the subfolders in that tree will be
searched.

Expand Down
6 changes: 4 additions & 2 deletions sphinxcontrib/mat_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ def analyze(app):
)
return

# Interpret `matlab_src_dir` relative to the `conf.py` file.
basedir = os.path.normpath(os.path.join(app.confdir, app.env.config.matlab_src_dir))
# Interpret `matlab_src_dir` relative to the sphinx source directory.
basedir = os.path.normpath(
os.path.join(app.env.srcdir, app.env.config.matlab_src_dir)
)
MatObject.basedir = basedir # set MatObject base directory
MatObject.sphinx_env = app.env # pass env to MatObject cls
MatObject.sphinx_app = app # pass app to MatObject cls
Expand Down

0 comments on commit 2fc26b2

Please sign in to comment.