Skip to content

Commit

Permalink
add coqdoc boilerplate, including deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
palmskog committed Oct 30, 2022
1 parent 16fd050 commit 0089e5a
Show file tree
Hide file tree
Showing 11 changed files with 926 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/deploy-coqdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Deploy coqdoc

on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:
build-coqdoc:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v2

- name: Build coqdoc
uses: coq-community/docker-coq-action@v1
with:
custom_image: 'coqorg/coq:dev'
custom_script: |
{{before_install}}
startGroup "Build mmaps dependencies"
opam pin add -n -y -k path coq-mmaps .
opam update -y
opam install -y -j "$(nproc)" coq-mmaps --deps-only
endGroup
startGroup "Add permissions"
sudo chown -R coq:coq .
endGroup
startGroup "Build coqdoc"
make -j "$(nproc)"
make coqdoc
endGroup
- name: Revert Coq user permissions
# to avoid a warning at cleanup time
if: ${{ always() }}
run: sudo chown -R 1001:116 .

- name: Copy HTML and CSS and JavaScript
run: |
mkdir public
cp -r resources/index.html docs/ public/
- name: Deploy to GitHub pages
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: crazy-max/ghaction-github-pages@v2
with:
build_dir: public
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
.Makefile.coq.d
Makefile.coq
Makefile.coq.conf
_build/
docs/
20 changes: 20 additions & 0 deletions Makefile.coq.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GLOBFILES = $(VFILES:.v=.glob)
CSSFILES = resources/coqdoc.css resources/coqdocjs.css
JSFILES = resources/config.js resources/coqdocjs.js
HTMLFILES = resources/header.html resources/footer.html
COQDOCDIR = docs/coqdoc

COQDOCHTMLFLAGS = --toc --toc-depth 3 --index indexpage --html --utf8 -s \
--interpolate --no-lib-name --parse-comments \
--with-header resources/header.html --with-footer resources/footer.html

coqdoc: $(GLOBFILES) $(VFILES) $(CSSFILES) $(JSFILES) $(HTMLFILES)
$(SHOW)'COQDOC -d $(COQDOCDIR)'
$(HIDE)mkdir -p $(COQDOCDIR)
$(HIDE)$(COQDOC) $(COQDOCHTMLFLAGS) $(COQDOCLIBS) -d $(COQDOCDIR) $(VFILES)
$(SHOW)'COPY resources'
$(HIDE)cp $(CSSFILES) $(JSFILES) $(COQDOCDIR)
.PHONY: coqdoc

resources/index.html: resources/index.md
pandoc -s -o $@ $<
79 changes: 79 additions & 0 deletions resources/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
var coqdocjs = coqdocjs || {};

coqdocjs.repl = {
"forall": "∀",
"exists": "∃",
"~": "¬",
"/\\": "∧",
"\\/": "∨",
"->": "→",
"<-": "←",
"<->": "↔",
"=>": "⇒",
"<>": "≠",
"<=": "≤",
">=": "≥",
"el": "∈",
"nel": "∉",
"<<=": "⊆",
"|-": "⊢",
">>": "»",
"<<": "⊆",
"++": "⧺",
"===": "≡",
"=/=": "≢",
"=~=": "≅",
"==>": "⟹",
"<==": "⟸",
"False": "⊥",
"True": "⊤",
":=": "≔",
"-|": "⊣",
"*": "×",
"::": "∷",
"lhd": "⊲",
"rhd": "⊳",
"nat": "ℕ",
"alpha": "α",
"beta": "β",
"gamma": "γ",
"delta": "δ",
"epsilon": "ε",
"eta": "η",
"iota": "ι",
"kappa": "κ",
"lambda": "λ",
"mu": "μ",
"nu": "ν",
"omega": "ω",
"phi": "ϕ",
"pi": "π",
"psi": "ψ",
"rho": "ρ",
"sigma": "σ",
"tau": "τ",
"theta": "θ",
"xi": "ξ",
"zeta": "ζ",
"Delta": "Δ",
"Gamma": "Γ",
"Pi": "Π",
"Sigma": "Σ",
"Omega": "Ω",
"Xi": "Ξ"
};

