···2222 let config = Forester_frontend.Config.parse_forest_config_file config_filename in
2323 let tree_dirs = paths_of_dirs ~env config.trees in
2424 let asset_dirs = paths_of_dirs ~env config.assets in
2525- Forester.plant_forest_from_dirs ~env ~host: config.host ~dev ~tree_dirs ~asset_dirs;
2525+ let foreign_dirs = paths_of_dirs ~env config.foreign in
2626+ Forester.plant_raw_forest_from_dirs ~env ~host: config.host ~dev ~tree_dirs ~asset_dirs ~foreign_dirs;
2627 Forester.render_forest ~env ~dev ~host: config.host ~home: config.home ~stylesheet: config.stylesheet;
2728 let dirs_to_copy =
2829 (if not no_theme then [config.theme] else []) @
···3536 let config = Forester_frontend.Config.parse_forest_config_file config_filename in
3637 let tree_dirs = paths_of_dirs ~env config.trees in
3738 let asset_dirs = paths_of_dirs ~env config.assets in
3838- Forester.plant_forest_from_dirs ~env ~host: config.host ~dev: false ~tree_dirs ~asset_dirs;
3939- let host =
4040- match config.host with
4141- | Some host -> host
4242- | None -> Reporter.fatalf Configuration_error "To export a forest, you must first fill in the `host' field in %s" config_filename
4343- in
3939+ let foreign_dirs = paths_of_dirs ~env config.foreign in
4040+ Forester.plant_raw_forest_from_dirs ~env ~host: config.host ~dev: false ~tree_dirs ~asset_dirs ~foreign_dirs;
4141+ let host = config.host in
4442 Forester.export ~env ~host ~asset_dirs
45434644let new_tree ~env config_filename dest_dir prefix template random =
···4846 let config = Forester_frontend.Config.parse_forest_config_file config_filename in
4947 let tree_dirs = paths_of_dirs ~env config.trees in
5048 let asset_dirs = paths_of_dirs ~env config.assets in
5151- Forester.plant_forest_from_dirs ~env ~host: config.host ~dev: true ~tree_dirs ~asset_dirs;
4949+ let foreign_dirs = paths_of_dirs ~env config.foreign in
5050+ Forester.plant_raw_forest_from_dirs ~env ~host: config.host ~dev: true ~tree_dirs ~asset_dirs ~foreign_dirs;
5251 let mode = if random then `Random else `Sequential in
5352 let dest = path_of_dir ~env dest_dir in
5453 let addr = Forester.create_tree ~env ~dest ~prefix ~template ~mode in
···5958 let config = Forester_frontend.Config.parse_forest_config_file config_filename in
6059 let tree_dirs = paths_of_dirs ~env config.trees in
6160 let asset_dirs = paths_of_dirs ~env config.assets in
6262- Forester.plant_forest_from_dirs ~env ~host: config.host ~dev: true ~tree_dirs ~asset_dirs;
6161+ let foreign_dirs = paths_of_dirs ~env config.foreign in
6262+ Forester.plant_raw_forest_from_dirs ~env ~host: config.host ~dev: true ~tree_dirs ~asset_dirs ~foreign_dirs;
6363 let@ iri, title = Seq.iter @~ Forester.complete ~host: config.host title in
6464 Format.printf "%a, %s\n" pp_iri iri title
6565···6868 let config = Forester_frontend.Config.parse_forest_config_file config_filename in
6969 let tree_dirs = paths_of_dirs ~env config.trees in
7070 let asset_dirs = paths_of_dirs ~env config.assets in
7171- Forester.plant_forest_from_dirs ~env ~host: config.host ~dev: true ~tree_dirs ~asset_dirs;
7171+ let foreign_dirs = paths_of_dirs ~env config.foreign in
7272+ Forester.plant_raw_forest_from_dirs ~env ~host: config.host ~dev: true ~tree_dirs ~asset_dirs ~foreign_dirs;
7273 Forester.json_manifest ~host: config.host ~home: config.home ~dev: true |> Format.printf "%s"
73747475let default_config_str =
+1-1
lib/compiler/Eval.ml
···125125module Tape = Tape_effect.Make ()
126126module Lex_env = Algaeff.Reader.Make(struct type t = V.t Env.t end)
127127module Dyn_env = Algaeff.Reader.Make(struct type t = V.t Env.t end)
128128-module Host_env = Algaeff.Reader.Make(struct type t = string option end)
128128+module Host_env = Algaeff.Reader.Make(struct type t = string end)
129129module Heap = Algaeff.State.Make(struct type t = V.obj Env.t end)
130130module Emitted_trees = Algaeff.State.Make(struct type t = T.content T.article list end)
131131module Jobs = Algaeff.State.Make(struct type t = job list end)
+1-1
lib/compiler/Eval.mli
···1515 jobs: job list
1616}
17171818-val eval_tree : host: string option -> iri: iri -> source_path: string option -> Syn.tree -> result
1818+val eval_tree : host: string -> iri: iri -> source_path: string option -> Syn.tree -> result
···33module Make (_: sig val route : Iri.t -> string end) (_: Forest.S) : sig
44 val render_trees :
55 dev: bool ->
66- host: string option ->
66+ host: string ->
77 Xml_tree.content Xml_tree.article list ->
88 Yojson.Basic.t
99end
+8-13
lib/forest/Legacy_xml_client.ml
···1414end
15151616module type Params = sig
1717- val host : string option
1717+ val host : string
1818 val home : string option
1919end
2020···4848 | Iri.Relative xs -> xs
4949 else
5050 Iri.to_string ~pctencode: false @@
5151- Iri.iri ?host ~path ()
5151+ Iri.iri ~host ~path ()
52525353 let iri_to_string iri =
5454- if Iri.scheme iri = Iri_scheme.scheme then
5555- let host = Iri.host iri in
5454+ match Iri.host iri with
5555+ | Some host when Iri.scheme iri = Iri_scheme.scheme ->
5656 let path = Iri.path iri in
5757 forester_iri_to_string ~host ~path
5858- else
5858+ | _ ->
5959 Iri.to_string ~pctencode: false iri
60606161 let iri_type iri =
···7777 | false -> bare_route ^ ".xml"
78787979 let route_foreign_forester_iri ~host ~path ~is_asset =
8080- "foreign-" ^
8181- match host with
8282- | None -> route_bare_forester_iri ~path ~is_asset
8383- | Some host ->
8484- host ^ "-" ^ route_bare_forester_iri ~path ~is_asset
8080+ "foreign-" ^ host ^ "-" ^ route_bare_forester_iri ~path ~is_asset
85818682 let route_forester_iri ~host ~path ~is_asset =
8783 if host = Params.host then
···109105 | _ -> false
110106111107 let route iri =
112112- match Iri.scheme iri with
113113- | scheme when scheme = Iri_scheme.scheme ->
108108+ match Iri.host iri with
109109+ | Some host when Iri.scheme iri = Iri_scheme.scheme ->
114110 if iri_is_home iri then "index.xml"
115111 else
116116- let host = Iri.host iri in
117112 let path = Iri.path iri in
118113 let is_asset = iri_is_asset iri in
119114 route_forester_iri ~host ~path ~is_asset
+1-1
lib/forest/Legacy_xml_client.mli
···44module P := Pure_html
5566module type Params = sig
77- val host : string option
77+ val host : string
88 val home : string option
99end
1010
+14-4
lib/frontend/Config.ml
···3344module Forest_config = struct
55 type t = {
66- host: string option;
66+ host: string;
77 home: string option;
88 trees: string list;
99 assets: string list;
1010+ foreign: string list;
1011 theme: string;
1112 stylesheet: string
1213 }
···15161617let default_forest_config : Forest_config.t =
1718 {
1818- host = None;
1919+ host = "my-forest";
1920 trees = ["trees"];
2021 assets = [];
2222+ foreign = [];
2123 theme = "theme";
2224 home = None;
2325 stylesheet = "default.xsl"
···3537 | `Ok tbl ->
3638 let open Toml.Lenses in
3739 let forest = key "forest" |-- table in
3838- let host = get tbl (forest |-- key "host" |-- string) in
4040+ let host =
4141+ match get tbl (forest |-- key "host" |-- string) with
4242+ | Some host -> host
4343+ | None -> Reporter.fatalf Configuration_error "You need to set the `host' key in your configuration file; this is a global identifier that will be used to distinguish your forest from other forests (you can use your name, e.g. `johnqpublic')"
4444+ in
3945 let home = get tbl (forest |-- key "home" |-- string) in
4046 let _ =
4147 match get tbl (forest |-- key "root" |-- string) with
···4753 Option.value ~default: default_forest_config.trees @@
4854 get tbl (forest |-- key "trees" |-- array |-- strings)
4955 in
5656+ let foreign =
5757+ Option.value ~default: default_forest_config.trees @@
5858+ get tbl (forest |-- key "foreign" |-- array |-- strings)
5959+ in
5060 let assets =
5161 Option.value ~default: default_forest_config.assets @@
5262 get tbl (forest |-- key "assets" |-- array |-- strings)
···5969 Option.value ~default: default_forest_config.stylesheet @@
6070 get tbl (forest |-- key "stylesheet" |-- string)
6171 in
6262- Forest_config.{ host; assets; trees; theme; home; stylesheet }
7272+ Forest_config.{ host; assets; trees; foreign; theme; home; stylesheet }