2012-04-20 81 views
3

我想在ocamldoc中引用一个类型构造函数。可以使用ocamldoc引用类型构造函数吗?

例如:

type x = Awesome | Boring 

后来我们想引用一个构造函数的一些文档:

(** {!Awesome} is a really great constructor for {!x}. You should definitely use it instead of {!Boring}. *) 

ocamldoc抱怨:

Warning: Element Awesome not found 
Warning: Element Boring not found 

是否有办法引用类型的构造函数,使oca​​mldoc可以链接到相应的类型?

回答

4

你不能直接交叉链接到一个类型构造函数。但是,您可以链接到类型本身:

(** {{!x}Awesome} is a really great constructor for {!x}. *) 

如果你想有一些更精确,你可以写一个小ocamldoc插件覆盖html_of_Ref方法。

3

AFAIK这是不可能的。您可以看到可以使用此语法here进行的引用类型。但是你可以做的是:

(** {{!x}[Awesome]} that will at least bring to {!x} by clicking on it. *) 
相关问题