2012-04-20 45 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. *) 
相關問題