| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<link rel="stylesheet" href="style.css" type="text/css"> |
| 5 |
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> |
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 7 |
<link rel="Start" href="index.html"> |
| 8 |
<link rel="Up" href="index.html"> |
| 9 |
<link title="Index of types" rel=Appendix href="index_types.html"> |
| 10 |
<link title="Index of extensions" rel=Appendix href="index_extensions.html"> |
| 11 |
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> |
| 12 |
<link title="Index of values" rel=Appendix href="index_values.html"> |
| 13 |
<link title="Index of class types" rel=Appendix href="index_class_types.html"> |
| 14 |
<link title="Index of modules" rel=Appendix href="index_modules.html"> |
| 15 |
<link title="Index of module types" rel=Appendix href="index_module_types.html"> |
| 16 |
<link title="Linebreaks" rel="Chapter" href="Linebreaks.html"><title>Linebreaks</title> |
| 17 |
</head> |
| 18 |
<body> |
| 19 |
<div class="navbar"> <a class="up" href="index.html" title="Index">Up</a> |
| 20 |
</div> |
| 21 |
<h1>Module <a href="type_Linebreaks.html">Linebreaks</a></h1> |
| 22 |
|
| 23 |
<pre><span id="MODULELinebreaks"><span class="keyword">module</span> Linebreaks</span>: <code class="code"><span class="keyword">sig</span></code> <a href="Linebreaks.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top"> |
| 24 |
<div class="info-desc"> |
| 25 |
<p>This file tests the encoding of linebreak inside OCaml code by the |
| 26 |
ocamldoc html backend.</p> |
| 27 |
|
| 28 |
<p>Two slightly different aspects are tested in this very file.</p> |
| 29 |
|
| 30 |
<ul> |
| 31 |
<li>First, inside a "pre" tags, blanks character should not be escaped. |
| 32 |
For instance, the generated html code for this test fragment should not |
| 33 |
contain any <br> tag: |
| 34 |
<pre class="codepre"><code class="code"> <span class="keyword">let</span> f x = |
| 35 |
<span class="keyword">let</span> g x = |
| 36 |
<span class="keyword">let</span> h x = x <span class="keyword">in</span> |
| 37 |
h x <span class="keyword">in</span> |
| 38 |
g x |
| 39 |
</code></pre> |
| 40 |
See <a href="http://caml.inria.fr/mantis/view.php?id=6341"> MPR#6341</a> for more |
| 41 |
details or the file Linebreaks.html generated by ocamldoc from this file.</li> |
| 42 |
<li>Second, outside of a "pre" tags, blank characters in embedded code |
| 43 |
should be escaped, in order to make them render in a "pre"-like fashion. |
| 44 |
A good example should be the files type_<i>Modulename</i>.html generated by |
| 45 |
ocamldoc that should contains the signature of the module <code class="code"><span class="constructor">Modulename</span></code> in |
| 46 |
a "code" tags. |
| 47 |
For instance with the following type definitions,</li> |
| 48 |
</ul> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
<hr width="100%"> |
| 52 |
|
| 53 |
<pre><code><span id="TYPEa"><span class="keyword">type</span> <code class="type"></code>a</span> = </code></pre><table class="typetable"> |
| 54 |
<tr> |
| 55 |
<td align="left" valign="top" > |
| 56 |
<code><span class="keyword">|</span></code></td> |
| 57 |
<td align="left" valign="top" > |
| 58 |
<code><span id="TYPEELTa.A"><span class="constructor">A</span></span></code></td> |
| 59 |
|
| 60 |
</tr></table> |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
<pre><code><span id="TYPEb"><span class="keyword">type</span> <code class="type">'a</code> b</span> = {</code></pre><table class="typetable"> |
| 65 |
<tr> |
| 66 |
<td align="left" valign="top" > |
| 67 |
<code> </code></td> |
| 68 |
<td align="left" valign="top" > |
| 69 |
<code><span id="TYPEELTb.field">field</span> : <code class="type">'a</code>;</code></td> |
| 70 |
|
| 71 |
</tr></table> |
| 72 |
<code>}</code> |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
<pre><code><span id="TYPEc"><span class="keyword">type</span> <code class="type"></code>c</span> = </code></pre><table class="typetable"> |
| 77 |
<tr> |
| 78 |
<td align="left" valign="top" > |
| 79 |
<code><span class="keyword">|</span></code></td> |
| 80 |
<td align="left" valign="top" > |
| 81 |
<code><span id="TYPEELTc.C"><span class="constructor">C</span></span> <span class="keyword">:</span> <code class="type">'a</code> <span class="keyword">-></span> <code class="type"><a href="Linebreaks.html#TYPEc">c</a></code></code></td> |
| 82 |
|
| 83 |
</tr></table> |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
<pre><span id="TYPEs"><span class="keyword">type</span> <code class="type"></code>s</span> = ..</pre> |
| 88 |
|
| 89 |
<pre><code><span class="keyword">type</span> <code class="type"></code><a href="Linebreaks.html#TYPEs">s</a> += </code></pre><table class="typetable"> |
| 90 |
<tr> |
| 91 |
<td align="left" valign="top" > |
| 92 |
<code><span class="keyword">|</span></code></td> |
| 93 |
<td align="left" valign="top" > |
| 94 |
<code><span id="EXTENSIONB">B</span></code></td> |
| 95 |
|
| 96 |
</tr></table> |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
<pre><span id="VALx"><span class="keyword">val</span> x</span> : <code class="type"><a href="Linebreaks.html#TYPEa">a</a></code></pre> |
| 101 |
<pre><span id="MODULES"><span class="keyword">module</span> <a href="Linebreaks.S.html">S</a></span>: <code class="code"><span class="keyword">sig</span></code> <a href="Linebreaks.S.html">..</a> <code class="code"><span class="keyword">end</span></code></pre> |
| 102 |
<pre><span id="MODULETYPEs"><span class="keyword">module type</span> <a href="Linebreaks.s-c.html">s</a></span> = <code class="code"><span class="keyword">sig</span></code> <a href="Linebreaks.s-c.html">..</a> <code class="code"><span class="keyword">end</span></code></pre> |
| 103 |
<pre><span id="TYPEd"><span class="keyword">class type</span> <a href="Linebreaks.d-c.html">d</a></span> = <code class="code"><span class="keyword">object</span></code> <a href="Linebreaks.d-c.html">..</a> <code class="code"><span class="keyword">end</span></code></pre> |
| 104 |
<pre><span id="EXCEPTIONE"><span class="keyword">exception</span> E</span> <span class="keyword">of</span> <code>{</code><table class="typetable"> |
| 105 |
<tr> |
| 106 |
<td align="left" valign="top" > |
| 107 |
<code> </code></td> |
| 108 |
<td align="left" valign="top" > |
| 109 |
<code><span id="TYPEELTLinebreaks.E.inline">inline</span> : <code class="type">int</code>;</code></td> |
| 110 |
|
| 111 |
</tr></table> |
| 112 |
<code>}</code> |
| 113 |
</pre> |
| 114 |
<p>type_Linebreaks.html should contain</p> |
| 115 |
|
| 116 |
<pre class="codepre"><code class="code"><span class="keyword">sig</span> |
| 117 |
<span class="keyword">type</span> a = <span class="constructor">A</span> |
| 118 |
<span class="keyword">type</span> <span class="keywordsign">'</span>a b = { field : <span class="keywordsign">'</span>a; } |
| 119 |
<span class="keyword">type</span> c = <span class="constructor">C</span> : <span class="keywordsign">'</span>a <span class="keywordsign">-></span> <span class="constructor">Linebreaks</span>.c |
| 120 |
<span class="keyword">type</span> s = .. |
| 121 |
<span class="keyword">type</span> s += <span class="constructor">B</span> |
| 122 |
<span class="keyword">val</span> x : <span class="constructor">Linebreaks</span>.a |
| 123 |
<span class="keyword">module</span> <span class="constructor">S</span> : <span class="keyword">sig</span> <span class="keyword">module</span> <span class="constructor">I</span> : <span class="keyword">sig</span> <span class="keyword">end</span> <span class="keyword">end</span> |
| 124 |
<span class="keyword">module</span> <span class="keyword">type</span> s = <span class="keyword">sig</span> <span class="keyword">end</span> |
| 125 |
<span class="keyword">class</span> <span class="keyword">type</span> d = <span class="keyword">object</span> <span class="keyword">end</span> |
| 126 |
<span class="keyword">exception</span> <span class="constructor">E</span> <span class="keyword">of</span> { inline : int; } |
| 127 |
<span class="keyword">end</span> |
| 128 |
</code></pre> |
| 129 |
<p>with <br> tags used for linebreaks. |
| 130 |
Another example would be <code class="code"> <span class="keyword">let</span> f x =<br> |
| 131 |
x</code> which is rendered with a <br> linebreak inside Linebreaks.html.</p> |
| 132 |
|
| 133 |
<p>See <a href="http://caml.inria.fr/mantis/view.php?id=7272">MPR#7272</a> for more |
| 134 |
information.</p> |
| 135 |
</body></html> |