Skip to content

coqdoc refactoring #133

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

Closed
wants to merge 14 commits into from
Closed

coqdoc refactoring #133

wants to merge 14 commits into from

Conversation

ejgallego
Copy link
Member

This is a unification of PR #122 and PR #128: we propose some conservative refactoring of coqdoc, please review. The commits are mostly self-contained and could partially merged.

We have been very convervative wrt to modification of old backend code, things seem to work. Tested with Coq documentation, seems to be OK; SF and CPDT seem also OK, that is, they exhibit the same artifacts in vanilla v8.5 vs the refactored version.

Some of the changes are:

  • use of first class modules for output backends
  • move to Format
  • removal of some unused API, globals, and options
  • added a jscoq backend
  • removed of the seldom used --lib-subtitles option

ejgallego and others added 14 commits February 25, 2016 07:05
Coqdoc output backend selection is implemented using an `if then else`
construction; thus adding new backends is a bit painful.

Ocaml 3.12 has first class modules which allow to have a more convenient
runtime backend selection.

The patch is relatively straightforward; tested under Ocaml 3.12.1 & 4.03.
Move CoqDoc backends to first class modules.
Refactoring, now the output backend is selected in `main.ml`.
It was a stub and had no effect. Kept a warning in case it has any user
in the wild.
Changes to the backend API, trying to streamline code and make it more
functional.

The commit tries to be conservative wrt existing backend code so lots of
global variables remain in use. More work should be done, but this
commit serves as a checkpoint towards greater refactoring.

Tested with Coq documentation; SF and CPDT seems OK, that is, they
exhibit the same artifacts in vanilla v8.5 vs the refactored version.

The new API additions are documented using ocamldoc.

* New backend specific API functions:

  - appendix: Generates the appendix for a document.
  - start_file / end_file: Starts a file, sets options, generates
    header/footer if needed.

* Operations removed:

  - initialize, header, trailer: replaced by start_file / end_file.
  - make_multi_index, make_index, make_toc: There are options in
    start_file now.

* cdglobals.ml: Add .mli file, add output helper `with_outfile`, make
  a couple of functions private.

* Remove subtitle functionality: Its price in code complexity was too
  high; it also was not very flexible, we will replace it with a more
  flexible mechanism.
Simple backend that logs lexer actions to a .txt file.
The jsCoq backend will output an HTML file meant to be run with a build
from (https://github.com/ejgallego/jscoq-builds/)
page_title was set as a global when it is only used in the html backend.
@mattam82
Copy link
Member

mattam82 commented May 3, 2016

I need more time to review this but it looks fine, could you rebase on trunk though for integration in 8.6?

@ejgallego
Copy link
Member Author

Sure, I will, thanks Matthieu!

@ejgallego
Copy link
Member Author

ejgallego commented Jun 3, 2016

I didn't set my mind yet on what to do with this PR.
It is likely that the original use case doesn't apply anymore.

@maximedenes maximedenes added the kind: cleanup Code removal, deprecation, refactorings, etc. label Nov 21, 2016
@maximedenes
Copy link
Member

@ejgallego what shall we do with this PR? Would you like to get it on the 8.7 roadmap?

@ejgallego
Copy link
Member Author

I am not using coqdoc anymore (switched to something closer to coq2html), so I'll let the coqdoc maintainers decide.

@maximedenes
Copy link
Member

@silene and @mattam82, you're listed as coqdoc maintainers :)

What do you think of this PR? Should I tag it for merge request in 8.7?

@ejgallego
Copy link
Member Author

I don't plan to support this anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: cleanup Code removal, deprecation, refactorings, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants