From 9c7e15f3e6d375ec3442f571cf202c176b6b0fbc Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 13 Dec 2023 10:44:56 +0000 Subject: [PATCH 1/5] Make index.html look like the website --- .github/workflows/homepage.yml | 22 --- .github/workflows/jekyll.yml | 13 ++ .gitignore | 3 + README.md | 9 - index.html | 98 ---------- make_index.py | 37 ++++ pandoc.css | 328 --------------------------------- requirements.txt | 1 + 8 files changed, 54 insertions(+), 457 deletions(-) delete mode 100644 .github/workflows/homepage.yml create mode 100644 .gitignore delete mode 100644 index.html create mode 100644 make_index.py delete mode 100644 pandoc.css create mode 100644 requirements.txt diff --git a/.github/workflows/homepage.yml b/.github/workflows/homepage.yml deleted file mode 100644 index 725646470..000000000 --- a/.github/workflows/homepage.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Push homepage -on: - push: - paths: - - "README.md" -jobs: - commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Generate index.html using pandoc - run: | - sudo apt update - sudo apt install pandoc -y - pandoc -s README.md -c pandoc.css -o index.html - - name: Commit html file - run: | - git config --global user.email "fenics@github.com" - git config --global user.name "FEniCS GitHub Actions" - git add index.html - git commit --allow-empty -m "Update homepage" - git push diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index 1faf71297..183da4311 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -12,6 +12,19 @@ jobs: steps: - uses: actions/checkout@v4 + + # Make index.html + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Generate index.html + run: | + sudo apt update + sudo apt install -y ruby-bundler ruby-dev + python3 -m pip install -r requirements.txt + python3 make_index.py + - name: Build the site in the jekyll/builder container run: | docker run \ diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..46af5325b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +index.html +*.pyc +web/ diff --git a/README.md b/README.md index e8a7c8ac5..ddd057c17 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,3 @@ ---- -pagetitle: FEniCSx Project Documentation -header-includes: ---- - -# FEniCSx Project Documentation - -FEniCS project logo - ## Latest release #### DOLFINx diff --git a/index.html b/index.html deleted file mode 100644 index 60be21376..000000000 --- a/index.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - FEniCSx Project Documentation - - - - - -

FEniCSx Project Documentation

-

FEniCS project logo

-

Latest release

-

DOLFINx

-

0.7.2 C++: https://docs.fenicsproject.org/dolfinx/v0.7.2/cpp/

-

0.7.2 Python: https://docs.fenicsproject.org/dolfinx/v0.7.2/python/

-

FFCx

-

0.7.0: https://docs.fenicsproject.org/ffcx/v0.7.0

-

Basix

-

0.7.0.post0 C++: https://docs.fenicsproject.org/basix/v0.7.0.post0/

-

0.7.0.post0 Python: https://docs.fenicsproject.org/basix/v0.7.0.post0/

-

UFL

-

2023.2.0: https://docs.fenicsproject.org/ufl/2023.2.0

-

main (development) branches

-

DOLFINx

-

main C++: https://docs.fenicsproject.org/dolfinx/main/cpp/

-

main Python: https://docs.fenicsproject.org/dolfinx/main/python/

-

FFCx

-

main: https://docs.fenicsproject.org/ffcx/main

-

Basix

-

main: https://docs.fenicsproject.org/basix/main/

-

UFL

-

main: https://docs.fenicsproject.org/ufl/main

-

Old releases

-

DOLFINx

-

0.7.1 C++: https://docs.fenicsproject.org/dolfinx/v0.7.1/cpp/

-

0.7.1 Python: https://docs.fenicsproject.org/dolfinx/v0.7.1/python/

-

0.7.0 C++: https://docs.fenicsproject.org/dolfinx/v0.7.0/cpp/

-

0.7.0 Python: https://docs.fenicsproject.org/dolfinx/v0.7.0/python/

-

0.6.0 C++: https://docs.fenicsproject.org/dolfinx/v0.6.0/cpp/

-

0.6.0 Python: https://docs.fenicsproject.org/dolfinx/v0.6.0/python/

-

0.5.1 C++: https://docs.fenicsproject.org/dolfinx/v0.5.1/cpp/

-

0.5.1 Python: https://docs.fenicsproject.org/dolfinx/v0.5.1/python/

