ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add flag for whether to include trees in the json manifest

+28 -13
+1 -1
lib/compiler/Phases.ml
··· 174 174 match Repr.of_json_string (T.forest_t T.content_t) blob with 175 175 | Ok foreign_forest -> 176 176 let@ r = List.iter @~ foreign_forest in 177 - State.plant_resource ~route_locally: foreign.route_locally r state 177 + State.plant_resource ~route_locally: foreign.route_locally ~include_in_manifest: foreign.include_in_manifest r state 178 178 | Error (`Msg err) -> 179 179 Reporter.fatal Parse_error ~extra_remarks: [Asai.Diagnostic.loctextf "Could not parse foreign forest blob: %s" err] 180 180 | exception exn ->
+4 -4
lib/compiler/State.ml
··· 256 256 | Some _ -> Ok 257 257 | None -> Not_found {suggestion = URI.Tbl.find_opt forest.suggestions uri} 258 258 259 - let plant_resource ?(route_locally = true) resource forest = 259 + let plant_resource ?(route_locally = true) ?(include_in_manifest = true) resource forest = 260 260 let module Graphs = (val forest.graphs) in 261 261 Forest.analyse_resource forest.graphs resource; 262 262 let@ uri = Option.iter @~ T.uri_for_resource resource in ··· 272 272 end; 273 273 match forest.={uri} with 274 274 | None -> 275 - forest.={uri} <- Resource {resource; expanded = None; route_locally} 275 + forest.={uri} <- Resource {resource; expanded = None; route_locally; include_in_manifest} 276 276 | Some (Tree.Expanded syn) -> 277 - forest.={uri} <- Resource {resource; expanded = Some syn; route_locally} 277 + forest.={uri} <- Resource {resource; expanded = Some syn; route_locally; include_in_manifest} 278 278 | _ -> 279 - forest.={uri} <- Resource {resource; expanded = None; route_locally} 279 + forest.={uri} <- Resource {resource; expanded = None; route_locally; include_in_manifest} 280 280 281 281 let serialize_graphs 282 282 : (module Forest_graphs.S) -> 'a
+1 -1
lib/compiler/test/Test_expansion.ml
··· 42 42 List.iter 43 43 (fun article -> 44 44 let@ uri = Option.iter @~ T.(article.frontmatter.uri) in 45 - forest.={uri} <- Resource {resource = Article article; expanded = None; route_locally = true} 45 + forest.={uri} <- Resource {resource = Article article; expanded = None; route_locally = true; include_in_manifest = true} 46 46 ) 47 47 articles 48 48 in
+2 -1
lib/core/Config.ml
··· 6 6 7 7 type foreign = { 8 8 path: string; 9 - route_locally: bool 9 + route_locally: bool; 10 + include_in_manifest: bool 10 11 } 11 12 [@@deriving show, repr] 12 13
+2 -1
lib/core/Config.mli
··· 6 6 7 7 type foreign = { 8 8 path: string; 9 - route_locally: bool 9 + route_locally: bool; 10 + include_in_manifest: bool 10 11 } 11 12 [@@deriving show] 12 13
+1
lib/core/Tree.ml
··· 32 32 type evaluated = { 33 33 resource: T.content T.resource; 34 34 route_locally: bool; 35 + include_in_manifest: bool; 35 36 expanded: syn option; 36 37 } 37 38 [@@deriving show]
+6 -1
lib/frontend/Config_parser.ml
··· 99 99 | None -> true 100 100 | Some b -> b 101 101 in 102 - Config.{path; route_locally} 102 + let include_in_manifest = 103 + match get foreign_tbl (key "include_in_manifest" |-- bool) with 104 + | None -> true 105 + | Some b -> b 106 + in 107 + Config.{path; route_locally; include_in_manifest} 103 108 in 104 109 let assets = 105 110 with_default
+8 -2
lib/frontend/Forester.ml
··· 84 84 85 85 let json_manifest ~dev ~(forest : State.t) : string = 86 86 let render = Json_manifest_client.render_tree ~forest in 87 - forest 88 - |> State.get_all_articles 87 + let articles = 88 + let@ tree = Seq.filter_map @~ Forest.to_seq_values forest.index in 89 + let@ evaluated = Option.bind @@ Tree.to_evaluated tree in 90 + if evaluated.include_in_manifest 91 + then Tree.to_article tree 92 + else None 93 + in 94 + articles 89 95 |> List.of_seq 90 96 |> List.sort (Forest_util.compare_article ~forest) 91 97 |> List.filter_map (fun tree -> render ~dev tree)
+1 -1
lib/frontend/test/Test_config.ml
··· 17 17 assets = []; 18 18 url = URI.of_string_exn "https://www.forester-notes.org/"; 19 19 home = URI.of_string_exn "https://www.forester-notes.org/index/"; 20 - foreign = [{path = "foreign/forest.json"; route_locally = true}]; 20 + foreign = [{path = "foreign/forest.json"; route_locally = true; include_in_manifest = true}]; 21 21 } 22 22 begin 23 23 Forester_core.Reporter.easy_run @@ fun () ->
+2 -1
lib/frontend/test/Test_transclusion.ml
··· 54 54 backmatter = Content [] 55 55 }; 56 56 expanded = None; 57 - route_locally = true 57 + route_locally = true; 58 + include_in_manifest = true; 58 59 }; 59 60 let forest = {(State.make ~env ~config ~dev: false ()) with index} in 60 61 let print_transclusion : T.transclusion -> unit = fun t ->