Skip to content

Commit 84a7b8f

Browse files
panglesdjonludlam
authored andcommitted
Allow linking of source trees
Currently, there is nothing to resolve, so this pass is not useful. However, drivers should continue to link all pages, as it is easier, and if we later introduce features that need linking, everything will be ready on the driver side. Signed-off-by: Paul-Elliot <[email protected]>
1 parent ccc5dca commit 84a7b8f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/odoc/odoc_link.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ let from_odoc ~resolver ~warnings_options input output =
3232
Odoc_file.load input >>= fun unit ->
3333
let input_warnings = unit.Odoc_file.warnings in
3434
match unit.content with
35-
| Source_tree_content _ ->
36-
Error (`Msg "Source tree pages do not need to be linked.")
35+
| Source_tree_content st ->
36+
Odoc_file.save_source_tree output ~warnings:[] st;
37+
Ok (`Source_tree st)
3738
| Page_content page ->
3839
link_page ~resolver ~filename page
3940
|> handle_warnings ~input_warnings ~warnings_options

src/odoc/rendering.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ let documents_of_input ~renderer ~extra ~resolver ~warnings_options ~syntax
2626
input =
2727
let output = Fs.File.(set_ext ".odocl" input) in
2828
Odoc_link.from_odoc ~resolver ~warnings_options input output >>= function
29+
| `Source_tree st -> Ok (Renderer.documents_of_source_tree ~syntax st)
2930
| `Page page -> Ok [ Renderer.document_of_page ~syntax page ]
3031
| `Module m -> documents_of_unit ~warnings_options ~syntax ~renderer ~extra m
3132

test/sources/source_hierarchy.t/run.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ Now, compile the pages with the --source option. The source-name must be include
2020
$ odoc link -I . a.odoc
2121
$ odoc link -I . b.odoc
2222
$ odoc link -I . c.odoc
23+
$ odoc link -I . src-source.odoc
2324
$ odoc html-generate --indent -o html page-root.odocl
24-
$ odoc html-generate --indent -o html src-source.odoc
25+
$ odoc html-generate --indent -o html src-source.odocl
2526
$ odoc html-generate --source a.ml --indent -o html a.odocl
2627
$ odoc html-generate --source b.ml --indent -o html b.odocl
2728
$ odoc html-generate --source c.ml --indent -o html c.odocl

0 commit comments

Comments
 (0)