3

我试图在 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

有没有办法引用类型构造函数,以便 ocamldoc 可以链接到相应的类型?

4

2 回答 2

4

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

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

如果你想要更精确的东西,你可以编写一个小的 ocamldoc 插件来覆盖该html_of_Ref方法。

于 2012-04-20T07:44:00.727 回答
3

AFAIK 那是不可能的。您可以在此处查看可以使用此语法进行的引用类型。但是,您可以做的是:

(** {{!x}[Awesome]} that will at least bring to {!x} by clicking on it. *)
于 2012-04-20T07:23:28.927 回答