ocamldoc可以引用类型构造函数吗?

时间:2012-04-20 01:55:17

标签: ocaml documentation-generation 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

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

2 个答案:

答案 0 :(得分:4)

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

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

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

答案 1 :(得分:3)

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

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