Skip to content
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

ocamldoc generates strange looking documentation for variants #7634

Closed
vicuna opened this issue Sep 20, 2017 · 4 comments
Closed

ocamldoc generates strange looking documentation for variants #7634

vicuna opened this issue Sep 20, 2017 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Sep 20, 2017

Original bug ID: 7634
Reporter: kosik
Status: acknowledged (set by @xavierleroy on 2017-09-30T08:24:23Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.05.0
Category: ocamldoc
Tags: ocamldoc
Monitored by: @yawaramin @gasche

Bug description

(Original title was: ocamldoc generates strange looking documentation for variants with inline records)

If I define a variant type with inline records, e.g.:

type t = Foo of {field1 : int;
field2 : int;
field3 : int}
(** comment 1 *)

   | Bar of {field1 : int;
             field2 : int;
             field3 : int}
     (** comment 2 *)

and I ask ocamldoc to generate the HTML documentation:

ocamldoc -html test.mli

then the documentation looks strange.

The comments starts on a line that contains "{" and end on a line that contains "}".

File attachments

@vicuna
Copy link
Author

vicuna commented Sep 20, 2017

Comment author: @Octachron

As far as I can see, there is nothing particular to inline records here: constructors comments are rendered in a separated column, and a type like

type t =
| Alpha of (a -> very -> long -> type' -> name -> leads -> to' ->exactly -> the -> same -> html -> structure) (** Comment for the Alpha constructor )
| Beta of (namely -> documentation -> comments -> for' ->constructor -> are -> rendered -> in' -> a -> separated -> column) (
* another comment for the Beta constructor *)

is essentially rendered in the same way. Or I am missing what you meant by strangeness?

@vicuna
Copy link
Author

vicuna commented Sep 21, 2017

Comment author: kosik

You are right. This strangeness is not specific to inline records. It happens also in other situations. In this case:

type t

type u =
| Alpha of t (** TEST )
| Beta of (t -> t -> t -> t -> t -> t -> t -> t -> t -> t -> t ) (
* TEST *)

I get the output shown in "test1.png".

I think that the second comment (for the "Beta" variant) is rendered in an odd way. It starts and ends on different lines and that way it looks as if part of the Ocaml code was commented out, which is not the case.

Sure, copying and pasting that we get the correct thing, but it does not look correct in a browser.

@vicuna
Copy link
Author

vicuna commented Sep 30, 2017

Comment author: @yawaramin

IMO, variant and record docs are overly complex, they can be greatly simplified. The first thing to do is get rid of the 'type tables', and use the same style for comments we use everywhere else. Each component of the type should be flush along the left margin, and each comment should be indented by placing it in the 'info' div as usual. Attaching a pic to show what I mean.

EDIT: actually I like Discourse's markup rendering even better: https://discuss.ocaml.org/t/proposal-ocamldoc-should-generate-a-table-of-contents-in-each-module-page/871?u=yawaramin

I think that would be a nice design refresh for the docs. But I understand that is probably out of scope here.

@github-actions
Copy link

github-actions bot commented May 7, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 7, 2020
@github-actions github-actions bot closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant