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

Support language without line comment #827

Closed
fortierq opened this issue Jul 20, 2021 · 3 comments
Closed

Support language without line comment #827

fortierq opened this issue Jul 20, 2021 · 3 comments
Milestone

Comments

@fortierq
Copy link
Contributor

fortierq commented Jul 20, 2021

I would like to add a language (OCaml) which has only block comments, and no line comments.
However, _SCRIPT_EXTENSIONS expects line comments.
Is it easy to add support for block comments? Or should I give up?

This is what I did so far: https://github.com/fortierq/jupytext/commit/b85303bbcf689ff8be299aff4e8cd9489326d367

@mwouts
Copy link
Owner

mwouts commented Jul 27, 2021

Hi @fortierq , thanks for raising this.

Well, this line comment character is just used to comment out magic commands, which I guess are not so frequent in OCaml notebooks ?

Anyway I think it should be rather easy to handle this specificity of OCaml. I think we would just have to modify the functions jupytext.magics.comment_magic and jupytext.magics.unesc to remove the end block comment.

Would you like to update your notebook so that it includes a magic command? Also I think we should define the comment field as the block comment character, and modify the comment_magic and unesc functions to block comment every magic command.

@fortierq
Copy link
Contributor Author

fortierq commented Jul 27, 2021

Hi @mwouts, thanks for your answer.

I don't plan to use magic commands and it is probably not used much indeed.
However, it looks like comments are also used to convert to a script (jupytext --to ml ...), for the Jupytext header and the markdown?

@mwouts mwouts added this to the 1.12.0 milestone Jul 31, 2021
@mwouts
Copy link
Owner

mwouts commented Jul 31, 2021

However, it looks like comments are also used to convert to a script (jupytext --to ml ...), for the Jupytext header and the markdown?

Yes, you're right. Do you think that using block comments on every line would be acceptable? Also, for the markdown cells we have another option, which is to use multi-line strings - is it legal in OCaml to have multi line strings (and how do they look like)? Thanks!

mwouts pushed a commit that referenced this issue Sep 7, 2021
TODO: use block comment instead of line comment
@mwouts mwouts mentioned this issue Sep 7, 2021
mwouts added a commit that referenced this issue Sep 8, 2021
* Add support for ml (#827, WIP)
TODO: use block comment instead of line comment

* Add block comments and ocaml support (#827)

* Remove the version information from the mirror notebooks

* Remove the comment suffix in uncomment/when parsing the header

* More OCaml-specific tests

* Update CHANGELOG.md

Co-authored-by: Quentin Fortier <[email protected]>
@mwouts mwouts modified the milestones: 1.13.0, 1.12.0 Sep 8, 2021
@mwouts mwouts closed this as completed Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants