2010-08-18 98 views
0

我正在使用epydoc的reStructuredText。我如何让内部链接的文本与链接的目标不同?我有:epydoc和reStructuredText更改链接名称

:todo: Figure out the `Product.manufacturer` relationship in `Product`. 

产品链接看起来不错,并链接到产品对象。 Product.manufacturer链接转到正确的成员变量,而不是文本是Product.manufacturer,我想只是制造商。

我知道如果我使用epytext可以做到这一点,但是我们希望坚持使用reStructuredText,以便我们可以在以后切换文档生成器。

回答

0

我不熟悉epydoc的自己,但正常的新结构化的方法是这样的:

`manufacturer <Product.manufacturer>`_ 

或者与狮身人面像,

:attribute:`manufacturer <Product.manufacturer>` 

考虑到epydoc的似乎已经覆盖默认提供链接的角色,它将留给它。然而,这是最有可能的工作:

:todo: Figure out the `manufacturer <Product.manufacturer>` relationship in `Product`. 
+0

可惜这只是指向实际的URL ../Product.manufacturer,而不是插入页面的位置该对象 – lost 2013-02-07 12:21:30

+0

@lost:你这样做在普通的reStructuredText中,作为'\'制造商 \'_'(注意尾部下划线),还是没有下划线(因此使它成为“默认角色”)?前者会像你所描述的那样工作,而听起来后者应该起作用。 – 2013-02-07 18:24:45

+0

啊,我是用epydoc的_做的。然而,在epydoc中,编写'store()'只会在输出(固定宽度的字体)中生成“store()”和一个“failed identifier crossreference目标“警告”store()< baseplot.BasePlot.store()>“ – lost 2013-02-08 14:43:46