sphinx“matlabdomain”扩展

sphinxcontrib-matlabdomain的Python项目详细描述


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

这个包包含matlab sphinx域和autodoc扩展。

Changes

安装

使用PipSetuptools Easy InstallPython Distributions Utilities (Distutils)

管道:

~$ pip install -U sphinxcontrib-matlabdomain

易于安装:

~$ 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

要求

这个包是Sphinx的扩展。

用法

一般情况下,用法与编写python代码的用法相同。

配置

在sphinx conf.py文件中,将sphinxcontrib.matlab添加到 分机。要使用自动文档功能,还可以添加sphinx.ext.autodoc 到扩展列表。

为了让sphinx的matlab域自动记录matlab源代码,设置 将matlab_src_dir的配置值添加到绝对路径,而不是添加 他们要sys.path。目前只能指定一个Matlab路径,但是 将搜索该树中的子文件夹。

为了方便起见primary domain 可以设置为mat

角色和指令

请看Sphinx Domainssphinx.ext.autodoc用于 关于角色和指令使用的文档。可以记录Matlab代码 使用以下角色和指令:

DirectiveMATLAB object
^{tt7}$folders, packages and namespaces
^{tt8}$
  • set folder but do not link
^{tt9}$
  • auto-document
^{tt10}$
  • reference
^{tt11}$function definition and signature
^{tt12}$
  • auto-document
^{tt13}$
  • reference
^{tt14}$script definition
^{tt15}$
  • auto-document
^{tt16}$
  • reference
^{tt17}$class definition and optional signature
^{tt18}$
  • auto-document
^{tt19}$
  • reference
^{tt20}$method definition and signature
^{tt21}$
  • auto-document
^{tt22}$
  • reference
^{tt23}$static method definition and signature
^{tt24}$
  • auto-document
^{tt22}$
  • reference
^{tt26}$property definition
^{tt27}$
  • auto-document
^{tt28}$
  • reference

有几个选项可用于自动指令。

  • :members:自动文档公共成员
  • :show-inheritance:列表基
  • :undoc-members:没有docstrings的文档成员
  • :annotation:指定属性注释而不是默认值

还可以在conf.py中设置几个配置值,它们将 影响自动记录。

  • autoclass_content可以设置为classbothinit,其中 确定将哪个docstring用于类。构造函数docstring 设置为init时使用。
  • autodoc_member_order可以设置为alphabeticalgroupwisebysource
  • autodoc_default_flags可以设置为要应用的选项列表。使用 no-flag指令选项禁用此配置值一次。

注意

模块角色和指令为Matlab创建一个psuedo命名空间 对象,类似于包。它们表示文件夹的路径 包含Matlab对象。如果未指定模块,则Sphinx将 假设对象是内置的。

示例:给定文件夹test_data中的以下Matlab源代码:

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

使用以下文档:

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:

在线演示

存储库中的测试文档位于以下位置: http://bwanamarko.alwaysdata.net/matlabdomain/

注意

sphinx样式标记用于记录参数、类型、返回和 例外情况。在 参数说明。当前只有在 它们位于属性定义后面的同一行。吸气剂和 setter方法与当前的方法类似,但dot是 替换为下划线。属性的默认值表示为 Unicode字符串,因此字符串将被双引号括起来。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java未从Facebook OAuth接收名字、姓氏和姓氏   我自己代码中的java ConcurrentModificationException   java在Android上获得单像素TIFF图像   java图形输出中的swing集成弹出窗口“通知”   将数据库表中的所有数据集插入jTable Java   java如何使用Hibernate获取不完整的集合?   打印无法从java连接到打印机   java使用分隔符拆分带引号的字符串   java Axis2禁用严格验证(wsdl2java中的Eosv)允许什么,如何使其更加严格?   java有人能帮我处理循环代码吗   java将JsonObject数组转换为整数   JavaXWiki扩展:检测事件空间创建   java如何设置图表的文本方向以使用poi旋转所有文本?   eche RecyclerView项的java Set自定义字体   java单元测试带有私有构造函数的spring组件,无需注入   用户界面如何在java中动态显示一组多个元素?   如何从java应用程序调用IDL(交互式数据语言)?   Java的内置库实现