12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182(* Rendering of HTML fragments together with metadata. For embedding the
generated documentation in existing websites.
*)moduleHtml=Tyxml.HtmlmoduleUrl=Odoc_document.Urlletjson_of_breadcrumbs(breadcrumbs:Types.breadcrumblist):Utils.Json.json=letbreadcrumb(b:Types.breadcrumb)=`Object[("name",`Stringb.name);("href",`Stringb.href);("kind",`String(Url.Path.string_of_kindb.kind));]inletjson_breadcrumbs=breadcrumbs|>List.mapbreadcrumbin`Arrayjson_breadcrumbsletjson_of_toc(toc:Types.toclist):Utils.Json.json=letrecsection(s:Types.toc)=`Object[("title",`Strings.title_str);("href",`Strings.href);("children",`Array(List.mapsections.children));]inlettoc_json_list=toc|>List.mapsectionin`Arraytoc_json_listletmake~config~preamble~url~breadcrumbs~toc~uses_katex~source_anchorcontentchildren=letfilename=Link.Path.as_filename~is_flat:(Config.flatconfig)urlinletfilename=Fpath.add_ext".json"filenameinlethtmlpp=Html.pp_elt~indent:(Config.indentconfig)()inletjson_to_stringjson=Utils.Json.to_stringjsoninletsource_anchor=matchsource_anchorwithSomeurl->`Stringurl|None->`Nullinletcontentppf=Format.pp_print_stringppf(json_to_string(`Object[("type",`String"documentation");("uses_katex",`Booluses_katex);("breadcrumbs",json_of_breadcrumbsbreadcrumbs);("toc",json_of_toctoc);("source_anchor",source_anchor);("preamble",`String(String.concat""(List.map(Format.asprintf"%a"htmlpp)preamble)));("content",`String(String.concat""(List.map(Format.asprintf"%a"htmlpp)content)));]))in{Odoc_document.Renderer.filename;content;children}letmake_src~config~url~breadcrumbscontent=letfilename=Link.Path.as_filename~is_flat:(Config.flatconfig)urlinletfilename=Fpath.add_ext".json"filenameinlethtmlpp=Html.pp_elt~indent:(Config.indentconfig)()inletjson_to_stringjson=Utils.Json.to_stringjsoninletcontentppf=Format.pp_print_stringppf(json_to_string(`Object[("type",`String"source");("breadcrumbs",json_of_breadcrumbsbreadcrumbs);("content",`String(String.concat""(List.map(Format.asprintf"%a"htmlpp)content)));]))in{Odoc_document.Renderer.filename;content;children=[]}