Sphinx HTML文档生成器:在一个HTML文件中复制类属性

时间:2012-05-09 15:16:43

标签: python html documentation documentation-generation python-sphinx

我正在帮助使用sphinx记录软件项目。我们想在一个HTML文件中覆盖所有13个类。它很方便。

我的问题:有些类具有相同名称的属性(请参阅下面两个类中的'width'和'weight')。 在生成的HTML doc文件中,单击属性“width”将始终跳转到HTML anchor'#width',无论我正在查看哪个类。

有没有办法让sphinx生成唯一的锚名称?

:mod:`GSFontMaster`
===============================================================================

Implementation of the master object. This corresponds more or less with the "Masters" pane in the Font Info.

In Glyphs.app the glyphs of each master are reachable not here, but as :class:`Layers <GSLayer>` attached to the :class:`Glyphs <GSGlyph>` attached to the :class:`Font <GSFont>` object. See info graphic on top for better understanding.

.. class:: GSFontMaster

.. autosummary::

    name
    id
    weight
    width
    weightValue
    widthValue
    custom
    customValue
    ascender
    capHeight
    xHeight
    descender
    italicAngle
    verticalStems
    horizontalStems
    alignmentZones
    guideLines
    userData
    customParameters

----------
Properties
----------

.. attribute:: id

    Used to identify :class:`GSLayer <Layer>` in the Glyph

    :type: unicode

.. attribute:: name

    :type: string

.. attribute:: weight

    :type: string

.. attribute:: width

    :type: string

.. attribute:: weightValue

    Values for interpolation in design space.

    :type: float

.. attribute:: widthValue

    Values for interpolation in design space.

    :type: float

.. attribute:: custom

    :type: string

.. attribute:: customValue

    Values for interpolation in design space.

.. attribute:: ascender

    :type: float

.. attribute:: capHeight

    :type: float

.. attribute:: xHeight

    :type: float

.. attribute:: descender

    :type: float

.. attribute:: italicAngle

    :type: float

.. attribute:: verticalStems

    List of vertical stem values

    :type: list

.. attribute:: horizontalStems

    List of horizontal stem values

    :type: list

.. attribute:: alignmentZones

    Collection of :class:`GSAlignmentZone <GSAlignmentZone>`.

    :type: list

.. attribute:: guideLines

    Collection of :class:`GSGuideLine <GSGuideLine>`.

    :type: list

.. attribute:: userData

    A dictionary to store user data. Use a unique Key and only use object that can be stored in a Property list (string, list, dict, numbers, NSData) otherwise the date will not be recoverable from the saved file.

    :type: dict

.. attribute:: customParameters

    A dictionary of custom parameters

    :type: dict



:mod:`GSInstance`
===============================================================================

Implementation of the instance object. This corresponds more or less with the "Instances" pane in the Font Info.

.. class:: GSInstance

.. autosummary::

    active
    name
    weight
    width
    weightValue
    widthValue
    isItalic
    isBold
    linkStyle
    customParameters

----------
Properties
----------

.. attribute:: active

    :type: bool

.. attribute:: name

    :type: string

.. attribute:: weight

    :type: string

.. attribute:: width

    :type: string

.. attribute:: weightValue

    Values for interpolation in design space.

    :type: float

.. attribute:: widthValue

    Values for interpolation in design space.

    :type: float

.. attribute:: isItalic

    Italic flag for style linking

    :type: bool

.. attribute:: isBold

    Bold flag for style linking

    :type: bool

.. attribute:: linkStyle

    Linked style

    :type: string

.. attribute:: customParameters

    A dictionary of custom parameters

    :type: dict

1 个答案:

答案 0 :(得分:0)

您必须添加类名:因此width的{​​{1}}属性应如下所示:

GSFontMaster

(自动分子录入必须根据完整的属性名称进行调整。)