-

0.5.0 C++: https://docs.fenicsproject.org/dolfinx/v0.5.0/cpp/

-

0.5.0 Python: https://docs.fenicsproject.org/dolfinx/v0.5.0/python/

-

0.4.1 C++: https://docs.fenicsproject.org/dolfinx/v0.4.1/cpp/

-

0.4.1 Python: https://docs.fenicsproject.org/dolfinx/v0.4.1/python/

-

0.4.0 C++: https://docs.fenicsproject.org/dolfinx/v0.4.0/cpp/

-

0.4.0 Python: https://docs.fenicsproject.org/dolfinx/v0.4.0/python/

-

0.3.0 C++: https://docs.fenicsproject.org/dolfinx/v0.3.0/cpp/

-

0.3.0 Python: https://docs.fenicsproject.org/dolfinx/v0.3.0/python/

-

0.2.0 C++: https://docs.fenicsproject.org/dolfinx/v0.2.0/cpp/

-

0.2.0 Python: https://docs.fenicsproject.org/dolfinx/v0.2.0/python/

-

0.1.0 C++: https://docs.fenicsproject.org/dolfinx/v0.1.0/cpp/

-

0.1.0 Python: https://docs.fenicsproject.org/dolfinx/v0.1.0/python/

-

FFCx

-

0.6.0: https://docs.fenicsproject.org/ffcx/v0.6.0

-

0.5.0: https://docs.fenicsproject.org/ffcx/v0.5.0

-

0.4.2: https://docs.fenicsproject.org/ffcx/v0.4.2

-

0.4.1: https://docs.fenicsproject.org/ffcx/v0.4.1

-

0.4.0: https://docs.fenicsproject.org/ffcx/v0.4.0

-

0.3.0: https://docs.fenicsproject.org/ffcx/v0.3.0

-

0.2.0: https://docs.fenicsproject.org/ffcx/v0.2.0

-

0.1.0: https://docs.fenicsproject.org/ffcx/0.1.0

-

Basix

-

0.6.0 C++: https://docs.fenicsproject.org/basix/v0.6.0/

-

0.6.0 Python: https://docs.fenicsproject.org/basix/v0.6.0/

-

0.5.1 C++: https://docs.fenicsproject.org/basix/v0.5.1/

-

0.5.1 Python: https://docs.fenicsproject.org/basix/v0.5.1/

-

0.5.0 C++: https://docs.fenicsproject.org/basix/v0.5.0/

-

0.5.0 Python: https://docs.fenicsproject.org/basix/v0.5.0/

-

0.4.1 C++: https://docs.fenicsproject.org/basix/v0.4.1/

-

0.4.1 Python: https://docs.fenicsproject.org/basix/v0.4.1/

-

0.4.0 C++: https://docs.fenicsproject.org/basix/v0.4.0/

-

0.4.0 Python: https://docs.fenicsproject.org/basix/v0.4.0/

-

0.3.0 C++: https://docs.fenicsproject.org/basix/v0.3.0/

-

0.3.0 Python: https://docs.fenicsproject.org/basix/v0.3.0/

-

0.2.0 C++: https://docs.fenicsproject.org/basix/v0.2.0/

-

0.2.0 Python: https://docs.fenicsproject.org/basix/v0.2.0/

-

0.1.0 C++: https://docs.fenicsproject.org/basix/v0.1.0/

-

0.1.0 Python: https://docs.fenicsproject.org/basix/v0.1.0/

-

UFL

-

2022.2.0: https://docs.fenicsproject.org/ufl/2022.2.0

-

2022.2.0: https://docs.fenicsproject.org/ufl/2022.2.0

-

2022.1.0: https://docs.fenicsproject.org/ufl/2022.1.0

-

UFL

-

old: https://readthedocs.org/projects/fenics-ufl/

