Skip to main content

Sphinx "matlabdomain" extension

Project description

https://travis-ci.org/sphinx-contrib/matlabdomain.svg?branch=master

This package contains the MATLAB Sphinx domain and autodoc extensions.

Changes

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

  • set folder but do not link

.. automodule:: foldername

  • auto-document

:mod:`foldername`

  • reference

.. function:: funcname

function definition and signature

.. autofunction:: funcname()

  • auto-document

:func:`funcname`

  • reference

.. class:: classname()

class definition and optional signature

.. autoclass:: classname

  • auto-document

:class:`classname`

  • reference

.. method:: methname()

method definition and signature

.. automethod:: methname

  • auto-document

:meth:`methname`

  • reference

.. staticmethod:: statmethname()

static method definition and signature

.. automethod:: statmethname

  • auto-document

:meth:`methname`

  • reference

.. attribute:: attrname

property definition

.. autoattribute:: attrname

  • auto-document

:attr:`attrname`

  • reference

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

sphinxcontrib-matlabdomain-0.3.1.tar.gz (33.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sphinxcontrib_matlabdomain-0.3.1-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

sphinxcontrib_matlabdomain-0.3.1-py2-none-any.whl (31.5 kB view details)

Uploaded Python 2

File details

Details for the file sphinxcontrib-matlabdomain-0.3.1.tar.gz.

File metadata

File hashes

Hashes for sphinxcontrib-matlabdomain-0.3.1.tar.gz
Algorithm Hash digest
SHA256 cc4d836ec232b0c2aac707ff23706e7afb5deab86b8fbe045cbe43fd1f43e1a5
MD5 ee0b5687b786a0ba7ec499c97be18c2f
BLAKE2b-256 4650ca4c5301d2b74be31be6d00f6f72e2956a59ab3df221ea0855dbf10da544

See more details on using hashes here.

File details

Details for the file sphinxcontrib_matlabdomain-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinxcontrib_matlabdomain-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80a46b56a03be4fc56776c2c8d441c941b3cfb84a4ce8ae2858aada9c50b42f4
MD5 5b29e2df59fb0cb786bcad7b7d20bbb6
BLAKE2b-256 d7405a856c9caacf7f5d3d5b4ab200d256f58c318bf61ad3cabd5f59b7d6d9b3

See more details on using hashes here.

File details

Details for the file sphinxcontrib_matlabdomain-0.3.1-py2-none-any.whl.

File metadata

File hashes

Hashes for sphinxcontrib_matlabdomain-0.3.1-py2-none-any.whl
Algorithm Hash digest
SHA256 f1bd2ef80a5219bd7521769ceb102308ab3d2ddb59c7c9ca2a34277feb43c98e
MD5 9bf7edf551ed6141d2a56f9dfae95a95
BLAKE2b-256 3a8a92954adb4c20e089f12dd4763bad60ea25d7f1c777b2cc6920c621a35f84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page