1

I'm using ocamldoc to generate the documentation of my program. My code is not particularly big yet, I just have one function, but when I open the HTML the function documentation doesn't appear in any of the files generated by ocamldoc.

I use ocamldoc -all-params arbol\ binario.ml to generate the HTML

I read the documentation for ocamldoc and I used the flag -all-params but it didn't work either. Also I created a simple non-recursive function but it's the same output.

(** @author Roldan Rivera Luis Ricardo
@author Foo*)

(**Este modulo contiene la implementacion de una arbol binario 
de busqueda BST (acrónimo del inglés Binary Search Tree)
con sus funciones basicas.

{b funciones}
- {! Crear}
- {! Insertar}
- {! Buscar}
- {! Recorrer}*)

(** Tipo de dato llamado Tree, la notacion 'a (alfa) indica que es un
tipo de dato polimorfico, es decir que puede soportar
cualquier tipo de dato. *)

type 'a tree =
    | Branch of 'a * 'a tree * 'a tree (** Un elemento * sub-arbol izquierdo * sub-arbol derecho *)
    | Leaf (** El fin de una rama, significa que ya no hay mas sub-arboles, equivalente al Nil *)

(** Busca el dato deseado en el arbol
 @param tree Arbol donde se va a realizar la busqueda
 @param x El valor a buscar
 @return None Si no se encuentra el dato en el arbol*)
let rec buscar tree x =
match tree with
| Leaf -> None
| Branch(k,left,right) ->
    if k = x then Some x
    else if x < k then buscar left x
    else buscar right x
glennsl
  • 28,186
  • 12
  • 57
  • 75
Farengar
  • 33
  • 8
  • What is the issue precisely? As far as I can see, the generated html file with `ocamldoc -html filename.ml` does contain the documentation for the `buscar` function. – octachron May 11 '19 at 08:33
  • Also `ocamldoc -version` might be a good idea to include – glennsl May 11 '19 at 12:30
  • No, there is no documentation @octachron for buscar in the html :c, [link] (https://ibb.co/yF8gmVh), do you have a code example which generates documentation for functions? – Farengar May 11 '19 at 21:11

1 Answers1

1

Did you forget to precise the html backend (also you should not put space in module name)?

Running ocamldoc with

ocamldoc -html -all-params filename.ml

should print the following documentation for the function:

<pre><span id="VALbuscar"><span class="keyword">val</span> buscar</span> : <code class="type">'a <a href="A.html#TYPEtree">tree</a> -> 'a -> 'a option</code></pre><div class="info ">
<div class="info-desc">
<p>Busca el dato deseado en el arbol</p>
</div>
<ul class="info-attributes">
<li><b>Returns</b> None Si no se encuentra el dato en el arbol</li>
</ul>
</div>
<div class="param_info"><table border="0" cellpadding="3" width="100%">
<tr>
<td align="left" valign="top" width="1%"><b>Parameters: </b></td>
<td>
<table class="paramstable">
<tr>
<td align="center" valign="top" width="15%" class="code">
tree</td>
<td align="center" valign="top">:</td>
<td><div class="paramer-type">
<code class="type">'a <a href="A.html#TYPEtree">tree</a></code><div>
Arbol donde se va a realizar la busqueda
</tr>
<tr>
<td align="center" valign="top" width="15%" class="code">
x</td>
<td align="center" valign="top">:</td>
<td><div class="paramer-type">
<code class="type">'a</code><div>
El valor a buscar
</tr>
</table>
</td>
</tr>
</table></div>
Community
  • 1
  • 1
octachron
  • 17,178
  • 2
  • 16
  • 23