Skip to content

Commit 6b98c1f

Browse files
authored
Merge pull request #1910 from anmonteiro/manual-links
Add links to the manual, future-proof others
2 parents 99650d0 + 8d55a0d commit 6b98c1f

File tree

7 files changed

+82
-85
lines changed

7 files changed

+82
-85
lines changed

docs/Manual.html

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ <h1><a href="https://github.com/bucklescript/bucklescript">BuckleScript</a> User
559559
<li><a href="#_fixed_arguments_with_arbitrary_json_literal_since_1_7_0">Fixed Arguments with arbitrary JSON literal (@since 1.7.0)</a></li>
560560
</ul>
561561
</li>
562-
<li><a href="#_binding_to_nodejs_special_variables_bs_node">Binding to NodeJS special variables: bs.node</a></li>
562+
<li><a href="#_binding_to_nodejs_special_variables_a_href_api_node_html_bs_node_a">Binding to NodeJS special variables: <a href="../api/Node.html">bs.node</a></a></li>
563563
<li><a href="#_binding_to_callbacks_high_order_function">Binding to callbacks (high-order function)</a>
564564
<ul class="sectlevel3">
565565
<li><a href="#__bs_for_explicit_uncurried_callback">[@bs] for explicit uncurried callback</a></li>
@@ -1272,7 +1272,7 @@ <h3 id="_an_example_with_multiple_modules"><a class="anchor" href="#_an_example_
12721272
<div class="colist arabic">
12731273
<ol>
12741274
<li>
1275-
<p><code>Js</code> module is a built-in module shipped with BuckleScript</p>
1275+
<p><a href="../api/Js.html"><code>Js</code></a> module is a built-in module shipped with BuckleScript</p>
12761276
</li>
12771277
</ol>
12781278
</div>
@@ -2355,7 +2355,7 @@ <h4 id="_fixed_arguments_with_arbitrary_json_literal_since_1_7_0"><a class="anch
23552355
</div>
23562356
</div>
23572357
<div class="sect2">
2358-
<h3 id="_binding_to_nodejs_special_variables_bs_node"><a class="anchor" href="#_binding_to_nodejs_special_variables_bs_node"></a>Binding to NodeJS special variables: bs.node</h3>
2358+
<h3 id="_binding_to_nodejs_special_variables_a_href_api_node_html_bs_node_a"><a class="anchor" href="#_binding_to_nodejs_special_variables_a_href_api_node_html_bs_node_a"></a>Binding to NodeJS special variables: <a href="../api/Node.html">bs.node</a></h3>
23592359
<div class="paragraph">
23602360
<p>NodeJS has several file local variables: <code><em>dirname</code>, <code></em>filename</code>, <code>_module</code>, and <code>require</code>.
23612361
Their semantics are more like macros instead of functions.</p>
@@ -3504,7 +3504,7 @@ <h3 id="_return_value_checking_since_1_5_1"><a class="anchor" href="#_return_val
35043504
<pre class="pygments highlight"><code data-lang="ocaml"><span class="tok-k">type</span> <span class="tok-n">element</span>
35053505
<span class="tok-k">type</span> <span class="tok-n">dom</span>
35063506
<span class="tok-k">external</span> <span class="tok-n">getElementById</span> <span class="tok-o">:</span> <span class="tok-kt">string</span> <span class="tok-o">-&gt;</span> <span class="tok-n">element</span> <span class="tok-n">option</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;&quot;</span>
3507-
<span class="tok-o">[@@</span><span class="tok-n">bs</span><span class="tok-o">.</span><span class="tok-n">send</span><span class="tok-o">.</span><span class="tok-n">pipe</span><span class="tok-o">:</span><span class="tok-n">dom</span><span class="tok-o">]</span> <span class="tok-o">[@@</span><span class="tok-n">bs</span><span class="tok-o">.</span><span class="tok-n">return</span> <span class="tok-n">null_to_opt</span><span class="tok-o">]</span> <b class="conum">(1)</b>
3507+
<span class="tok-o">[@@</span><span class="tok-n">bs</span><span class="tok-o">.</span><span class="tok-n">send</span><span class="tok-o">.</span><span class="tok-n">pipe</span><span class="tok-o">:</span><span class="tok-n">dom</span><span class="tok-o">]</span> <span class="tok-o">[@@</span><span class="tok-n">bs</span><span class="tok-o">.</span><span class="tok-n">return</span> <span class="tok-n">nullable</span><span class="tok-o">]</span> <b class="conum">(1)</b>
35083508

