Ignore non doc attributes at top level genrated by ppx#819
Ignore non doc attributes at top level genrated by ppx#819jonludlam merged 3 commits intoocaml:masterfrom
Conversation
src/loader/doc_attr.ml
Outdated
| | hd :: tl as items -> ( | ||
| match classify hd with | ||
| | Some (`Attribute attr) -> ( | ||
| | Some (`Attribute ({ Parsetree.attr_name = { txt = "ocaml.text" ; _ }; _ } as attr)) -> ( |
There was a problem hiding this comment.
Matching this is already the responsibility of parse_attribute. I think what you mean is to change the None case below to continue iterating rather than stopping.
There was a problem hiding this comment.
Indeed, i missed that. Thanks !
eed0688 to
03b4dc5
Compare
Julow
left a comment
There was a problem hiding this comment.
There's some documentation about this in doc/odoc_for_authors.mld in section top_comment that should be updated (where it talks about the exception for open statements).
Otherwise the code looks good.
|
|
I mean that there's documentation about what is "ignored" at the beginning of a file in |
|
We could also do with a CHANGES entry. |
|
Thanks @jorisgio ! |
CHANGES: Additions - New subcommand to resolve references (@panglesd, @lubega-simon, ocaml/odoc#812) - Improved rendering of long signatures (@panglesd, ocaml/odoc#782) - Handle comments attached to open statement as floating comment, instead of dropping them (@panglesd, ocaml/odoc#797) - Empty includes (containing entirely shadowed entries) are now hidden (@panglesd, ocaml/odoc#798) Bugs fixed - Fix a missing Result constructor during compile. This will cause some functor arguments to have different filenames (@jonludlam, ocaml/odoc#795) - Better memory/disk space usage when handling module alias chains (@jonludlam, ocaml/odoc#799) - Resolving class-type paths (ie., `val x : #c`) (@jonludlam, ocaml/odoc#809) - Skip top-level attributes while extracting the top comment. Fix top-comment extraction with PPX preprocessing (@jorisgio, ocaml/odoc#819) - Better handling of @canonical tags (@jonludlam, ocaml/odoc#820) - css: improved layout (@jonludlam, @Julow, ocaml/odoc#822)
Currently, odoc fails to extract synopsis from a signature pre-processed by a ppx. This is because ppx add a "ocaml.ppx.context" attribute at top level before the top comment.
I'm not sure the current fix is the best way to fix, since it uses string matching "ocaml.text" to continue unrolling the list of items until it finds an attribute that is a document.