├── .gitignore ├── LICENSE ├── Makefile.doc ├── README.md ├── example ├── .gitignore ├── Makefile ├── Makefile.coq.local ├── README.md ├── _CoqProject ├── a.v └── coqdocjs │ ├── Makefile.doc │ └── extra └── extra ├── footer.html ├── header.html └── resources ├── config.js ├── coqdoc.css ├── coqdocjs.css └── coqdocjs.js /.gitignore: -------------------------------------------------------------------------------- 1 | .*.aux 2 | .*.d 3 | *.a 4 | *.cma 5 | *.cmi 6 | *.cmo 7 | *.cmx 8 | *.cmxa 9 | *.cmxs 10 | *.glob 11 | *.ml.d 12 | *.ml4.d 13 | *.mli.d 14 | *.mllib.d 15 | *.mlpack.d 16 | *.native 17 | *.o 18 | *.v.d 19 | *.vio 20 | *.vo 21 | *.vok 22 | *.vos 23 | .DS_Store 24 | .coq-native/ 25 | .csdp.cache 26 | .lia.cache 27 | .nia.cache 28 | .nlia.cache 29 | .nra.cache 30 | csdp.cache 31 | lia.cache 32 | nia.cache 33 | nlia.cache 34 | nra.cache 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Tobias Tebbi 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 16 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 19 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | -------------------------------------------------------------------------------- /Makefile.doc: -------------------------------------------------------------------------------- 1 | COQDOCJS_DIR ?= coqdocjs 2 | EXTRA_DIR = $(COQDOCJS_DIR)/extra 3 | COQDOCFLAGS ?= \ 4 | --toc --toc-depth 2 --html --interpolate \ 5 | --index indexpage --no-lib-name --parse-comments \ 6 | --with-header $(EXTRA_DIR)/header.html --with-footer $(EXTRA_DIR)/footer.html 7 | export COQDOCFLAGS 8 | COQMAKEFILE ?= Makefile.coq 9 | COQDOCJS_LN ?= false 10 | 11 | coqdoc: $(COQMAKEFILE) 12 | $(MAKE) -f $^ html 13 | ifeq ($(COQDOCJS_LN),true) 14 | ln -sf ../$(EXTRA_DIR)/resources html 15 | else 16 | cp -R $(EXTRA_DIR)/resources html 17 | endif 18 | 19 | .PHONY: coqdoc 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoqdocJS 2 | 3 | CoqdocJS is a little script to dynamically improve the coqdoc output. 4 | The result can be seen here: 5 | 6 | https://www.ps.uni-saarland.de/autosubst/doc/Ssr.POPLmark.html 7 | 8 | It offers the following features: 9 | - Customizable Unicode display: 10 | It only changes the display, copy-paste from the website produces pure ASCII. 11 | It only replaces complete identifiers or notation tokens, possibly terminated by numbers or apostrophes. 12 | It does not replace randomly, like in "omega." or "tauto." 13 | To add new symbols, edit [config.js](extra/resources/config.js). 14 | - Proof hiding: 15 | All proofs longer than one line are hidden by default. They can be uncovered by clicking on "Proof...". 16 | 17 | All of this works with the ordinary coqdoc, by asking coqdoc to use a header file including the javascript files and some custom CSS. 18 | 19 | ## Usage 20 | 21 | 1. Clone this repository as a subdirectory or submodule; 22 | 2. Include [Makefile.doc] in your `Makefile`, or copy it as, e.g., `Makefile.coq.local`; 23 | 3. Run `make coqdoc` to build documentations. 24 | 25 | A minimal example is shown [here](example). 26 | 27 | ### Environment Variables 28 | Name | Usage | Default 29 | ---|---|--- 30 | `COQDOCFLAGS` | Override the flags passed to `coqdoc` | see [Makefile.doc] 31 | `COQDOCEXTRAFLAGS` | Extend the flags passed to `coqdoc` | empty 32 | `COQDOCJS_LN` | If set to `true` then symlink resource files; otherwise copy | `false` 33 | `COQDOCJS_DIR` | Folder containing CoqdocJS | `coqdocjs` 34 | `COQMAKEFILE` | Makefile generated by `coq_makefile` | `Makefile.coq` 35 | 36 | ## Files 37 | 38 | - [Makefile.doc]: a generic Makefile setup that calls coqc and coqdoc with the right parameters 39 | - [config.js](extra/resources/config.js): contains the unicode replacement table 40 | - [coqdoc.css](extra/resources/coqdoc.css): a replacement for the default Coqdoc CSS style. Can be removed to use the default style 41 | - [coqdocjs.js](extra/resources/coqdocjs.js) and [coqdocjs.css](extra/resources/coqdocjs.css): the script rewriting the DOM and adding the dynamic features with a corresponding CSS style 42 | - [header.html](extra/header.html) and [footer.html](extra/footer.html): custom header and footer files used in every generated html file 43 | 44 | [Makefile.doc]: Makefile.doc 45 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile.coq 2 | Makefile.coq.conf 3 | html/ 4 | -------------------------------------------------------------------------------- /example/Makefile: -------------------------------------------------------------------------------- 1 | COQMAKEFILE ?= Makefile.coq 2 | COQDOCEXTRAFLAGS = -s 3 | COQDOCJS_LN = true 4 | COQ_PROJ ?= _CoqProject 5 | 6 | all: $(COQMAKEFILE) 7 | $(MAKE) -f $^ $@ 8 | 9 | clean: $(COQMAKEFILE) 10 | $(MAKE) -f $^ cleanall 11 | $(RM) $^ $^.conf 12 | 13 | $(COQMAKEFILE): $(COQ_PROJ) 14 | $(COQBIN)coq_makefile -f $^ -o $@ 15 | 16 | force $(COQ_PROJ) Makefile: ; 17 | 18 | %: $(COQMAKEFILE) force 19 | @+$(MAKE) -f $< $@ 20 | 21 | .PHONY: clean all force 22 | -------------------------------------------------------------------------------- /example/Makefile.coq.local: -------------------------------------------------------------------------------- 1 | coqdocjs/Makefile.doc -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # CoqdocJS Usage Example 2 | This folder contains a minimal example to use CoqdocJS in your project. 3 | 4 | You can build the docs with `make coqdoc`. 5 | -------------------------------------------------------------------------------- /example/_CoqProject: -------------------------------------------------------------------------------- 1 | -Q ./ MyProjectName 2 | a.v 3 | -------------------------------------------------------------------------------- /example/a.v: -------------------------------------------------------------------------------- 1 | (** * Section *) 2 | Variant foo := bar. (* comments *) 3 | 4 | (** ** Subsection *) 5 | (** Documentations. *) 6 | Example baz : forall f : foo, f = bar. 7 | Proof. 8 | intros []. 9 | reflexivity. 10 | Qed. 11 | -------------------------------------------------------------------------------- /example/coqdocjs/Makefile.doc: -------------------------------------------------------------------------------- 1 | ../../Makefile.doc -------------------------------------------------------------------------------- /example/coqdocjs/extra: -------------------------------------------------------------------------------- 1 | ../../extra -------------------------------------------------------------------------------- /extra/footer.html: -------------------------------------------------------------------------------- 1 | 2 |
5 | 6 |