coqdocjs.subscr = {
"0" : "₀",
"1" : "₁",
"2" : "₂",
"3" : "₃",
"4" : "₄",
"5" : "₅",
"6" : "₆",
"7" : "₇",
"8" : "₈",
"9" : "₉",
};

coqdocjs.replInText = ["==>","<=>", "=>", "->", "<-", ":="];
197 changes: 197 additions & 0 deletions resources/coqdoc.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);

body{
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #2D2D2D
}

a {
text-decoration: none;
border-radius: 3px;
padding-left: 3px;
padding-right: 3px;
margin-left: -3px;
margin-right: -3px;
color: inherit;
font-weight: bold;
}

#main .code a, #main .inlinecode a, #toc a {
font-weight: inherit;
}

a[href]:hover, [clickable]:hover{
background-color: rgba(0,0,0,0.1);
cursor: pointer;
}

h, h1, h2, h3, h4, h5 {
line-height: 1;
color: black;
text-rendering: optimizeLegibility;
font-weight: normal;
letter-spacing: 0.1em;
text-align: left;
}

div + br {
display: none;
}

div:empty{ display: none;}

#main h1 {
font-size: 2em;
}

#main h2 {
font-size: 1.667rem;
}

#main h3 {
font-size: 1.333em;
}

#main h4, #main h5, #main h6 {
font-size: 1em;
}

#toc h2 {
padding-bottom: 0;
}

#main .doc {
margin: 0;
text-align: justify;
}

.inlinecode, .code, #main pre {
font-family: monospace;
}

.code > br:first-child {
display: none;
}

.doc + .code{
margin-top:0.5em;
}

.block{
display: block;
margin-top: 5px;
margin-bottom: 5px;
padding: 10px;
text-align: center;
}

.block img{
margin: 15px;
}

table.infrule {
border: 0px;
margin-left: 50px;
margin-top: 10px;
margin-bottom: 10px;
}

td.infrule {
font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace;
text-align: center;
padding: 0;
line-height: 1;
}

tr.infrulemiddle hr {
margin: 1px 0 1px 0;
}

.infrulenamecol {
color: rgb(60%,60%,60%);
padding-left: 1em;
padding-bottom: 0.1em
}

.id[type="constructor"], .id[type="projection"], .id[type="method"],
.id[title="constructor"], .id[title="projection"], .id[title="method"] {
color: #A30E16;
}

.id[type="var"], .id[type="variable"],
.id[title="var"], .id[title="variable"] {
color: inherit;
}

.id[type="definition"], .id[type="record"], .id[type="class"], .id[type="instance"], .id[type="inductive"], .id[type="library"],
.id[title="definition"], .id[title="record"], .id[title="class"], .id[title="instance"], .id[title="inductive"], .id[title="library"] {
color: #A6650F;
}

.id[type="lemma"],
.id[title="lemma"]{
color: #188B0C;
}

.id[type="keyword"], .id[type="notation"], .id[type="abbreviation"],
.id[title="keyword"], .id[title="notation"], .id[title="abbreviation"]{
color : #2874AE;
}

.comment {
color: #808080;
}

/* TOC */

#toc h2{
letter-spacing: 0;
font-size: 1.333em;
}

/* Index */

#index {
margin: 0;
padding: 0;
width: 100%;
}

#index #frontispiece {
margin: 1em auto;
padding: 1em;
width: 60%;
}

.booktitle { font-size : 140% }
.authors { font-size : 90%;
line-height: 115%; }
.moreauthors { font-size : 60% }

#index #entrance {
text-align: center;
}

#index #entrance .spacer {
margin: 0 30px 0 30px;
}

ul.doclist {
margin-top: 0em;
margin-bottom: 0em;
}

#toc > * {
clear: both;
}

#toc > a {
display: block;
float: left;
margin-top: 1em;
}

#toc a h2{
display: inline;
}
Loading

0 comments on commit 0089e5a

Please sign in to comment.