- - diff --git a/make_index.py b/make_index.py new file mode 100644 index 000000000..9d9735708 --- /dev/null +++ b/make_index.py @@ -0,0 +1,37 @@ +import os + +from markdown import markdown + + +def system(command): + assert os.system(command) == 0 + + +_path = os.path.dirname(os.path.realpath(__file__)) +web_path = os.path.join(_path, "web") + +if os.path.isdir(web_path): + system(f"rm -r {web_path}") +system(f"git clone http://github.com/FEniCS/web {web_path}") + +with open(os.path.join(web_path, "template.md"), "w") as f: + f.write("---\n") + f.write("title: \"FEniCSx Documentation\"\n") + f.write("---\n") + f.write("\n") + f.write("!!CONTENT!!\n") + +system(f"cd {web_path} && bundle install && bundle exec jekyll build") + +with open(os.path.join(web_path, "_site/template.html")) as f: + template = f.read() +template = template.replace("

!!", "!!") +template = template.replace("!!

", "!!") +template = template.replace("=\"/", "=\"https://fenicsproject.org/") +template = template.replace("(/assets", "(https://fenicsproject.org/assets") + +with open("README.md") as f: + readme = f.read() + +with open("index.html", "w") as f: + f.write(template.replace("!!CONTENT!!", markdown(readme))) diff --git a/pandoc.css b/pandoc.css deleted file mode 100644 index dfafb82ac..000000000 --- a/pandoc.css +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copied from https://gist.github.com/killercup/5917178 - */ - -html { - font-size: 100%; - overflow-y: scroll; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; -} - -body { - color: #444; - font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; - font-size: 12px; - line-height: 1.7; - padding: 1em; - margin: auto; - max-width: 54em; - background: #fefefe; -} - -a { - color: #0645ad; - text-decoration: none; -} - -a:visited { - color: #0b0080; -} - -a:hover { - color: #06e; -} - -a:active { - color: #faa700; -} - -a:focus { - outline: thin dotted; -} - -*::-moz-selection { - background: rgba(255, 255, 0, 0.3); - color: #000; -} - -*::selection { - background: rgba(255, 255, 0, 0.3); - color: #000; -} - -a::-moz-selection { - background: rgba(255, 255, 0, 0.3); - color: #0645ad; -} - -a::selection { - background: rgba(255, 255, 0, 0.3); - color: #0645ad; -} - -p { - margin: 1em 0; -} - -img { - max-width: 100%; -} - -h1, h2, h3, h4, h5, h6 { - color: #111; - line-height: 125%; - margin-top: 2em; - font-weight: normal; -} - -h4, h5, h6 { - font-weight: bold; -} - -h1 { - font-size: 2.5em; -} - -h2 { - font-size: 2em; -} - -h3 { - font-size: 1.5em; -} - -h4 { - font-size: 1.2em; -} - -h5 { - font-size: 1em; -} - -h6 { - font-size: 0.9em; -} - -blockquote { - color: #666666; - margin: 0; - padding-left: 3em; - border-left: 0.5em #EEE solid; -} - -hr { - display: block; - height: 2px; - border: 0; - border-top: 1px solid #aaa; - border-bottom: 1px solid #eee; - margin: 1em 0; - padding: 0; -} - -pre, code, kbd, samp { - color: #000; - font-family: monospace, monospace; - _font-family: 'courier new', monospace; - font-size: 0.98em; -} - -pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; -} - -b, strong { - font-weight: bold; -} - -dfn { - font-style: italic; -} - -ins { - background: #ff9; - color: #000; - text-decoration: none; -} - -mark { - background: #ff0; - color: #000; - font-style: italic; - font-weight: bold; -} - -sub, sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -ul, ol { - margin: 1em 0; - padding: 0 0 0 2em; -} - -li p:last-child { - margin-bottom: 0; -} - -ul ul, ol ol { - margin: .3em 0; -} - -dl { - margin-bottom: 1em; -} - -dt { - font-weight: bold; - margin-bottom: .8em; -} - -dd { - margin: 0 0 .8em 2em; -} - -dd:last-child { - margin-bottom: 0; -} - -img { - border: 0; - -ms-interpolation-mode: bicubic; - vertical-align: middle; -} - -figure { - display: block; - text-align: center; - margin: 1em 0; -} - -figure img { - border: none; - margin: 0 auto; -} - -figcaption { - font-size: 0.8em; - font-style: italic; - margin: 0 0 .8em; -} - -table { - margin-bottom: 2em; - border-bottom: 1px solid #ddd; - border-right: 1px solid #ddd; - border-spacing: 0; - border-collapse: collapse; -} - -table th { - padding: .2em 1em; - background-color: #eee; - border-top: 1px solid #ddd; - border-left: 1px solid #ddd; -} - -table td { - padding: .2em 1em; - border-top: 1px solid #ddd; - border-left: 1px solid #ddd; - vertical-align: top; -} - -.author { - font-size: 1.2em; - text-align: center; -} - -@media only screen and (min-width: 480px) { - body { - font-size: 14px; - } -} -@media only screen and (min-width: 768px) { - body { - font-size: 16px; - } -} -@media print { - * { - background: transparent !important; - color: black !important; - filter: none !important; - -ms-filter: none !important; - } - - body { - font-size: 12pt; - max-width: 100%; - } - - a, a:visited { - text-decoration: underline; - } - - hr { - height: 1px; - border: 0; - border-bottom: 1px solid black; - } - - a[href]:after { - content: " (" attr(href) ")"; - } - - abbr[title]:after { - content: " (" attr(title) ")"; - } - - .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { - content: ""; - } - - pre, blockquote { - border: 1px solid #999; - padding-right: 1em; - page-break-inside: avoid; - } - - tr, img { - page-break-inside: avoid; - } - - img { - max-width: 100% !important; - } - - @page :left { - margin: 15mm 20mm 15mm 10mm; -} - - @page :right { - margin: 15mm 10mm 15mm 20mm; -} - - p, h2, h3 { - orphans: 3; - widows: 3; - } - - h2, h3 { - page-break-after: avoid; - } -} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..0918c9768 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +markdown From cc541f65597224502d853861d5869afef9919ea9 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 13 Dec 2023 10:52:07 +0000 Subject: [PATCH 2/5] remove web dir --- make_index.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/make_index.py b/make_index.py index 9d9735708..f4eb13a52 100644 --- a/make_index.py +++ b/make_index.py @@ -25,6 +25,9 @@ def system(command): with open(os.path.join(web_path, "_site/template.html")) as f: template = f.read() + +system(f"rm -r {web_path}") + template = template.replace("

