···4949let page_creator ~config ~url ~uses_katex ~resources ~sidebar_data:_ ~header
5050 ~preamble content =
5151 let support_uri = Odoc_html.Config.support_uri config in
5252- let search_uris = Odoc_html.Config.search_uris config in
5352 let file_uri = file_uri ~config ~url in
5453 let shell_css_uri = file_uri support_uri "extensions/jon-shell.css" in
5554 let shell_js_uri = file_uri support_uri "extensions/jon-shell.js" in
···164163 ]
165164 @ xocaml_meta_tags config
166165 @ katex_elements @ extension_head_elements
167167- @ (match search_uris with
168168- | [] -> []
169169- | _ ->
170170- let resolve_uri uri =
171171- match uri with
172172- | Odoc_html.Types.Absolute u -> u
173173- | Relative u ->
174174- Odoc_html.Link.href ~config ~resolve:(Current url)
175175- (Url.from_path u)
176176- in
177177- let search_urls =
178178- List.map (fun uri ->
179179- Printf.sprintf "'%s'" (resolve_uri uri))
180180- search_uris
181181- in
182182- let odoc_search_uri = file_uri support_uri "odoc_search.js" in
183183- [
184184- Html.script
185185- (Html.Unsafe.data
186186- (Printf.sprintf "var base_url = %S;\nvar search_urls = [%s];"
187187- base_url
188188- (Stdlib.String.concat "," search_urls)));
189189- Html.script ~a:[ Html.a_src odoc_search_uri; Html.a_defer () ] (Html.txt "");
190190- ])
191166 in
192167 Html.head (Html.title (Html.txt title_string)) meta_elements
193168 in
···208183 else []
209184 in
210185211211- let search_elements =
212212- if search_uris <> [] then
213213- [ Html.div ~a:[ Html.a_class [ "search-bar-container" ] ]
214214- [ Html.input ~a:[
215215- Html.a_input_type `Search;
216216- Html.a_class [ "search-bar" ];
217217- Html.a_placeholder "\xf0\x9f\x94\x8e Search ('/' to focus)";
218218- ] ();
219219- Html.div ~a:[ Html.a_class [ "search-snake" ] ] [];
220220- Html.div ~a:[ Html.a_class [ "search-result" ] ] [];
221221- ] ]
222222- else []
223223- in
224224-225186 let body =
226187 [
227188 Html.header
228189 ~a:[ Html.a_class [ "jon-shell-header" ] ]
229229- ([
190190+ [
230191 Html.button
231192 ~a:
232193 [
···242203 Html.a ~a:[ Html.a_href "/projects/" ] [ Html.txt "projects" ];
243204 Html.a ~a:[ Html.a_href "/reference/" ] [ Html.txt "reference" ];
244205 ];
245245- ] @ search_elements);
206206+ ];
246207 Html.main
247208 ~a:[ Html.a_class [ "jon-shell-main" ] ]
248209 (sidebar_nav
+1-21
site-builder/gen_rules.ml
···222222 prl " )";
223223 prl " (action";
224224 prl " (progn";
225225- (* Build sherlodoc search index from all .odocl files (site pages +
226226- reference API docs), then generate the search JS bundle.
227227- We use --file-list because the reference docs have 1000+ odocl files
228228- which would overflow the command line. *)
229229- prl " (system \"mkdir -p _html\")";
230230- prl " (system \"{ find ../_doc/_odocl -name '*.odocl' 2>/dev/null; } > _html/.sherlodoc-files.txt\")";
231231- pr " (system \"sherlodoc index --format js -o _html/sherlodoc-db.js --file-list _html/.sherlodoc-files.txt";
232232- List.iter (fun rel -> pr " %s" (odocl_target rel)) mld_files;
233233- prl "\")";
234234- prl " (run sherlodoc js _html/sherlodoc.js)";
235235- (* Patch missing OxCaml runtime primitives into sherlodoc.js.
236236- The OxCaml compiler references caml_sys_const_arch_{amd64,arm64}
237237- on the jsoo_runtime object, but js_of_ocaml doesn't provide them.
238238- We inject stubs into the runtime object definition. *)
239239- (* Patch sherlodoc.js: add OxCaml runtime stubs and wire sherlodoc_db
240240- from the global scope into the jsoo_runtime object. *)
241241- (* Patch sherlodoc.js: add OxCaml runtime stubs and wire the sherlodoc_db
242242- function (defined by the DB script on the global scope) into jsoo_runtime
243243- so sherlodoc's OCaml code can find it. *)
244244- prl " (system \"sed -i 's#{caml_blake2_string:#{caml_sys_const_arch_amd64:function(){return 1;},caml_sys_const_arch_arm64:function(){return 0;},caml_domain_tls_get:function(){return 0;},caml_domain_tls_set:function(){return 0;},caml_hash_exn:function(){return [0,0];},caml_ml_domain_index:function(){return 0;},sherlodoc_db:self.sherlodoc_db||function(){},caml_blake2_string:#' _html/sherlodoc.js\")";
245225 (* HTML generate pages *)
246226 List.iter
247227 (fun rel ->
248248- prl " (run odoc html-generate --warn-error --shell jon-shell --config x-ocaml.universe=/_opam --search-uri sherlodoc-db.js --search-uri sherlodoc.js -o _html %s)"
228228+ prl " (run odoc html-generate --warn-error --shell jon-shell --config x-ocaml.universe=/_opam -o _html %s)"
249229 (odocl_target rel))
250230 mld_files;
251231 (* HTML generate assets via odoc *)