Skip to content

Commit 6b4f6ad

Browse files
authored
Merge pull request #10 from albinahlback/overhaul
Clean up FLINT webpage and automate deployment
2 parents fc61013 + 5200da1 commit 6b4f6ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1716
-81
lines changed

.github/workflows/deploy.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Workflow to deploy to website
2+
3+
name: Deploy
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
deploy:
12+
name: Push documentation to website
13+
if: github.repository == 'flintlib/flintwebpage'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: "Setup SSH key"
17+
uses: shimataro/[email protected]
18+
with:
19+
key: ${{ secrets.SSH_KEY }}
20+
name: id_ed25519
21+
known_hosts: ${{ secrets.KNOWN_HOSTS }}
22+
23+
- name: "Deploy"
24+
run: |
25+
ssh -t [email protected] 'cd ~/flintwebpage && git checkout master && git pull && python3 downloads.py ~/apps/flintlib_org && python3 build.py ~/apps/flintlib_org && cp -r img/ ~/apps/flintlib_org'

.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
people/*.jpg
2-
*.html
3-
temp/*
1+
AUTHORS
2+
src/downloads.txt

HISTORY

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
1.0.0 2007-12-02
2+
1.0.1 2007-12-07
3+
1.0.2 2007-12-10
4+
1.0.3 2007-12-16
5+
1.0.4 2008-01-04
6+
1.0.5 2008-01-05
7+
1.0.6 2008-01-17
8+
1.0.7 2008-01-22
9+
1.0.8 2008-02-15
10+
1.0.9 2008-03-11
11+
1.0.10 2008-06-16
12+
1.0.11 2008-07-09
13+
1.0.12 2008-07-11
14+
1.0.13 2008-07-13
15+
1.0.14 2008-09-23
16+
1.0.15 2008-10-15
17+
1.0.16 2008-10-22
18+
1.0.17 2008-11-30
19+
1.0.18 2008-12-05
20+
1.0.19 2008-12-12
21+
1.0.20 2008-12-13
22+
1.0.21 2008-12-25
23+
1.1.0 2008-12-21
24+
1.1.1 2009-02-11
25+
1.1.2 2009-03-09
26+
1.1.3 2008-03-09
27+
1.2.0 2009-03-10
28+
1.2.1 2009-03-14
29+
1.2.2 2009-03-20
30+
1.2.3 2009-03-31
31+
1.2.4 2009-04-04
32+
1.2.5 2009-04-18
33+
1.3.0 2009-06-09
34+
1.4.0 2009-07-06
35+
1.5.0 2009-09-22
36+
1.5.1 XXXX-XX-XX
37+
1.5.2 2010-04-08
38+
1.6.0 2010-12-24
39+
2.0.0 2011-01-16
40+
2.1.0 2011-03-09
41+
2.2.0 2011-06-04
42+
2.3.0 2012-11-09
43+
2.4.0 2013-11-19
44+
2.4.1 2013-11-20
45+
2.4.2 2014-03-11
46+
2.4.3 2014-04-01
47+
2.4.4 2014-07-17
48+
2.4.5 2015-02-17
49+
2.5.0 2015-08-03
50+
2.5.1 2015-08-05
51+
2.5.2 2015-08-07
52+
2.6.0 2020-06-05
53+
2.6.1 2020-07-23
54+
2.6.2 2020-07-31
55+
2.6.3 2020-08-12
56+
2.7.0 2020-12-18
57+
2.7.1 2021-01-18
58+
2.8.0 2021-07-22
59+
2.8.1 2021-10-01
60+
2.8.2 2021-10-15
61+
2.8.3 2021-11-03
62+
2.8.4 2021-11-17
63+
2.8.5 2022-04-25
64+
2.9.0 2022-06-24
65+
3.0.0 2023-10-20
66+
3.0.1 2023-11-10
67+
3.1.0 2024-02-27
68+
3.1.1 2024-03-07
69+
3.1.2 2024-03-18
70+
3.1.3 2024-04-25
71+
3.1.3-p1 2024-05-24

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Build system
2+
3+
We generate `src/downloads.txt` that is being used to generate
4+
`${DEST}/downloads.html`. To generate the source file, run
5+
```
6+
$ python3 downloads.py ${PATH_TO_DEST}
7+
```
8+
where `${PATH_TO_DEST}/download` is the path to the directory that contains all
9+
PDF-files and compressed releases (probably `~/apps/flintlib_org/`).
10+
11+
Following this, generate all HTML pages via
12+
```
13+
$ python3 build.py ${PATH_TO_DEST}
14+
```
15+
which outputs all HTML files to `${PATH_TO_DEST}` (probably
16+
`~/apps/flintlib_org/`).
17+
18+
19+
20+
# Source file structure
21+
22+
In the source directory:
23+
24+
- `./`: Building scripts are located in the top directory.
25+
- `src/`: Text files that are to be used to generated to HTML files.
26+
27+
28+
29+
# Output file system
30+
31+
The following directories in the output directory `${PATH_TO_DEST}` needs to be
32+
populated already:
33+
34+
- `img/`: Images for website, such as figures and picture of authors.
35+
- `download/`: PDF documentation along with releases (`.tar.gz` and `.zip`)
36+
files.

build.py

+52-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
# build.py: generate the HTML files from text files
2+
3+
import sys
14
import glob
5+
import urllib.request
6+
from time import gmtime, strftime
7+
import os
8+
9+
if len(sys.argv) != 2:
10+
print("Usage: python3 build.py ARG\n"
11+
"\n"
12+
"For documentation on ARG, see README.md.")
13+
exit(1)
214

315
PAGE_TOP = r"""
416
<!DOCTYPE html>
@@ -12,7 +24,7 @@
1224
<link rel="preconnect" href="https://fonts.googleapis.com">
1325
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1426
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@500&display=swap" rel="stylesheet">
15-
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">
27+
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">
1628
1729
<style type="text/css" media="screen">
1830
body { font-family: 'nunito', arial, sans-serif; font-size: 16px; line-height: 1.5em; margin: 2em; background-color:#fcfcfc; color: #111; }
@@ -55,19 +67,19 @@
5567
5668
<h1>FLINT : <span style="color:#cc3333">Fast Library for Number Theory</span></h1>
5769
58-
<!-- <div style="text-align:center; margin-bottom:1.5em"><img style="scale:90%" src="factor200.svg"></div> -->
59-
<!-- <div style="text-align:center; margin-bottom:1.5em"><img style="scale:90%" src="factor.svg"></div> -->
70+
<!-- <div style="text-align:center; margin-bottom:1.5em"><img style="scale:90%" src="img/factor200.svg"></div> -->
71+
<!-- <div style="text-align:center; margin-bottom:1.5em"><img style="scale:90%" src="img/factor.svg"></div> -->
6072
6173
6274
<div style="text-align:center; margin-bottom:1.5em; overflow:scroll">
6375
6476
<script>
6577
var formulas = [
66-
"delta.svg",
67-
"factor.svg",
68-
"factorpoly.svg",
69-
"bernoulli.svg",
70-
"zeta.svg",
78+
"img/delta.svg",
79+
"img/factor.svg",
80+
"img/factorpoly.svg",
81+
"img/bernoulli.svg",
82+
"img/zeta.svg",
7183
];
7284
7385
var size = formulas.length;
@@ -101,10 +113,10 @@
101113
"""
102114

103115
PAGE_KATEX = r"""
104-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
105-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
106-
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
107-
onload="renderMathInElement(document.body);"></script>
116+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/katex.min.css" integrity="sha384-7lU0muIg/i1plk7MgygDUp3/bNRA65orrBub4/OSWHECgwEsY83HaS1x3bljA/XV" crossorigin="anonymous">
117+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/katex.min.js" integrity="sha384-RdymN7NRJ+XoyeRY4185zXaxq9QWOOx3O7beyyrRK4KQZrPlCDQQpCu95FoCGPAE" crossorigin="anonymous"></script>
118+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/contrib/auto-render.min.js" integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"
119+
onload="renderMathInElement(document.body);"></script>
108120
<script>
109121
document.addEventListener("DOMContentLoaded", function() {
110122
renderMathInElement(document.body, {
@@ -119,7 +131,8 @@
119131

120132
indent = 11
121133

122-
authors_data = open("../flint/AUTHORS").read().splitlines()
134+
urllib.request.urlretrieve("https://raw.githubusercontent.com/flintlib/flint/refs/heads/main/AUTHORS", "AUTHORS")
135+
authors_data = open("AUTHORS").read().splitlines()
123136

124137
lines = authors_data[authors_data.index("Major contributors")+2 : authors_data.index("Other contributors")]
125138
lines_contributors = authors_data[authors_data.index("Other contributors")+5 : authors_data.index("Other credits")]
@@ -172,16 +185,16 @@
172185
contributorlist += "</ul>"
173186

174187
authorphoto = {
175-
"William Hart" : "bill.jpg",
176-
"Fredrik Johansson" : "fredrik.jpg",
177-
"Albin Ahlbäck" : "albin.jpg",
178-
"Andy Novocin" : "andy.jpg",
179-
"Daniel Schultz" : "daniel.jpg",
180-
"David Harvey" : "david.jpg",
181-
"Mike Hansen" : "mike.jpg",
182-
"Pascal Molin" : "pascal.jpg",
183-
"Alex Best" : "alex.jpg",
184-
"D.H.J. Polymath" : "polymath.jpg",
188+
"William Hart" : "img/people/bill.jpg",
189+
"Fredrik Johansson" : "img/people/fredrik.jpg",
190+
"Albin Ahlbäck" : "img/people/albin.jpg",
191+
"Andy Novocin" : "img/people/andy.jpg",
192+
"Daniel Schultz" : "img/people/daniel.jpg",
193+
"David Harvey" : "img/people/david.jpg",
194+
"Mike Hansen" : "img/people/mike.jpg",
195+
"Pascal Molin" : "img/people/pascal.jpg",
196+
"Alex Best" : "img/people/alex.jpg",
197+
"D.H.J. Polymath" : "img/people/polymath.jpg",
185198
}
186199

187200
if 0:
@@ -195,7 +208,7 @@
195208
else:
196209
s += """<b>%s</b>""" % author
197210
if author in authorphoto:
198-
s += """<br/><img src="people/%s" style="max-width:150px; max-height:150px" />""" % authorphoto[author]
211+
s += """<br/><img src="%s" style="max-width:150px; max-height:150px" />""" % authorphoto[author]
199212
#if data.get("github"):
200213
# s += """<br/><a href="https://github.com/flintlib/flint/commits?author=%s">commits</a>""" % data.get("github")
201214
s += "</td><td>"
@@ -226,7 +239,18 @@
226239
authorlist += s
227240
authorlist += "</dl>"
228241

229-
pages = ["index", "applications", "news", "documentation", "downloads", "development", "authors", "links"]
242+
source_prefix = "src/"
243+
source_suffix = ".txt"
244+
pages = [
245+
"index",
246+
"applications",
247+
"news",
248+
"documentation",
249+
"downloads",
250+
"development",
251+
"authors",
252+
"links"
253+
]
230254

231255
page_titles = []
232256
page_texts = []
@@ -237,7 +261,7 @@
237261
text = ""
238262
title = "Documentation"
239263
else:
240-
text = open(page + ".txt", "r").read()
264+
text = open(source_prefix + page + source_suffix, "r").read()
241265
title = text[text.find("<h2>")+4 : text.find("</h2>")]
242266
page_want_katex.append("%WANT_KATEX" in text)
243267
text = text.replace("%AUTHORLIST", authorlist)
@@ -249,7 +273,6 @@
249273

250274

251275

252-
from time import gmtime, strftime
253276
timestamp = strftime("Last updated: %Y-%m-%d %H:%M:%S GMT", gmtime())
254277

255278

@@ -288,7 +311,8 @@
288311
else:
289312
title = " - " + title
290313

291-
fp = open(pages[i] + ".html", "w")
314+
path = sys.argv[1]
315+
fp = open(path + "/" + pages[i] + ".html", "w")
292316
fp.write(PAGE_TOP.replace("TITLE", title).replace("MENU", menu).replace("%KATEX%", PAGE_KATEX if page_want_katex[i] else ""))
293317
fp.write(page_texts[i])
294318
fp.write(PAGE_BOTTOM.replace("TIMESTAMP", timestamp))

0 commit comments

Comments
 (0)