123456789101112131415161718192021222324252627282930313233343536373839404142434445openOr_errorletfrom_mld~xref_base_uri~env~output~warn_errorinput=Odoc_model.Error.set_warn_errorwarn_error;(* Internal names, they don't have effect on the output. *)letpage_name="__fragment_page__"inletpackage="__fragment_package__"inletdigest=Digest.file(Fs.File.to_stringinput)inletroot=letfile=Odoc_model.Root.Odoc_file.create_pagepage_namein{Odoc_model.Root.package;file;digest}inletname=`Page(root,Odoc_model.Names.PageName.of_stringpage_name)inletlocation=letpos=Lexing.{pos_fname=Fs.File.to_stringinput;pos_lnum=0;pos_cnum=0;pos_bol=0}inLocation.{loc_start=pos;loc_end=pos;loc_ghost=true}inletto_htmlcontent=(* This is a mess. *)letpage=Odoc_model.Lang.Page.{name;content;digest}inletpage=Odoc_xref.Lookup.lookup_pagepageinletenv=Env.buildenv(`Pagepage)inOdoc_xref.resolve_page(Env.resolverenv)page>>=funresolved->letcontent=Odoc_html.Comment.to_html~xref_base_uriresolved.contentinletoc=open_out(Fs.File.to_stringoutput)inletfmt=Format.formatter_of_out_channelocinFormat.fprintffmt"%a@."(Format.pp_print_list(Tyxml.Html.pp_elt()))content;close_outoc;Ok()inmatchFs.File.readinputwith|Error_ase->e|Okstr->matchOdoc_loader.read_stringnamelocationstrwith|Errore->Error(`Msg(Odoc_model.Error.to_stringe))|Ok(`Docscontent)->to_htmlcontent|Ok`Stop->to_html[](* TODO: Error? *)