Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
86075fc
Refactor: Remove duplication in Predefined
Julow Nov 3, 2022
55a1f78
Simplify Env.lookup_root_module
Julow Oct 25, 2022
7dbae8d
WIP: Lookup shape from an identifier
Julow Dec 6, 2022
9468840
Load the typing environment separately
Julow Oct 26, 2022
c75fc4e
Lookup definition using shapes
Julow Nov 2, 2022
7592776
Pass locations through Lang
Julow Nov 2, 2022
362ceaa
Add option to provide source files, generate HTML for raw source
gpetiot Oct 19, 2022
bdc267b
Add test
gpetiot Oct 24, 2022
fe05c60
Add anchors
gpetiot Oct 24, 2022
f59b6ff
Add intf locations
gpetiot Oct 31, 2022
93dd78b
Deduplicate read_location
gpetiot Nov 2, 2022
cf71102
Lookup locations for all items supported by shapes
Julow Nov 3, 2022
acf4a19
Disable shape lookup on OCaml < 4.14
Julow Nov 4, 2022
b03f41c
Compatibility with 4.02
Julow Nov 4, 2022
586d022
CLI: Take source code file in 'compile'
Julow Nov 4, 2022
310c7fd
Adding src rendering with syntax highlighting
panglesd Nov 8, 2022
dea32fd
Moving syntax highlighting out of html
panglesd Nov 8, 2022
e893817
Improved generated html
panglesd Nov 8, 2022
e9b38b6
Store source code along pages
Julow Nov 8, 2022
9899eda
Define source pages in document
Julow Nov 17, 2022
9a451ea
Implement links from interface to implementation
panglesd Nov 18, 2022
1c60feb
Added css for link to source
panglesd Nov 18, 2022
0f8f896
Test source files in wrapped libraries
Julow Nov 18, 2022
c73c961
Carry source code from expanded modules
Julow Nov 22, 2022
3f15f7e
fix line-splitting breaking syntax highlighting
panglesd Dec 1, 2022
5e70b82
Add 'source_parent' to Locations
Julow Nov 23, 2022
e42b7df
Pass source_parent through Env
Julow Dec 1, 2022
d8f91a0
Adding a test for chained wrapped modules
panglesd Dec 2, 2022
2f3005d
WIP: Introduce named_expansion
Julow Dec 2, 2022
1d0b64c
Keep track of path for expanded module
Julow Dec 6, 2022
c15b6d0
Handle source code in reference driver
Julow Jan 25, 2023
8b3dc44
Attach sources to subpages
panglesd Dec 8, 2022
61334a7
Change `named_expansion` into `expansion_with_source`
panglesd Dec 8, 2022
68bc2fa
adding a simple test for functors
panglesd Dec 9, 2022
e67d0ba
Use an intermediate source representation in document
panglesd Dec 1, 2022
d495971
adding local jump to definition
panglesd Dec 2, 2022
2ddf9b6
Introduce guards on bounds for extracting part of source
panglesd Dec 7, 2022
9f63960
improve CSS
panglesd Dec 7, 2022
06a66d5
Use Uids as anchors and move source_info into the loader
panglesd Dec 8, 2022
389c8f2
add a "single mli" test.
panglesd Jan 5, 2023
8c46dff
Add a test for rewriting source parent inside expansions
panglesd Jan 6, 2023
709d9b1
Rewrite source parent only when needed
panglesd Jan 5, 2023
f720457
Resolve external source links
Julow Jan 9, 2023
d256c96
Improve tests
Julow Jan 11, 2023
587b9e9
Generate source links for extension constructors
Julow Jan 11, 2023
2495bd7
do not record source code in expansions
panglesd Jan 11, 2023
d3ec58d
revert `lookup_root_module simplification`
panglesd Jan 11, 2023
80fb09d
Use other modules' shape when reducing a shape to a location
panglesd Jan 12, 2023
6d993a2
Do not link or generate documentation on hidden compilation unit
panglesd Jan 13, 2023
3ba8a98
do not consider ghost nodes for jump to definition.
panglesd Jan 14, 2023
c83e3e5
Add failing test: recursive module
panglesd Jan 16, 2023
c62ac20
Partial compatibility with 4.02
Julow Jan 16, 2023
b1b708b
Move the shape resolution into the link phase
panglesd Jan 17, 2023
35ce9e9
Convert id into shapes without compilation unit shape
panglesd Jan 17, 2023
e049ac5
toward compatibility with 4.02
panglesd Jan 17, 2023
0a28986
Lookup location inside functor result
Julow Jan 18, 2023
d23ec12
Source code: Render line numbers
Julow Jan 18, 2023
ebf3dad
Remove the --intf option
Julow Jan 25, 2023
7b01b4c
sligthly improve source code css
panglesd Jan 19, 2023
5c7bb98
Syntax highlighter compatibility
panglesd Jan 19, 2023
1c2a174
Enable source tests only for 4.14
panglesd Jan 20, 2023
3bd7716
Only generate source links if source parent has sources
panglesd Jan 20, 2023
659bcc3
distinguish between sources with no anchor, and no sources
panglesd Jan 20, 2023
e7f0b73
Add support for `--json-output` for source rendering
panglesd Jan 23, 2023
aa7f433
CSS: Allow source links in other contextes
Julow Jan 23, 2023
bec14e2
Add a source link in the header of the page
Julow Jan 23, 2023
cd2a9da
Remove the odoc_base library
Julow Jan 24, 2023
8819ece
Turn Document.t into a variant
Julow Jan 24, 2023
cd79b08
Compute the number of lines from the src
panglesd Jan 24, 2023
09f92fe
harmonize json output for documentation and source
panglesd Jan 24, 2023
a6ab554
Remove anchors for comp unit
panglesd Jan 25, 2023
eda0d4b
Output the original source tree
Julow Jan 25, 2023
923feb1
Generate source hierarchy in the driver
panglesd Jan 26, 2023
a8007b7
Dependend options --source-parent and --impl
Julow Jan 31, 2023
fe1df00
add breadcrumbs and headers to source file pages
panglesd Feb 1, 2023
4285065
CI: Upgrade to ocaml 4.14
Julow Feb 2, 2023
c610a99
rename `--impl` to `--source`
panglesd Feb 2, 2023
45537d9
Add document representation for source info
panglesd Feb 3, 2023
909e7bb
Remove unecessary changes
Julow Feb 8, 2023
a700157
Load the source file at `html-generate` time
Julow Feb 3, 2023
c4f4d30
Take source-parent as a file instead of a reference
Julow Feb 10, 2023
4205869
Use `--source-file-name` in the reference driver
panglesd Feb 13, 2023
24a9474
Specify source children on the command line
Julow Feb 22, 2023
3c43b56
Generate source directories inside odoc
panglesd Feb 22, 2023
8db06a9
Improve directory pages
panglesd Feb 27, 2023
8f9f380
Fix tests
Julow Feb 27, 2023
d1345c0
Add 'source-tree' command for compiling source parents
Julow Feb 27, 2023
651e20d
Add a new kind of pages: source tree pages
panglesd Feb 27, 2023
e14a1e8
Don't represent page children as references
Julow Feb 28, 2023
cbf4586
Prefix source tree units with 'src-'
panglesd Feb 28, 2023
2ba58d0
Allow linking of source trees
panglesd Feb 28, 2023
3bfed8c
check that all children are in the search path during linking
panglesd Feb 28, 2023
2e74ae6
Update driver to use the new `source-tree` command
panglesd Mar 1, 2023
178f971
Compute missing output path from input name in `odoc source-tree`
panglesd Mar 8, 2023
e499774
Update driver with more explanation
jonludlam Mar 7, 2023
977f782
Update doc/driver.md
jonludlam Mar 14, 2023
8f2fcd1
Update CHANGES
jonludlam Mar 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# - windows-latest Windows doesn't work yet
ocaml-compiler:
# Don't include every versions. OCaml-CI already covers that
- 4.12.x
- 4.14.x
include:
- os: ubuntu-latest # Enable coverage only on a single build
send-coverage: true
Expand Down
7 changes: 6 additions & 1 deletion .ocamlformat-ignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
src/document/*.cppo.ml
src/loader/*.cppo.ml
src/loader/cmi.ml
src/loader/cmi.mli
src/loader/cmt.ml
src/loader/cmti.ml
src/loader/doc_attr.ml
src/loader/*.cppo.ml
src/loader/local_jmp.ml
src/loader/lookup_def.ml
src/loader/uid.ml
src/loader/uid.mli
src/syntax_highlighter/syntax_highlighter.ml
src/model/*.cppo.ml
src/html_support_files/*.ml
test/xref2/lib/*
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
UNRELEASED
----------

Additions
- Source code rendering (@Julow, @panglesd, #909)

2.2.0
-----

Expand Down
2,498 changes: 2,413 additions & 85 deletions doc/driver.md

Large diffs are not rendered by default.

2,605 changes: 2,456 additions & 149 deletions doc/driver.mld

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions doc/library_mlds/odoc_html_support_files.mld
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{0 odoc_html_support_files}

{!childmodule-Odoc_html_support_files}
11 changes: 0 additions & 11 deletions doc/library_mlds/stdlib.mld
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{!module-Annot}
{!module-Arch}
{!module-Arg_helper}
{!module-Arith_status}
{!module-Asmgen}
{!module-Asmlibrarian}
{!module-Asmlink}
Expand All @@ -18,10 +17,8 @@
{!module-Asttypes}
{!module-Attr_helper}
{!module-Augment_specialised_args}
{!module-Available_regs}
{!module-Backend_intf}
{!module-Backend_var}
{!module-Big_int}
{!module-Bigarray}
{!module-Branch_relaxation}
{!module-Branch_relaxation_intf}
Expand Down Expand Up @@ -72,8 +69,6 @@
{!module-Compile_common}
{!module-Compilenv}
{!module-Compmisc}
{!module-Compute_ranges}
{!module-Compute_ranges_intf}
{!module-Condition}
{!module-Config}
{!module-Consistbl}
Expand Down Expand Up @@ -155,8 +150,6 @@
{!module-Mtype}
{!module-Mutable_variable}
{!module-Mutex}
{!module-Nat}
{!module-Num}
{!module-Numbers}
{!module-Opcodes}
{!module-Oprint}
Expand Down Expand Up @@ -191,12 +184,9 @@
{!module-Profile}
{!module-Profiling}
{!module-Projection}
{!module-Ratio}
{!module-Rec_check}
{!module-Ref_to_variables}
{!module-Reg}
{!module-Reg_availability_set}
{!module-Reg_with_debug_info}
{!module-Reload}
{!module-Reloadgen}
{!module-Remove_free_vars_equal_to_args}
Expand Down Expand Up @@ -238,7 +228,6 @@
{!module-Tast_mapper}
{!module-Terminfo}
{!module-Thread}
{!module-ThreadUnix}
{!module-Topdirs}
{!module-Toploop}
{!module-Topmain}
Expand Down
1 change: 0 additions & 1 deletion doc/library_mlds/yojson.mld
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{0 Yojson}

{!module-Yojson}
{!module-Yojson_biniou}

4 changes: 4 additions & 0 deletions src/compat/compatcmdliner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ module Arg = struct
let bool = bool

let ( & ) = ( & )

let conv = conv
let conv_parser = conv_parser
let conv_printer = conv_printer
end

[@@@ocaml.warning "+3"]
15 changes: 13 additions & 2 deletions src/document/ML.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)

val compilation_unit : Odoc_model.Lang.Compilation_unit.t -> Types.Page.t
open Odoc_model
open Odoc_model.Paths

val page : Odoc_model.Lang.Page.t -> Types.Page.t
val compilation_unit : Lang.Compilation_unit.t -> Types.Document.t

val page : Lang.Page.t -> Types.Document.t
(** Convert compilation unit or page models into a document *)

val source_tree : Lang.SourceTree.t -> Types.Document.t list

val source_page :
Identifier.SourcePage.t ->
Lang.Source_info.infos ->
string ->
Types.Document.t
3 changes: 2 additions & 1 deletion src/document/comment.ml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ let heading
let title = non_link_inline_element_list text in
let level = heading_level_to_int attrs.Comment.heading_level in
let label = Some label in
Item.Heading { label; level; title }
let source_anchor = None in
Item.Heading { label; level; title; source_anchor }

let item_element : Comment.block_element -> Item.t list = function
| #Comment.attached_block_element as e ->
Expand Down
21 changes: 13 additions & 8 deletions src/document/doctree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end = struct
| Include { content = { status; content; _ }; _ } ->
if on_sub status then Rec content else Skip
| Heading { label = None; _ } -> Skip
| Heading { label = Some label; level; title } ->
| Heading { label = Some label; level; title; _ } ->
Heading ((label, title), level)

let node mkurl (anchor, text) children =
Expand Down Expand Up @@ -150,9 +150,9 @@ module Shift = struct
and walk_item ~on_sub shift_state (l : Item.t list) =
match l with
| [] -> []
| Heading { label; level; title } :: rest ->
| Heading { label; level; title; source_anchor } :: rest ->
let shift_state, level = shift shift_state level in
Item.Heading { label; level; title }
Item.Heading { label; level; title; source_anchor }
:: walk_item ~on_sub shift_state rest
| Include subp :: rest ->
let content = include_ ~on_sub shift_state subp.content in
Expand Down Expand Up @@ -291,12 +291,13 @@ end = struct
end

module PageTitle : sig
val render_title : Page.t -> Item.t list
val render_title : ?source_anchor:Url.t -> Page.t -> Item.t list
val render_src_title : Source_page.t -> Item.t list
end = struct
let format_title kind name =
let format_title ~source_anchor kind name =
let mk title =
let level = 0 and label = None in
[ Types.Item.Heading { level; label; title } ]
[ Types.Item.Heading { level; label; title; source_anchor } ]
in
let prefix s =
mk (Types.inline (Text (s ^ " ")) :: Codefmt.code (Codefmt.txt name))
Expand All @@ -307,15 +308,19 @@ end = struct
| `ModuleType -> prefix "Module type"
| `ClassType -> prefix "Class type"
| `Class -> prefix "Class"
| `SourcePage -> prefix "Source file"
| `Page | `LeafPage | `File -> []

let make_name_from_path { Url.Path.name; parent; _ } =
match parent with
| None | Some { kind = `Page; _ } -> name
| Some p -> Printf.sprintf "%s.%s" p.name name

let render_title (p : Page.t) =
format_title p.url.kind (make_name_from_path p.url)
let render_title ?source_anchor (p : Page.t) =
format_title ~source_anchor p.url.kind (make_name_from_path p.url)

let render_src_title (p : Source_page.t) =
format_title ~source_anchor:None p.url.kind (make_name_from_path p.url)
end

module Math : sig
Expand Down
2 changes: 1 addition & 1 deletion src/document/dune
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
(public_name odoc.document)
(instrumentation
(backend bisect_ppx))
(libraries odoc_model fpath))
(libraries odoc_model fpath astring))
Loading