Skip to content

Commit 6a6ada7

Browse files
authored
📝 🔧 make html to make the html documentation (#1622)
* Chore: 📝 🔧 `make html` to make the html documentation using Rocqnavi This change has been inspire in the repository: https://github.com/CoqHott/logrel-coq
1 parent f967edb commit 6a6ada7

File tree

4 files changed

+72
-55
lines changed

4 files changed

+72
-55
lines changed

.github/workflows/generate_docs.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
branch_name=${{ github.head_ref }}
2424
echo "destination_dir=mathcomp-analysis_$branch_name" >> $GITHUB_ENV
2525
26+
- name: Setup Graphviz
27+
uses: ts-graphviz/setup-graphviz@v2
28+
2629
- name: Set-up OCaml
2730
uses: ocaml/setup-ocaml@v3
2831
with:
@@ -34,13 +37,14 @@ jobs:
3437
- name: Build Mathcomp Analysis
3538
run: opam install -y --deps-only . && opam exec -- make -j 4
3639

37-
- name: Build rocqnavi
38-
run: opam install -y rocq-navi && opam show rocq-navi
40+
- name: Install Rocqnavi
41+
run: opam install -y rocq-navi
3942

4043
- name: Generate Documents
4144
run: |
42-
mkdir -p artifact/${{ env.destination_dir }}
43-
opam exec -- rocqnavi -title "Mathcomp Analysis" -d artifact/${{ env.destination_dir }} -base mathcomp -Q theories analysis -coqlib https://coq.inria.fr/doc/V8.20.0/stdlib/ -external https://math-comp.github.io/htmldoc_2_3_0/ mathcomp.ssreflect -external https://math-comp.github.io/htmldoc_2_3_0/ mathcomp.algebra $(find . -name "*.v" -or -name "*.glob")
45+
mkdir -p artifact
46+
opam exec -- make html
47+
cp -r html artifact/${{ env.destination_dir }}
4448
4549
- name: Upload artifact
4650
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414

1515
Makefile.coq
1616
Makefile.coq.conf
17+
18+
html/

Makefile.common

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -119,54 +119,24 @@ endif
119119
%.vo: __always__ Makefile.coq
120120
+$(COQMAKE) $@
121121

122-
# the doc targets doc and doc-clean are essentially copied from the Mathematical
123-
# Components repository
124-
# we reuse the scripts from the math-comp git repo (which is hard wired)
125-
# modulo one fix: we change builddoc_lib.sh:l.18 to s/\(\*{5,}+\)//g;
126-
127-
MATHCOMP = ../math-comp/
128-
129-
doc: __always__ Makefile.coq
130-
mkdir -p _build_doc/
131-
cp -r $(COQFILES) -t _build_doc/ --parents
132-
cp _CoqProject Makefile* _build_doc
133-
mkdir -p _build_doc/htmldoc
134-
. $(MATHCOMP)etc/utils/builddoc_lib.sh; \
135-
cd _build_doc && mangle_sources $(COQFILES)
136-
+cd _build_doc && $(COQMAKE)
137-
# let's forget about the dependency graph for the time being...
138-
# cd _build_doc && grep -v vio: .Makefile.coq.d > depend
139-
# cd _build_doc && cat depend | $(MATHCOMP)etc/buildlibgraph $(COQFILES) > htmldoc/depend.js
140-
cd _build_doc && $(COQDOC) -t "MathComp Analysis" \
141-
-g --utf8 -Q classical mathcomp.classical -Q theories mathcomp.analysis \
142-
--parse-comments \
143-
--multi-index $(COQFILES) -d htmldoc
144-
. $(MATHCOMP)etc/utils/builddoc_lib.sh; \
145-
cd _build_doc && postprocess_html
146-
cp $(MATHCOMP)etc/artwork/coqdoc.css _build_doc/htmldoc
147-
148-
doc-clean:
149-
rm -rf _build_doc/
150-
151-
coq2html:
152-
$(COQDEP) -f _CoqProject > depend.d
153-
../coq2html/ocamldot/ocamldot depend.d > depend.dot
154-
gsed -i 's/Classical/mathcomp\.classical/' depend.dot
155-
gsed -i 's/Theories/mathcomp\.analysis/' depend.dot
156-
gsed -i 's/Reals_stdlib/mathcomp\.reals_stdlib/' depend.dot
157-
gsed -i 's/Experimental_reals/mathcomp\.experimental_reals/' depend.dot
158-
gsed -i 's/Reals/mathcomp\.reals/' depend.dot
159-
gsed -i 's/Analysis_stdlib/mathcomp\.analysis_stdlib/' depend.dot
160-
gsed -i 's/\//\./g' depend.dot
161-
../coq2html/tools/generate-hierarchy-graph.sh
162-
find . -not -path '*/.*' -name "*.v" -or -name "*.glob" | xargs ../coq2html/coq2html \
163-
-hierarchy-graph hierarchy-graph.dot \
164-
-dependency-graph depend.dot \
165-
-title "Mathcomp Analysis" \
166-
-d html/ -base mathcomp -Q theories analysis \
167-
-coqlib https://rocq-prover.org/doc/V8.20.1/stdlib/ \
168-
-external https://math-comp.github.io/htmldoc_2_3_0/ mathcomp.ssreflect \
169-
-external https://math-comp.github.io/htmldoc_2_3_0/ mathcomp.algebra
170-
171-
coq2html-clean:
172-
rm -f */*.glob
122+
# Html documentation
123+
124+
DOCDIR=html
125+
126+
$(DOCDIR)/dependency_graph.pre:
127+
mkdir -p $(DOCDIR)
128+
coqdep -f _CoqProject | perl etc/builddoc_dependency_dot.pl > $(DOCDIR)/dependency_graph.pre
129+
130+
$(DOCDIR)/dependency_graph.dot: $(DOCDIR)/dependency_graph.pre
131+
mkdir -p $(DOCDIR)
132+
tred $(DOCDIR)/dependency_graph.pre > $(DOCDIR)/dependency_graph.dot
133+
134+
html: build $(DOCDIR)/dependency_graph.dot
135+
mkdir -p $(DOCDIR)
136+
find . -not -path '*/.*' -name "*.v" -or -name "*.glob" | xargs rocqnavi \
137+
-title "Mathcomp Analysis" \
138+
-d $(DOCDIR) -base mathcomp -Q theories analysis \
139+
-coqlib https://rocq-prover.org/doc/V8.20.1/stdlib/ \
140+
-dependency-graph $(DOCDIR)/dependency_graph.dot \
141+
-external https://math-comp.github.io/htmldoc_2_3_0/ mathcomp.ssreflect \
142+
-external https://math-comp.github.io/htmldoc_2_3_0/ mathcomp.algebra

etc/builddoc_dependency_dot.pl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
print "digraph depend {\n";
2+
print " node [shape = ellipse,style=filled,colorscheme = paired12];\n";
3+
print " subgraph cluster_analysis { label=\"Analysis\" }\n";
4+
print " subgraph cluster_classical { label=\"Classical\" }\n";
5+
print " subgraph cluster_reals { label=\"Reals\" }\n";
6+
print " subgraph cluster_experimental_reals { label=\"ExperimentalReals\" }\n";
7+
print " subgraph cluster_analysis { label=\"Analysis\" }\n";
8+
print " subgraph cluster_topology { label=\"Topology\" }\n";
9+
print " subgraph cluster_normedtype { label=\"NormedType\" }\n";
10+
print " subgraph cluster_lebesgue_integral { label=\"Lebesgue_integral\" }\n";
11+
while (<>) {
12+
if (m/([^\s]*)\.vo.*:(.*)/) {
13+
$dests = $2 ;
14+
($path,$src) = ($1 =~ s/\//\//rg =~ m/^(?:(.*\/))?([^.]*)$/);
15+
if ($path =~ m/classical\//) {
16+
$url="mathcomp.classical.$src.html";
17+
print "subgraph cluster_classical { \"$path$src\"[label=\"$src\",URL=\"$url\",fillcolor=1]}\n";
18+
}elsif ($path =~ m/reals\// or $path =~ m/reals_stdlib\//) {
19+
print "subgraph cluster_reals { \"$path$src\"[label=\"$src\",fillcolor=2,fontcolor=white]}"
20+
}elsif ($path =~ m/experimental_reals\//) {
21+
print "subgraph cluster_experimental_reals { \"$path$src\"[label=\"$src\",fillcolor=3]}"
22+
}elsif ($path =~ m/theories\/topology_theory\//) {
23+
print "subgraph cluster_topology { \"$path$src\"[label=\"$src\",fillcolor=4,fontcolor=white]}"
24+
}elsif ($path =~ m/theories\/normedtype_theory\//) {
25+
print "subgraph cluster_normedtype { \"$path$src\"[label=\"$src\",fillcolor=9]}"
26+
}elsif ($path =~ m/theories\/lebesgue_integral_theory\//) {
27+
print "subgraph cluster_lebesgue_integral { \"$path$src\"[label=\"$src\",fillcolor=10,fontcolor=white]}"
28+
}elsif ($path =~ m/theories\//) {
29+
print "subgraph cluster_analysis { \"$path$src\"[label=\"$src\",fillcolor=5]}"
30+
}elsif ($path =~ m/analysis_stdlib\/.*/) {
31+
print "subgraph cluster_analysis { \"$path$src\"[label=\"$src\",fillcolor=5]}"
32+
}else {
33+
$url="/mathcomp.$src.html";
34+
print "\"$path$src\"[label=\"$src\",URL=\"$url\",fillcolor=6,fontcolor=white]"
35+
}
36+
for my $dest (split(" ", $dests)) {
37+
print " \"$1\" -> \"$path$src\";\n" if ($dest =~ m/(.*)\.vo/);
38+
}
39+
}
40+
}
41+
print "}\n";

0 commit comments

Comments
 (0)