35093509
<span class="tok-k">let</span> <span class="tok-n">test</span> <span class="tok-n">dom</span> <span class="tok-o">=</span>
35103510
<span class="tok-k">let</span> <span class="tok-n">elem</span> <span class="tok-o">=</span> <span class="tok-n">dom</span> <span class="tok-o">|&gt;</span> <span class="tok-n">getElementById</span> <span class="tok-s2">&quot;haha&quot;</span> <span class="tok-k">in</span>
@@ -3516,7 +3516,7 @@ <h3 id="_return_value_checking_since_1_5_1"><a class="anchor" href="#_return_val
35163516
<div class="colist arabic">
35173517
<ol>
35183518
<li>
3519-
<p><code>null_to_opt</code> attribute will automatically convert null to <code>option</code></p>
3519+
<p><code>nullable</code> attribute will automatically convert null and undefined to <code>option</code></p>
35203520
</li>
35213521
</ol>
35223522
</div>
@@ -3525,26 +3525,18 @@ <h3 id="_return_value_checking_since_1_5_1"><a class="anchor" href="#_return_val
35253525
<div class="content">
35263526
<pre class="pygments highlight"><code data-lang="js"><span class="tok-kd">function</span> <span class="tok-nx">test</span><span class="tok-p">(</span><span class="tok-nx">dom</span><span class="tok-p">)</span> <span class="tok-p">{</span>
35273527
<span class="tok-kd">var</span> <span class="tok-nx">elem</span> <span class="tok-o">=</span> <span class="tok-nx">dom</span><span class="tok-p">.</span><span class="tok-nx">getElementById</span><span class="tok-p">(</span><span class="tok-s2">&quot;haha&quot;</span><span class="tok-p">);</span>
3528-
<span class="tok-k">if</span> <span class="tok-p">(</span><span class="tok-nx">elem</span> <span class="tok-o">!==</span> <span class="tok-kc">null</span><span class="tok-p">)</span> <span class="tok-p">{</span> <b class="conum">(1)</b>
3528+
<span class="tok-k">if</span> <span class="tok-p">(</span><span class="tok-nx">elem</span> <span class="tok-o">==</span> <span class="tok-kc">null</span><span class="tok-p">)</span> <span class="tok-p">{</span>
3529+
<span class="tok-k">return</span> <span class="tok-mi">1</span><span class="tok-p">;</span>
3530+
<span class="tok-p">}</span> <span class="tok-k">else</span> <span class="tok-p">{</span>
35293531
<span class="tok-nx">console</span><span class="tok-p">.</span><span class="tok-nx">log</span><span class="tok-p">(</span><span class="tok-nx">elem</span><span class="tok-p">);</span>
35303532
<span class="tok-k">return</span> <span class="tok-mi">2</span><span class="tok-p">;</span>
35313533
<span class="tok-p">}</span>
3532-
<span class="tok-k">else</span> <span class="tok-p">{</span>
3533-
<span class="tok-k">return</span> <span class="tok-mi">1</span><span class="tok-p">;</span>
3534-
<span class="tok-p">}</span>
35353534
<span class="tok-p">}</span></code></pre>
35363535
</div>
35373536
</div>
3538-
<div class="colist arabic">
3539-
<ol>
3540-
<li>
3541-
<p>nullable checking without boxing due to compiler optimizations</p>
3542-
</li>
3543-
</ol>
3544-
</div>
35453537
<div class="paragraph">
3546-
<p>Currently 4 directives are supported: <code>null_to_opt</code>, <code>undefined_to_opt</code>,
3547-
<code>null_undefined_to_opt</code> and <code>identity</code>.</p>
3538+
<p>Currently 3 directives are supported: <code>null_to_opt</code>, <code>undefined_to_opt</code>,
3539+
<code>nullable</code> and <code>identity</code>.</p>
35483540
</div>
35493541
<div class="admonitionblock note">
35503542
<table>
@@ -3554,7 +3546,7 @@ <h3 id="_return_value_checking_since_1_5_1"><a class="anchor" href="#_return_val
35543546
</td>
35553547
<td class="content">
35563548
<div class="paragraph">
3557-
<p><code>null_to_opt</code>, <code>undefined_to_opt</code> and <code>null_undefined_to_opt</code> will <strong>semantically</strong>
3549+
<p><code>null_to_opt</code>, <code>undefined_to_opt</code> and <code>nullable</code> will <strong>semantically</strong>
35583550
convert a nullable value to <code>option</code> which is a boxed value, but the compiler will
35593551
do smart optimizations to <strong>remove such boxing overhead</strong> when the returned value is destructed
35603552
in the same routine.</p>
@@ -3785,7 +3777,7 @@ <h3 id="_regex_support"><a class="anchor" href="#_regex_support"></a>Regex suppo
37853777
<div class="title">Note</div>
37863778
</td>
37873779
<td class="content">
3788-
<code>Js.Re.t</code> can be accessed and manipulated using the functions available in the <code>Js.Re</code> module.
3780+
<code>Js.Re.t</code> can be accessed and manipulated using the functions available in the <a href="../api/Js.Re.html"><code>Js.Re</code></a> module.
37893781
</td>
37903782
</tr>
37913783
</table>
@@ -3916,7 +3908,7 @@ <h3 id="_raise_js_style_exception"><a class="anchor" href="#_raise_js_style_exce
39163908
</div>
39173909
</div>
39183910
<div class="paragraph">
3919-
<p>Please consult module <a href="https://bucklescript.github.io/bucklescript/api/Js.Exn.html"><code>Js.Exn</code></a> for more details</p>
3911+
<p>Please consult module <a href="../api/Js.Exn.html"><code>Js.Exn</code></a> for more details</p>
39203912
</div>
39213913
</div>
39223914
</div>
@@ -4045,31 +4037,31 @@ <h3 id="_stable_ish_submodules"><a class="anchor" href="#_stable_ish_submodules"
40454037
<div class="ulist">
40464038
<ul>
40474039
<li>
4048-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Null.html">Js.Null</a></p>
4040+
<p><a href="../api/Js.Null.html">Js.Null</a></p>
40494041
</li>
40504042
<li>
4051-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Undefined.html">Js.Undefined</a></p>
4043+
<p><a href="../api/Js.Undefined.html">Js.Undefined</a></p>
40524044
</li>
40534045
<li>
4054-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Null_undefined.html">Js.Null_undefined</a></p>
4046+
<p><a href="../api/Js.Null_undefined.html">Js.Null_undefined</a></p>
40554047
</li>
40564048
<li>
4057-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Array.html">Js.Array</a></p>
4049+
<p><a href="../api/Js.Array.html">Js.Array</a></p>
40584050
</li>
40594051
<li>
4060-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Date.html">Js.Date</a></p>
4052+
<p><a href="../api/Js.Date.html">Js.Date</a></p>
40614053
</li>
40624054
<li>
4063-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Math.html">Js.Math</a></p>
4055+
<p><a href="../api/Js.Math.html">Js.Math</a></p>
40644056
</li>
40654057
<li>
4066-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Re.html">Js.Re</a></p>
4058+
<p><a href="../api/Js.Re.html">Js.Re</a></p>
40674059
</li>
40684060
<li>
4069-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.String.html">Js.String</a></p>
4061+
<p><a href="../api/Js.String.html">Js.String</a></p>
40704062
</li>
40714063
<li>
4072-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Typed_array.html">Js.Typed_array</a></p>
4064+
<p><a href="../api/Js.Typed_array.html">Js.Typed_array</a></p>
40734065
</li>
40744066
</ul>
40754067
</div>
@@ -4082,13 +4074,13 @@ <h3 id="_experimental_incomplete_submodules"><a class="anchor" href="#_experimen
40824074
<div class="ulist">
40834075
<ul>
40844076
<li>
4085-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Boolean.html">Js.Boolean</a></p>
4077+
<p><a href="../api/Js.Boolean.html">Js.Boolean</a></p>
40864078
</li>
40874079
<li>
4088-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Dict.html">Js.Dict</a></p>
4080+
<p><a href="../api/Js.Dict.html">Js.Dict</a></p>
40894081
</li>
40904082
<li>
4091-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js.Obj.html">Js.Obj</a></p>
4083+
<p><a href="../api/Js.Obj.html">Js.Obj</a></p>
40924084
</li>
40934085
</ul>
40944086
</div>
@@ -4101,28 +4093,28 @@ <h3 id="_very_experimental_internal_submodules"><a class="anchor" href="#_very_e
41014093
<div class="ulist">
41024094
<ul>
41034095
<li>
4104-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_float.html">Js_float</a></p>
4096+
<p><a href="../api/Js_float.html">Js_float</a></p>
41054097
</li>
41064098
<li>
4107-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_int.html">Js_int</a></p>
4099+
<p><a href="../api/Js_int.html">Js_int</a></p>
41084100
</li>
41094101
<li>
4110-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_int64.html">Js_int64</a></p>
4102+
<p><a href="../api/Js_int64.html">Js_int64</a></p>
41114103
</li>
41124104
<li>
4113-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_json.html">Js.Json</a></p>
4105+
<p><a href="../api/Js_json.html">Js.Json</a></p>
41144106
</li>
41154107
<li>
4116-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_nativeint.html">Js_nativeint</a></p>
4108+
<p><a href="../api/Js_nativeint.html">Js_nativeint</a></p>
41174109
</li>
41184110
<li>
4119-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_primitive.html">Js_primitive</a></p>
4111+
<p><a href="../api/Js_primitive.html">Js_primitive</a></p>
41204112
</li>
41214113
<li>
4122-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_types.html">Js.Types</a></p>
4114+
<p><a href="../api/Js_types.html">Js.Types</a></p>
41234115
</li>
41244116
<li>
4125-
<p><a href="https://bucklescript.github.io/bucklescript/api/Js_unsafe.html">Js_unsafe</a></p>
4117+
<p><a href="../api/Js_unsafe.html">Js_unsafe</a></p>
41264118
</li>
41274119
</ul>
41284120
</div>
@@ -4133,29 +4125,29 @@ <h3 id="_very_experimental_internal_submodules"><a class="anchor" href="#_very_e
41334125
<h2 id="_node_module"><a class="anchor" href="#_node_module"></a>Node module</h2>
41344126
<div class="sectionbody">
41354127
<div class="paragraph">
4136-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node.html">Node</a></p>
4128+
<p><a href="../api/Node.html">Node</a></p>
41374129
</div>
41384130
<div class="sect2">
41394131
<h3 id="_submodules"><a class="anchor" href="#_submodules"></a>Submodules</h3>
41404132
<div class="ulist">
41414133
<ul>
41424134
<li>
4143-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node_buffer.html">Node.Buffer</a></p>
4135+
<p><a href="../api/Node_buffer.html">Node.Buffer</a></p>
41444136
</li>
41454137
<li>
4146-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node_child_process.html">Node.Child_process</a></p>
4138+
<p><a href="../api/Node_child_process.html">Node.Child_process</a></p>
41474139
</li>
41484140
<li>
4149-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node_fs.html">Node.Fs</a></p>
4141+
<p><a href="../api/Node_fs.html">Node.Fs</a></p>
41504142
</li>
41514143
<li>
4152-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node_module.html">Node.Module</a></p>
4144+
<p><a href="../api/Node_module.html">Node.Module</a></p>
41534145
</li>
41544146
<li>
4155-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node_path.html">Node.Path</a></p>
4147+
<p><a href="../api/Node_path.html">Node.Path</a></p>
41564148
</li>
41574149
<li>
4158-
<p><a href="https://bucklescript.github.io/bucklescript/api/Node_process.html">Node.Process</a></p>
4150+
<p><a href="../api/Node_process.html">Node.Process</a></p>
41594151
</li>
41604152
</ul>
41614153
</div>
@@ -5715,7 +5707,7 @@ <h3 id="_simple_ocaml_type"><a class="anchor" href="#_simple_ocaml_type"></a>Sim
57155707
</div>
57165708
</div>
57175709
<div class="listingblock">
5718-
<div class="title">Js.Boolean module</div>
5710+
<div class="title"><a href="../api/Js.Boolean.html">Js.Boolean</a> module</div>
57195711
<div class="content">
57205712
<pre>val to_js_boolean: bool -&gt; Js.boolean</pre>
57215713
</div>
@@ -5727,7 +5719,7 @@ <h3 id="_simple_ocaml_type"><a class="anchor" href="#_simple_ocaml_type"></a>Sim
57275719
<p>Either <code>'a</code> or <code>null</code>. <code>Js.Null.empty</code> represents <code>null</code> too.</p>
57285720
</div>
57295721
<div class="listingblock">
5730-
<div class="title">Js.Null module</div>
5722+
<div class="title"><a href="../api/Js.Null.html">Js.Null</a> module</div>
57315723
<div class="content">
57325724
<pre class="pygments highlight"><code data-lang="ocaml"><span class="tok-k">val</span> <span class="tok-n">to_opt</span> <span class="tok-o">:</span> <span class="tok-k">&#39;</span><span class="tok-n">a</span> <span class="tok-n">t</span> <span class="tok-o">-&gt;</span> <span class="tok-k">&#39;</span><span class="tok-n">a</span> <span class="tok-n">option</span>
57335725
<span class="tok-k">val</span> <span class="tok-n">from_opt</span> <span class="tok-o">:</span> <span class="tok-k">&#39;</span><span class="tok-n">a</span> <span class="tok-n">option</span> <span class="tok-o">-&gt;</span> <span class="tok-k">&#39;</span><span class="tok-n">a</span> <span class="tok-n">t</span>
@@ -6033,7 +6025,9 @@ <h3 id="_contributing_to_the_documentation"><a class="anchor" href="#_contributi
60336025
<div class="sect2">
60346026
<h3 id="_contributing_to_the_api_reference"><a class="anchor" href="#_contributing_to_the_api_reference"></a>Contributing to the API reference</h3>
60356027
<div class="paragraph">
6036-
<p>The API reference is generated from doc comments in the source code. Here&#8217;s a good example: <a href="https://github.com/bucklescript/bucklescript/blob/master/jscomp/others/js_re.mli#L146-L161" class="bare">https://github.com/bucklescript/bucklescript/blob/master/jscomp/others/js_re.mli#L146-L161</a></p>
6028+
<p>The API reference is generated from doc comments in the source code.
6029+
<a href="https://github.com/bucklescript/bucklescript/blob/99650/jscomp/others/js_re.mli#L146-L161">Here</a>'s
6030+
a good example</p>
60376031
</div>
60386032
<div class="paragraph">
60396033
<p>Some tips and guidelines:</p>

site/docsource/Dev-mode-How-to.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ You can check the `build.compile` file for debug output.
126126

127127
### Contributing to the API reference
128128

129-
The API reference is generated from doc comments in the source code. Here's a good example: https://github.com/bucklescript/bucklescript/blob/master/jscomp/others/js_re.mli#L146-L161
129+
The API reference is generated from doc comments in the source code.
130+
https://github.com/bucklescript/bucklescript/blob/99650/jscomp/others/js_re.mli#L146-L161[Here]'s
131+
a good example
132+
130133
131134
Some tips and guidelines:
132135

site/docsource/Exception-handling.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ val typeError : string -> 'a
5050
val uriError : string -> 'a
5151
--------------
5252

53-
Please consult module https://bucklescript.github.io/bucklescript/api/Js.Exn.html[`Js.Exn`] for more details
53+
Please consult module link:../api/Js.Exn.html[`Js.Exn`] for more details
5454

5555

5656
## `bs.open`: Type safe external data-source handling (@@since 1.7.0)

site/docsource/Get_started.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ let () =
159159
Js.log (Fib.fib i) <1>
160160
done
161161
------
162-
<1> `Js` module is a built-in module shipped with BuckleScript
162+
<1> link:../api/Js.html[`Js`] module is a built-in module shipped with BuckleScript
163163
* Build the app
164164
+
165165
[source,sh]

site/docsource/OCaml-call-JS.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ x.xx(114, 3, true, false, ("你好"), ( ["你好",1,2,3] ), ( [{ "arr" : ["你
674674
-----------
675675
676676
677-
### Binding to NodeJS special variables: bs.node
677+
### Binding to NodeJS special variables: link:../api/Node.html[bs.node]
678678
679679
NodeJS has several file local variables: `__dirname`, `__filename`, `_module`, and `require`.
680680
Their semantics are more like macros instead of functions.
@@ -1743,7 +1743,7 @@ var f = /b/g
17431743
------------
17441744

17451745

1746-
NOTE: `Js.Re.t` can be accessed and manipulated using the functions available in the `Js.Re` module.
1746+
NOTE: `Js.Re.t` can be accessed and manipulated using the functions available in the link:../api/Js.Re.html[`Js.Re`] module.
17471747

17481748

17491749

site/docsource/Runtime-representation.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ type boolean
124124
val to_bool: boolean -> bool
125125
-----
126126
127-
.Js.Boolean module
127+
.link:../api/Js.Boolean.html[Js.Boolean] module
128128
-----
129129
val to_js_boolean: bool -> Js.boolean
130130
-----
131131
132132
| `'a Js.Null.t` a| Either `'a` or `null`. `Js.Null.empty` represents `null` too.
133133
134134
[source,ocaml]
135-
.Js.Null module
135+
.link:../api/Js.Null.html[Js.Null] module
136136
--------------
137137
val to_opt : 'a t -> 'a option
138138
val from_opt : 'a option -> 'a t

0 commit comments

Comments
 (0)