summaryrefslogtreecommitdiffstats
path: root/ocamldoc/odoc_text.ml
diff options
context:
space:
mode:
authorMaxence Guesdon <maxence.guesdon@inria.fr>2009-12-18 11:52:23 +0000
committerMaxence Guesdon <maxence.guesdon@inria.fr>2009-12-18 11:52:23 +0000
commite904577b6b0e68911c9169eb7c1629f6f3b9534c (patch)
treefb7538d389604e899974c0d4b2004d09a76fa7d5 /ocamldoc/odoc_text.ml
parent758e4cd86078a89af5790872f9704c5ea019b4e7 (diff)
PR#4914: ability to specify a text for links to elements
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9477 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'ocamldoc/odoc_text.ml')
-rw-r--r--ocamldoc/odoc_text.ml45
1 files changed, 27 insertions, 18 deletions
diff --git a/ocamldoc/odoc_text.ml b/ocamldoc/odoc_text.ml
index 656321326..e643ca615 100644
--- a/ocamldoc/odoc_text.ml
+++ b/ocamldoc/odoc_text.ml
@@ -114,24 +114,33 @@ module Texter =
p b "{{:%s}" s;
p_text b t ;
p b "}"
- | Ref (s,None) ->
- p b "{!%s}" s
- | Ref (s, Some k) ->
- (
- let sk = match k with
- RK_module -> "module"
- | RK_module_type -> "modtype"
- | RK_class -> "class"
- | RK_class_type -> "classtype"
- | RK_value -> "val"
- | RK_type -> "type"
- | RK_exception -> "exception"
- | RK_attribute -> "attribute"
- | RK_method -> "method"
- | RK_section _ -> "section"
- in
- p b "{!%s:%s}" sk s
- )
+ | Ref (name, kind_opt, text_opt) ->
+ begin
+ p b "%s{!%s%s}"
+ (match text_opt with None -> "" | Some _ -> "{")
+ (match kind_opt with
+ None -> ""
+ | Some k ->
+ let s =
+ match k with
+ RK_module -> "module"
+ | RK_module_type -> "modtype"
+ | RK_class -> "class"
+ | RK_class_type -> "classtype"
+ | RK_value -> "val"
+ | RK_type -> "type"
+ | RK_exception -> "exception"
+ | RK_attribute -> "attribute"
+ | RK_method -> "method"
+ | RK_section _ -> "section"
+ in
+ s^":"
+ )
+ name;
+ match text_opt with
+ None -> ()
+ | Some t -> p_text b t; p b "}"
+ end
| Superscript t -> p b "{^" ; p_text b t ; p b "}"
| Subscript t -> p b "{_" ; p_text b t ; p b "}"
| Module_list l ->