Sphinx "matlabdomain" extension
Project description
This package contains the MATLAB Sphinx domain and autodoc extensions.
Installation
Use Pip, Setuptools Easy Install or Python Distributions Utilities (Distutils).
Pip:
~$ pip install -U sphinxcontrib-matlabdomain
Easy Install:
~$ easy_install -U sphinxcontrib-matlabdomain
Distutils:
~/downloads$ curl https://pypi.python.org/packages/source/s/sphinxcontrib-matlabdomain/sphinxcontrib-matlabdomain-0.X.tar.gz ~/downloads$ tar -xf sphinxcontrib-matlabdomain-0.X.tar.gz ~/downloads$ cd sphinxcontrib_matlabdomain-0.X ~/downloads/sphinxcontrib_matlabdomain-0.X$ python setup.py install
Requirements
This package is an extension to Sphinx.
Usage
In general usage is the same as for documenting Python code.
Configuration
In your Sphinx conf.py file add sphinxcontrib.matlab to the list of extensions. To use auto-documentation features, also add sphinx.ext.autodoc to the list of extensions.
In order for the Sphinx MATLAB domain to auto-document MATLAB source code, set the config value of matlab_src_dir to the absolute path instead of adding them to sys.path. Currently only one MATLAB path can be specified, but all subfolders in that tree will be searched.
For convenience the primary domain can be set to mat.
Roles and Directives
Please see Sphinx Domains and sphinx.ext.autodoc for documentation on the use of roles and directives. MATLAB code can be documented using the following roles and directives:
Directive |
MATLAB object |
---|---|
.. module:: foldername |
folders, packages and namespaces |
.. curremtmodule:: foldername |
|
.. automodule:: foldername |
|
:mod:`foldername` |
|
.. function:: funcname |
function definition and signature |
.. autofunction:: funcname() |
|
:func:`funcname` |
|
.. class:: classname() |
class definition and optional signature |
.. autoclass:: classname |
|
:class:`classname` |
|
.. method:: methname() |
method definition and signature |
.. automethod:: methname |
|
:meth:`methname` |
|
.. staticmethod:: statmethname() |
static method definition and signature |
.. automethod:: statmethname |
|
:meth:`methname` |
|
.. attribute:: attrname |
property definition |
.. autoattribute:: attrname |
|
:attr:`attrname` |
|
Several options are available for auto-directives.
:members: auto-document public members
:show-inheritance: list bases
:undoc-members: document members without docstrings
:annotation: specifies attribute annotation instead of default
There are also several config values that can be set in conf.py that will affect auto-docementation.
autoclass_content can be set to class, both or init, which determines which docstring is used for classes. The constructor docstring is used when this is set to init.
autodoc_member_order can be set to alphabetical, groupwise or bysource.
autodoc_default_flags can be set to a list of options to apply. Use the no-flag directive option to disable this config value once.
Example: given the following MATLAB source in folder test_data:
classdef MyHandleClass < handle & my.super.Class % a handle class % % :param x: a variable %% some comments properties x % a property end methods function h = MyHandleClass(x) h.x = x end function x = get.x(obj) % how is this displayed? x = obj.x end end methods (Static) function w = my_static_function(z) % A static function in :class:`MyHandleClass`. % % :param z: input z % :returns: w w = z end end end
Use the following to document:
Test Data ========= This is the test data module. .. automodule:: test_data :mod:`test_data` is a really cool module. My Handle Class --------------- This is the handle class definition. .. autoclass:: MyHandleClass :show-inheritance: :members:
Online Demo
The test docs in the repository are online here: http://bwanamarko.alwaysdata.net/matlabdomain/
Users
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file sphinxcontrib-matlabdomain-0.2.9.dev20171123.tar.gz
.
File metadata
- Download URL: sphinxcontrib-matlabdomain-0.2.9.dev20171123.tar.gz
- Upload date:
- Size: 31.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a4f9db1dcd08f17d646e1c475f72328e3cffd8fec86be2c44e74dc0b90eee7b |
|
MD5 | a10706db44a34696b767020e0738ccc3 |
|
BLAKE2b-256 | a6379ff18b65a79c64e9febbcfb7cc8099fd8b30f953116b36bdc0f9a6a6ebb3 |
File details
Details for the file sphinxcontrib_matlabdomain-0.2.9.dev20171123-py3-none-any.whl
.
File metadata
- Download URL: sphinxcontrib_matlabdomain-0.2.9.dev20171123-py3-none-any.whl
- Upload date:
- Size: 34.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c60478f810fec2ac7d91b7ffef2657ec57dc81e038c52483b132961ffa42a662 |
|
MD5 | b1ff4d9f3a22ddeed04e6d660f797543 |
|
BLAKE2b-256 | aca36da6c44a10680b4457be710bb8f46d5bafca0b2bd2666c437d2a72d68cfe |
File details
Details for the file sphinxcontrib_matlabdomain-0.2.9.dev20171123-py2-none-any.whl
.
File metadata
- Download URL: sphinxcontrib_matlabdomain-0.2.9.dev20171123-py2-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4fd4bfb3b9c89ac8dd1f1a00dd6e99b2e572321134a45495a6637c8f1edaba5 |
|
MD5 | a3e9b4e033c25de86bfc6a2ea048a3c7 |
|
BLAKE2b-256 | d26df08bc8c256f0f615d4f365407193a261e69ddc5f49a6b1e34ad9924b2aa4 |