!!", "!!") template = template.replace("!!

", "!!") template = template.replace("=\"/", "=\"https://fenicsproject.org/") From 556aecdaf7b49503b946fbc9fd1ac3e9c374d3cf Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 13 Dec 2023 10:52:52 +0000 Subject: [PATCH 3/5] _web not web --- make_index.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/make_index.py b/make_index.py index f4eb13a52..3796574a9 100644 --- a/make_index.py +++ b/make_index.py @@ -8,7 +8,7 @@ def system(command): _path = os.path.dirname(os.path.realpath(__file__)) -web_path = os.path.join(_path, "web") +web_path = os.path.join(_path, "_web") if os.path.isdir(web_path): system(f"rm -r {web_path}") @@ -26,8 +26,6 @@ def system(command): with open(os.path.join(web_path, "_site/template.html")) as f: template = f.read() -system(f"rm -r {web_path}") - template = template.replace("

!!", "!!") template = template.replace("!!

", "!!") template = template.replace("=\"/", "=\"https://fenicsproject.org/") From 2bf578529033417ba53d598a61fa4825b8cf9edd Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 13 Dec 2023 10:53:14 +0000 Subject: [PATCH 4/5] gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 46af5325b..fab41033b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ index.html *.pyc -web/ +_web/ +Gemfile.lock +_site/ From d7fe0fa5195f16486b29d964340ae43765dc0cc0 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 13 Dec 2023 10:57:53 +0000 Subject: [PATCH 5/5] add build and deply action --- .github/workflows/jekyll.yml | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index 183da4311..4fd2e3b42 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -8,6 +8,7 @@ on: jobs: build: + if: github.ref != 'refs/heads/main' runs-on: ubuntu-latest steps: @@ -30,3 +31,44 @@ jobs: docker run \ -v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ jekyll/builder:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future" + + build-and-deploy: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + + permissions: + contents: read + pages: write + id-token: write + + steps: + - uses: actions/checkout@v4 + + # Make index.html + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Generate index.html + run: | + sudo apt update + sudo apt install -y ruby-bundler ruby-dev + python3 -m pip install -r requirements.txt + python3 make_index.py + + - name: Build the site in the jekyll/builder container + run: | + docker run \ + -v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ + jekyll/builder:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future" + + # Deploy to GitHub Pages + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: '_site' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1