;; Declarative wodoc config for the Eliom documentation (client/server project).
;;   wodoc build --config doc/wodoc --out <dir>/<label> --label <v> \
;;               --menu https://ocsigen.org/doc/menu.html [--local]
;;
;; Eliom ships its server and client APIs as two libraries of the SAME package
;; (eliom.server / eliom.client) with the SAME module names, so `dune build @doc`
;; collides. wodoc therefore builds the API with `odoc_driver eliom --remap` (the
;; engine ocaml.org uses) on the INSTALLED package — i.e. the documented version
;; is whatever the build switch has installed. Each side gets its own API nav
;; (from a curated index), a body colour and a switch button; the manual nav is
;; shared. Cross-references to sibling Ocsigen projects are rewritten from
;; ocaml.org to relative links by (hosted ...); other deps stay on ocaml.org.
(project eliom)
(title Eliom)
(url-prefix /eliom)
(css /css/style.css /css/ocsigen-odoc.css)  ; shared Ocsigen theme (wodoc's default is a built-in one)
(landing index.html)

;; The manual nav is the page tree odoc builds from the manual's directories
;; (doc/<dir>/index.mld: title, @children_order), the same as on ocaml.org.
(nav
 (section "Eliom's Reference manual"
  (page-tree)))

;; Redirects from the URLs of the flat manual (Eliom 12 and before) to the
;; pages of the tree, so that old links and bookmarks keep working. Paths are
;; relative to the repository root, where wodoc build runs.
(static-copy doc/redirects/clientserver-applications.html clientserver-applications.html)
(static-copy doc/redirects/clientserver-cache.html clientserver-cache.html)
(static-copy doc/redirects/clientserver-communication.html clientserver-communication.html)
(static-copy doc/redirects/clientserver-html.html clientserver-html.html)
(static-copy doc/redirects/clientserver-react.html clientserver-react.html)
(static-copy doc/redirects/clientserver-services.html clientserver-services.html)
(static-copy doc/redirects/clientserver-wrapping.html clientserver-wrapping.html)
(static-copy doc/redirects/config.html config.html)
(static-copy doc/redirects/eliom-language.html eliom-language.html)
(static-copy doc/redirects/misc.html misc.html)
(static-copy doc/redirects/mobile-apps.html mobile-apps.html)
(static-copy doc/redirects/ppx-migration.html ppx-migration.html)
(static-copy doc/redirects/ppx-syntax.html ppx-syntax.html)
(static-copy doc/redirects/scalability.html scalability.html)
(static-copy doc/redirects/server-links.html server-links.html)
(static-copy doc/redirects/server-outputs.html server-outputs.html)
(static-copy doc/redirects/server-params.html server-params.html)
(static-copy doc/redirects/server-security.html server-security.html)
(static-copy doc/redirects/server-services.html server-services.html)
(static-copy doc/redirects/server-state.html server-state.html)
(static-copy doc/redirects/workflow-configuration.html workflow-configuration.html)
(static-copy doc/redirects/workflow-distillery.html workflow-distillery.html)

(client-server
  (server (lib eliom.server) (indexdoc doc/server.indexdoc) (heading "Server API") (wrapper Eliom))
  (client (lib eliom.client) (indexdoc doc/client.indexdoc) (heading "Client API") (wrapper Eliom)))

;; Sibling Ocsigen projects whose ocaml.org xrefs are rewritten to relative
;; links into their wodoc docs:  (pkg deploy-dir layout wrapper-module)
;; layout = true/multilib (<dir>.<side>/) | false/root (modules at version
;; root) | subdir (each opam package under its own <pkg>/, whole family).
(hosted
  (eliom           eliom           true  Eliom)
  (ocsigen-toolkit ocsigen-toolkit true  Ot)
  (ocsigen-start   ocsigen-start   true  Os)
  (ocsigenserver   ocsigenserver   false Ocsigen)
  (js_of_ocaml     js_of_ocaml     subdir)
  (tyxml           tyxml           subdir Tyxml)
  (lwt             lwt             subdir)
  (reactiveData    reactiveData    root))
