-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a source-root arg to html-generate #982
Conversation
The relative path has already been given when the .cmt was originally compiled, so to avoid having to pass it again this argument allows the root directory of the source tree to be passed, and then odoc finds the actual source file by looking up that relative file within the tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
src/odoc/html_page.ml
Outdated
type source = File of Fpath.t | Root of Fpath.t | ||
|
||
let pp fmt = function | ||
| File f -> Format.fprintf fmt "File: %a" Fpath.pp f | ||
| Root f -> Format.fprintf fmt "File: %a" Fpath.pp f | ||
|
||
let to_string f = Format.asprintf "%a" pp f | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be put inside a submodule? The Html_page.to_string
and Html_page.pp
names can be misleading, as they are not function dealing with "html pages"...
src/odoc/bin/main.ml
Outdated
"Source code root for the compilation unit. It must have been compiled \ | ||
with --source-parent passed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it might help to add some explanation what is a "source code root".
"Source code root for the compilation unit. It must have been compiled \ | |
with --source-parent passed." | |
"Source code root for the compilation unit. Used to find the source file \ | |
from the value of --source-name it was compiled with. Incompatible with \ | |
--source-file." |
Also, line 718 it should be --source-parent-file
instead of --source-parent
(or maybe "--source-parent-file
and --source-name
to be more explicit)
Suggested by @panglesd.
Thanks @panglesd - applied. |
The relative path has already been given when the .cmt was originally compiled, so to avoid having to pass it again this argument allows the root directory of the source tree to be passed, and then odoc finds the actual source file by looking up that relative file within the tree.