summaryrefslogtreecommitdiffstats
path: root/ocamldoc/odoc_html.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_html.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_html.ml')
-rw-r--r--ocamldoc/odoc_html.ml19
1 files changed, 15 insertions, 4 deletions
diff --git a/ocamldoc/odoc_html.ml b/ocamldoc/odoc_html.ml
index dd32d64ae..1d58787df 100644
--- a/ocamldoc/odoc_html.ml
+++ b/ocamldoc/odoc_html.ml
@@ -244,7 +244,8 @@ class virtual text =
| Odoc_info.Title (n, l_opt, t) -> self#html_of_Title b n l_opt t
| Odoc_info.Latex s -> self#html_of_Latex b s
| Odoc_info.Link (s, t) -> self#html_of_Link b s t
- | Odoc_info.Ref (name, ref_opt) -> self#html_of_Ref b name ref_opt
+ | Odoc_info.Ref (name, ref_opt, text_opt) ->
+ self#html_of_Ref b name ref_opt text_opt
| Odoc_info.Superscript t -> self#html_of_Superscript b t
| Odoc_info.Subscript t -> self#html_of_Subscript b t
| Odoc_info.Module_list l -> self#html_of_Module_list b l
@@ -394,10 +395,15 @@ class virtual text =
self#html_of_text b t;
bs b "</a>"
- method html_of_Ref b name ref_opt =
+ method html_of_Ref b name ref_opt text_opt =
match ref_opt with
None ->
- self#html_of_text_element b (Odoc_info.Code name)
+ let text =
+ match text_opt with
+ None -> [Odoc_info.Code name]
+ | Some t -> t
+ in
+ self#html_of_text b text
| Some kind ->
let h name = Odoc_info.Code (Odoc_info.use_hidden_modules name) in
let (target, text) =
@@ -416,8 +422,13 @@ class virtual text =
| Odoc_info.RK_section t -> (Naming.complete_label_target name,
Odoc_info.Italic [Raw (Odoc_info.string_of_text t)])
in
+ let text =
+ match text_opt with
+ None -> [text]
+ | Some text -> text
+ in
bs b ("<a href=\""^target^"\">");
- self#html_of_text_element b text;
+ self#html_of_text b text;
bs b "</a>"
method html_of_Superscript b t =