1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
This test explores the interaction of a few different mechanisms of hiding
modules and canonical annotations.
$ cat test.mli
module A_nonhidden : sig
(** @canonical Test.A *)
type t
end
module B__hidden : sig
type t
end
module C__hidden : sig
(** @canonical Test.C *)
type t
end
(**/**)
module D_hidden : sig
(** @canonical Test.D *)
type t
end
(**/**)
(** This should not have an expansion *)
module A = A_nonhidden
(** This should have an expansion *)
module B = B__hidden
(** This should have an expansion *)
module C = C__hidden
(** This also should have an expansion *)
module D = D_hidden
(** This should render as A.t but link to A_nonhidden/index.html - since A has no expansion *)
type a = A_nonhidden.t
(** This should have no RHS as it's hidden and there is no canonical alternative *)
type b = B__hidden.t
(** This should render as C.t and link to C/index.html *)
type c = C__hidden.t
(** This should render as D.t and link to D/index.html *)
type d = D_hidden.t
See the comments on the types at the end of test.mli for the expectation.
$ ocamlc -c -bin-annot test.mli
$ odoc compile test.cmti
$ odoc link test.odoc
$ odoc html-generate test.odocl --indent -o .
$ odoc support-files -o .
$ find Test -type f | sort
Test/A/index.html
Test/A_nonhidden/index.html
Test/B/index.html
Test/C/index.html
Test/D/index.html
Test/index.html
$ cat Test/index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Test (Test)</title><link rel="stylesheet" href="../odoc.css"/>
<meta charset="utf-8"/><meta name="generator" content="odoc 2.1.1"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<script src="../highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body class="odoc">
<header class="odoc-preamble">
<h1>Module <code><span>Test</span></code></h1>
</header>
<div class="odoc-content">
<div class="odoc-spec">
<div class="spec module" id="module-A_nonhidden" class="anchored">
<a href="#module-A_nonhidden" class="anchor"></a>
<code>
<span><span class="keyword">module</span>
<a href="A_nonhidden/index.html">A_nonhidden</a>
</span>
<span> : <span class="keyword">sig</span> ...
<span class="keyword">end</span>
</span>
</code>
</div>
</div>
<div class="odoc-spec">
<div class="spec module" id="module-A" class="anchored">
<a href="#module-A" class="anchor"></a>
<code>
<span><span class="keyword">module</span> <a href="A/index.html">A</a>
</span>
<span> : <span class="keyword">sig</span> ...
<span class="keyword">end</span>
</span>
</code>
</div>
<div class="spec-doc"><p>This should not have an expansion</p></div>
</div>
<div class="odoc-spec">
<div class="spec module" id="module-B" class="anchored">
<a href="#module-B" class="anchor"></a>
<code>
<span><span class="keyword">module</span> <a href="B/index.html">B</a>
</span>
<span> : <span class="keyword">sig</span> ...
<span class="keyword">end</span>
</span>
</code>
</div><div class="spec-doc"><p>This should have an expansion</p></div>
</div>
<div class="odoc-spec">
<div class="spec module" id="module-C" class="anchored">
<a href="#module-C" class="anchor"></a>
<code>
<span><span class="keyword">module</span> <a href="C/index.html">C</a>
</span>
<span> : <span class="keyword">sig</span> ...
<span class="keyword">end</span>
</span>
</code>
</div><div class="spec-doc"><p>This should have an expansion</p></div>
</div>
<div class="odoc-spec">
<div class="spec module" id="module-D" class="anchored">
<a href="#module-D" class="anchor"></a>
<code>
<span><span class="keyword">module</span> <a href="D/index.html">D</a>
</span>
<span> : <span class="keyword">sig</span> ...
<span class="keyword">end</span>
</span>
</code>
</div>
<div class="spec-doc"><p>This also should have an expansion</p></div>
</div>
<div class="odoc-spec">
<div class="spec type" id="type-a" class="anchored">
<a href="#type-a" class="anchor"></a>
<code><span><span class="keyword">type</span> a</span>
<span> = <a href="A/index.html#type-t">A.t</a></span>
</code>
</div>
<div class="spec-doc">
<p>This should render as A.t but link to A_nonhidden/index.html
- since A has no expansion
</p>
</div>
</div>
<div class="odoc-spec">
<div class="spec type" id="type-b" class="anchored">
<a href="#type-b" class="anchor"></a>
<code><span><span class="keyword">type</span> b</span></code>
</div>
<div class="spec-doc">
<p>This should have no RHS as it's hidden and there is no canonical
alternative
</p>
</div>
</div>
<div class="odoc-spec">
<div class="spec type" id="type-c" class="anchored">
<a href="#type-c" class="anchor"></a>
<code><span><span class="keyword">type</span> c</span>
<span> = <a href="C/index.html#type-t">C.t</a></span>
</code>
</div>
<div class="spec-doc">
<p>This should render as C.t and link to C/index.html</p>
</div>
</div>
<div class="odoc-spec">
<div class="spec type" id="type-d" class="anchored">
<a href="#type-d" class="anchor"></a>
<code><span><span class="keyword">type</span> d</span>
<span> = <a href="D/index.html#type-t">D.t</a></span>
</code>
</div>
<div class="spec-doc">
<p>This should render as D.t and link to D/index.html</p>
</div>
</div>
</div>
</body>
</html>
|