-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compile asset: extract compile_asset in its own module
Signed-off-by: Paul-Elliot <[email protected]>
- Loading branch information
Showing
5 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
let compile ~parent_id ~name ~output_dir = | ||
let open Odoc_model in | ||
let parent_id = Compile.mk_id parent_id in | ||
let id = | ||
Paths.Identifier.Mk.asset_file ((parent_id :> Paths.Identifier.Page.t), name) | ||
in | ||
let directory = | ||
Compile.path_of_id output_dir parent_id | ||
|> Fpath.to_string |> Fs.Directory.of_string | ||
in | ||
let name = "asset-" ^ name ^ ".odoc" in | ||
let output = Fs.File.create ~directory ~name in | ||
let digest = Digest.string name in | ||
let root = | ||
Root. | ||
{ | ||
id = (id :> Paths.Identifier.OdocId.t); | ||
digest; | ||
file = Odoc_file.asset name; | ||
} | ||
in | ||
let asset = Lang.Asset.{ name = id; root } in | ||
Odoc_file.save_asset output ~warnings:[] asset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
val compile : parent_id:string -> name:string -> output_dir:string -> unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters