From 1ef5f8e4c0c53548e51cd539d03227bb83cd6366 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 27 Jul 2021 11:20:55 +0100 Subject: [PATCH 01/15] Experimenting with html build --- .github/pages/metadata.yml | 8 ++++++ .github/workflows/pages.yml | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .github/pages/metadata.yml create mode 100644 .github/workflows/pages.yml diff --git a/.github/pages/metadata.yml b/.github/pages/metadata.yml new file mode 100644 index 000000000..c215c111c --- /dev/null +++ b/.github/pages/metadata.yml @@ -0,0 +1,8 @@ +author: + - The OPTIMADE consortium +title: The OPTIMADE Specification +mainfont: Arial,Helvetica Neue,sans-serif +linkcolor: cornflowerblue +monofont: monospace +monobackgroundcolor: "#F1F1F1" +backgroundcolor: "white" diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..78ec7b613 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,51 @@ +name: Build GitHub pages + +on: + push: + branches: + - master + - develop + +jobs: + + build_html: + runs-on: ubuntu-latest + + env: + COMMIT_AUTHOR: Pages Deployment + COMMIT_AUTHOR_EMAIL: action@github.com + + steps: + + - uses: actions/checkout@v2 + + - name: Strip .. comment block from rst + run: sed -i "s/.. comment/.. /g" optimade.rst + + - name: Run Pandoc + run: | + docker pull pandoc/ubuntu + docker run -v $(pwd):/mnt pandoc/ubuntu \ + --standalone \ + --output=/mnt/optimade.html \ + --to=html \ + --metadata-file=/mnt/.github/pages/metadata.yml \ + /mnt/optimade.rst + + - name: Commit to gh-pages + run: | + git checkout -B gh-pages + git config user.name "${COMMIT_AUTHOR}" + git config user.name "${COMMIT_AUTHOR_EMAIL}" + git add optimade.html + git commit -m "Deploy to GitHub Pages: ${SHA}" + if git diff --cached --quiet; then + exit 0 + fi + + - name: Push changes + uses: ad-m/github-push-action@v0.6.0 + with: + branch: gh-pages + force: true + github_token: ${{ secrets.GITHUB_TOKEN }} From 676427e56c8857b92c14fd80428023edc0c6a319 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 27 Jul 2021 11:41:15 +0100 Subject: [PATCH 02/15] Create fresh gh_pages branch every push --- .github/workflows/pages.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 78ec7b613..9651bcf39 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -34,7 +34,8 @@ jobs: - name: Commit to gh-pages run: | - git checkout -B gh-pages + git branch -D gh-pages + git checkout -b gh-pages git config user.name "${COMMIT_AUTHOR}" git config user.name "${COMMIT_AUTHOR_EMAIL}" git add optimade.html From 5a221cf62eec6a5913a313da9d3390b91ed48ed6 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 27 Jul 2021 11:46:33 +0100 Subject: [PATCH 03/15] Disable trigger on master pushes for now --- .github/workflows/pages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9651bcf39..38b666e4d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -3,7 +3,6 @@ name: Build GitHub pages on: push: branches: - - master - develop jobs: From e65411f3d87603b52785b92ac1f57ec05e6664aa Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 27 Jul 2021 11:55:44 +0100 Subject: [PATCH 04/15] Also need to strip the newline after the comment --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 38b666e4d..4b233a1c1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v2 - name: Strip .. comment block from rst - run: sed -i "s/.. comment/.. /g" optimade.rst + run: sed -i -z "s/.. comment\n/.. /g" optimade.rst - name: Run Pandoc run: | From 90deee6380888c131751dbeae20717c86e01a097 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 27 Jul 2021 11:58:20 +0100 Subject: [PATCH 05/15] Force delete old gh-pages branch --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 4b233a1c1..852cd2af0 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -33,7 +33,7 @@ jobs: - name: Commit to gh-pages run: | - git branch -D gh-pages + git branch -D gh-pages || true git checkout -b gh-pages git config user.name "${COMMIT_AUTHOR}" git config user.name "${COMMIT_AUTHOR_EMAIL}" From 1bad6d35ac3d9e80d53930e9cee253c3ab9cd210 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 3 Aug 2021 11:57:06 +0100 Subject: [PATCH 06/15] Add TOC/section numbering --- .github/workflows/pages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 852cd2af0..c2bd263df 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -27,6 +27,8 @@ jobs: docker run -v $(pwd):/mnt pandoc/ubuntu \ --standalone \ --output=/mnt/optimade.html \ + --toc \ + --number-sections \ --to=html \ --metadata-file=/mnt/.github/pages/metadata.yml \ /mnt/optimade.rst From fcf97567ff3523255cffd5a58ffa8ff1fbca58e2 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 30 Nov 2021 12:03:48 +0000 Subject: [PATCH 07/15] Use pandoc for make html rule and spread to CI --- .github/workflows/pages.yml | 17 ++++--------- tests/makefiles/Makelocal-output | 3 +-- tests/makefiles/build_html.sh | 25 +++++++++++++++++++ .../makefiles/html_build_metadata.yml | 0 4 files changed, 31 insertions(+), 14 deletions(-) create mode 100755 tests/makefiles/build_html.sh rename .github/pages/metadata.yml => tests/makefiles/html_build_metadata.yml (100%) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index c2bd263df..e57d04750 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -18,20 +18,13 @@ jobs: - uses: actions/checkout@v2 - - name: Strip .. comment block from rst - run: sed -i -z "s/.. comment\n/.. /g" optimade.rst - - name: Run Pandoc run: | - docker pull pandoc/ubuntu - docker run -v $(pwd):/mnt pandoc/ubuntu \ - --standalone \ - --output=/mnt/optimade.html \ - --toc \ - --number-sections \ - --to=html \ - --metadata-file=/mnt/.github/pages/metadata.yml \ - /mnt/optimade.rst + docker run \ + -v $(pwd):/data \ + --entrypoint /data/tests/makefiles/build_html.sh \ + pandoc/ubuntu:2.16.2 \ + ./optimade.rst - name: Commit to gh-pages run: | diff --git a/tests/makefiles/Makelocal-output b/tests/makefiles/Makelocal-output index 45c0b69b9..d7b5cee78 100644 --- a/tests/makefiles/Makelocal-output +++ b/tests/makefiles/Makelocal-output @@ -18,5 +18,4 @@ HTML_FILES = ${RST_FILES:%.rst=%.html} html: ${HTML_FILES} %.html: %.rst - rst2html --syntax-highlight=none $< $@ - + ./tests/makefiles/build_html.sh $< diff --git a/tests/makefiles/build_html.sh b/tests/makefiles/build_html.sh new file mode 100755 index 000000000..3e8b357d1 --- /dev/null +++ b/tests/makefiles/build_html.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Builds an HTML version of the OPTIMADE specification. +# Intended use is either: +# * via the makefile at the root of the repository. +# * directly using a Docker invocation like: +# docker run \ +# -v `pwd`:/data \ +# --entrypoint /data/tests/makefiles/build_html.sh \ +# pandoc/ubuntu:latest \ +# optimade.rst + +# Setting the `--metadata-file` will not work if called from +# other dirs. + +# pandoc does not quite understand .rst '.. comment' blocks +sed -z "s/.. comment\n/.. /g" $1 > .stripped_comments.rst +pandoc \ + --standalone \ + --toc \ + --number-sections \ + --metadata-file=./tests/makefiles/html_build_metadata.yml \ + .stripped_comments.rst \ + -o ${1/.rst/.html} +rm .stripped_comments.rst \ No newline at end of file diff --git a/.github/pages/metadata.yml b/tests/makefiles/html_build_metadata.yml similarity index 100% rename from .github/pages/metadata.yml rename to tests/makefiles/html_build_metadata.yml From fa42658292d42dbe4784fecb564149d1f1906536 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Sun, 17 Mar 2024 18:53:38 +0100 Subject: [PATCH 08/15] Update HTML build with dark mode and toc using rst2hmtl5 --- .github/workflows/pages.yml | 16 +- tests/makefiles/Makelocal-output | 2 +- tests/makefiles/build_html.sh | 25 -- tests/makefiles/style.css | 542 +++++++++++++++++++++++++++++++ 4 files changed, 552 insertions(+), 33 deletions(-) delete mode 100755 tests/makefiles/build_html.sh create mode 100644 tests/makefiles/style.css diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e57d04750..956bd0914 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -18,13 +18,15 @@ jobs: - uses: actions/checkout@v2 - - name: Run Pandoc - run: | - docker run \ - -v $(pwd):/data \ - --entrypoint /data/tests/makefiles/build_html.sh \ - pandoc/ubuntu:2.16.2 \ - ./optimade.rst + - uses: actions/setup-python@v4 + with: + python-version: 3.10 + + - name: Install dependencies + run: pip install docutils + + - name: Run rst2html + run: make html - name: Commit to gh-pages run: | diff --git a/tests/makefiles/Makelocal-output b/tests/makefiles/Makelocal-output index d7b5cee78..47b889a76 100644 --- a/tests/makefiles/Makelocal-output +++ b/tests/makefiles/Makelocal-output @@ -18,4 +18,4 @@ HTML_FILES = ${RST_FILES:%.rst=%.html} html: ${HTML_FILES} %.html: %.rst - ./tests/makefiles/build_html.sh $< + rst2html5.py -d --syntax-highlight=none --stylesheet=./tests/makefiles/style.css $< $@ diff --git a/tests/makefiles/build_html.sh b/tests/makefiles/build_html.sh deleted file mode 100755 index 3e8b357d1..000000000 --- a/tests/makefiles/build_html.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# Builds an HTML version of the OPTIMADE specification. -# Intended use is either: -# * via the makefile at the root of the repository. -# * directly using a Docker invocation like: -# docker run \ -# -v `pwd`:/data \ -# --entrypoint /data/tests/makefiles/build_html.sh \ -# pandoc/ubuntu:latest \ -# optimade.rst - -# Setting the `--metadata-file` will not work if called from -# other dirs. - -# pandoc does not quite understand .rst '.. comment' blocks -sed -z "s/.. comment\n/.. /g" $1 > .stripped_comments.rst -pandoc \ - --standalone \ - --toc \ - --number-sections \ - --metadata-file=./tests/makefiles/html_build_metadata.yml \ - .stripped_comments.rst \ - -o ${1/.rst/.html} -rm .stripped_comments.rst \ No newline at end of file diff --git a/tests/makefiles/style.css b/tests/makefiles/style.css new file mode 100644 index 000000000..40378d6bb --- /dev/null +++ b/tests/makefiles/style.css @@ -0,0 +1,542 @@ +@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); + +:root { + --bg-color: white; + --fg-color: #505050; + --code-bg-color: #F0F0F0; + --code-fg-color: #282828; + --primary: #007bff; + --secondary: #50fa7b; + --tertiary: #ff414d; + --quaternary: #7a2dd0; + --external-refs: var(--secondary); + --inline-refs: var(--primary); +} + +@media (prefers-color-scheme: dark) { + :root { + --bg-color: #161625; + --fg-color: #dcdcdc; + --code-fg-color: #f8f8f8; + --code-bg-color: #3a3d4d; + --primary: #007bff; + --secondary: #50fa7b; + --tertiary: #ff414d; + --quaternary: #7a2dd0; + --external-refs: var(--secondary); + --inline-refs: var(--tertiary); + + } +} + +body { + font-family: Roboto, Arial, Helvetica, 'Liberation Sans', sans-serif; + font-size: 16px; + color: var(--fg-color); +} + +div.document { + margin: 0 auto; + margin-left: auto; + margin-right: auto; + max-width: 900px; + background-color: var(--bg-color); +} + +.reference.internal { + text-decoration: dotted underline; + text-decoration-thickness: 2px; + text-decoration-color: var(--inline-refs); + text-decoration-skip-ink: none; + text-underline-offset: 2px; + color: var(--fg-color); +} + +.auto-toc .reference.internal { + text-decoration: none; +} + +.auto-toc .reference.internal .sectnum { + text-decoration: dotted underline; + text-decoration-thickness: 2px; + text-decoration-color: var(--inline-refs); +} + + +.reference.external { + text-decoration: dotted underline; + text-decoration-thickness: 2px; + text-underline-offset: 2px; + text-decoration-color: var(--external-refs); + color: var(--fg-color); +} + + + +/* Minimal style sheet for the HTML output of Docutils. */ +/* */ +/* :Author: Günter Milde, based on html4css1.css by David Goodger */ +/* :Id: $Id: minimal.css 9079 2022-06-19 14:00:56Z milde $ */ +/* :Copyright: © 2015, 2021 Günter Milde. */ +/* :License: Released under the terms of the `2-Clause BSD license`_, */ +/* in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ + +/* This CSS3 stylesheet defines rules for Docutils elements without */ +/* HTML equivalent. It is required to make the document semantics visible. */ +/* */ +/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link */ + +/* titles */ +p.topic-title, +p.admonition-title, +p.system-message-title { + font-weight: bold; +} +p.sidebar-title, +p.rubric { + font-weight: bold; + font-size: larger; +} +p.rubric { + color: maroon; +} +p.subtitle, +p.section-subtitle, +p.sidebar-subtitle { + font-weight: bold; + margin-top: -0.5em; +} +h1 + p.subtitle { + font-size: 1.6em; +} +a.toc-backref { + color: inherit; + text-decoration: none; +} + +/* Warnings, Errors */ +.system-messages h2, +.system-message-title, +span.problematic { + color: red; +} + +/* Inline Literals */ +.docutils.literal { + font-family: monospace; + white-space: pre-wrap; + color: var(--code-fg-color); + background-color: var(--code-bg-color); + border-radius: 0.2em; + overflow-wrap: anywhere; + padding-left: 4px; + padding-right: 4px; + padding-top: 2px; + padding-bottom: 2px; +} +/* do not wrap at hyphens and similar: */ +/*.literal > span.pre { white-space: nowrap; }*/ + +/* Lists */ + +/* compact and simple lists: no margin between items */ +.simple li, .simple ul, .simple ol, +.compact li, .compact ul, .compact ol, +.simple > li p, dl.simple > dd, +.compact > li p, dl.compact > dd { + margin-top: 0; + margin-bottom: 0; +} +/* Nested Paragraphs */ +p:first-child { margin-top: 0; } +p:last-child { margin-bottom: 0; } +details > p:last-child { margin-bottom: 1em; } + +/* Table of Contents */ +.contents ul.auto-toc { /* section numbers present */ + list-style-type: none; +} + +/* Enumerated Lists */ +ol.arabic { list-style: decimal } +ol.loweralpha { list-style: lower-alpha } +ol.upperalpha { list-style: upper-alpha } +ol.lowerroman { list-style: lower-roman } +ol.upperroman { list-style: upper-roman } + +/* Definition Lists and Derivatives */ +dt .classifier { font-style: italic } +dt .classifier:before { + font-style: normal; + margin: 0.5em; + content: ":"; +} +/* Field Lists and similar */ +/* bold field name, content starts on the same line */ +dl.field-list, +dl.option-list, +dl.docinfo { + display: flow-root; +} +dl.field-list > dt, +dl.option-list > dt, +dl.docinfo > dt { + font-weight: bold; + clear: left; + float: left; + margin: 0; + padding: 0; + padding-right: 0.2em; +} +/* Offset for field content (corresponds to the --field-name-limit option) */ +dl.field-list > dd, +dl.option-list > dd, +dl.docinfo > dd { + margin-left: 9em; /* ca. 14 chars in the test examples, fit all Docinfo fields */ +} +/* start nested lists on new line */ +dd > dl:first-child, +dd > ul:first-child, +dd > ol:first-child { + clear: left; +} +/* start field-body on a new line after long field names */ +dl.field-list > dd > *:first-child, +dl.option-list > dd > *:first-child +{ + display: inline-block; + width: 100%; + margin: 0; +} + +/* Bibliographic Fields (docinfo) */ +dl.docinfo pre.address { + font: inherit; + margin: 0.5em 0; +} +dl.docinfo > dd.authors > p { margin: 0; } + +/* Option Lists */ +dl.option-list > dt { font-weight: normal; } +span.option { white-space: nowrap; } + +/* Footnotes and Citations */ + +.footnote, .citation { margin: 1em 0; } /* default paragraph skip (Firefox) */ +/* hanging indent */ +.citation { padding-left: 2em; } +.footnote { padding-left: 1.7em; } +.footnote.superscript { padding-left: 1.0em; } +.citation > .label { margin-left: -2em; } +.footnote > .label { margin-left: -1.7em; } +.footnote.superscript > .label { margin-left: -1.0em; } + +.footnote > .label + *, +.citation > .label + * { + display: inline-block; + margin-top: 0; + vertical-align: top; +} +.footnote > .backrefs + *, +.citation > .backrefs + * { + margin-top: 0; +} +.footnote > .label + p, .footnote > .backrefs + p, +.citation > .label + p, .citation > .backrefs + p { + display: inline; + vertical-align: inherit; +} + +.backrefs { user-select: none; } +.backrefs > a { font-style: italic; } + +/* superscript footnotes */ +a[role="doc-noteref"].superscript, +.footnote.superscript > .label, +.footnote.superscript > .backrefs { + vertical-align: super; + font-size: smaller; + line-height: 1; +} +a[role="doc-noteref"].superscript > .fn-bracket, +.footnote.superscript > .label > .fn-bracket { + /* hide brackets in display but leave for copy/paste */ + display: inline-block; + width: 0; + overflow: hidden; +} +[role="doc-noteref"].superscript + [role="doc-noteref"].superscript { + padding-left: 0.15em; /* separate consecutive footnote references */ + /* TODO: unfortunately, "+" also selects with text between the references. */ +} + +/* Alignment */ +.align-left { + text-align: left; + margin-right: auto; +} +.align-center { + text-align: center; + margin-left: auto; + margin-right: auto; +} +.align-right { + text-align: right; + margin-left: auto; +} +.align-top { vertical-align: top; } +.align-middle { vertical-align: middle; } +.align-bottom { vertical-align: bottom; } + +/* reset inner alignment in figures and tables */ +figure.align-left, figure.align-right, +table.align-left, table.align-center, table.align-right { + text-align: inherit; +} + +/* Text Blocks */ +.topic { margin: 1em 2em; } +.sidebar, +.admonition, +.system-message { + margin: 1em 2em; + border: thin solid; + padding: 0.5em 1em; +} +div.line-block { display: block; } +div.line-block div.line-block, pre { margin-left: 2em; } + +/* Tables */ +table { + border-collapse: collapse; +} +td, th { + border: thin solid silver; + padding: 0 1ex; +} +.borderless td, .borderless th { + border: 0; + padding: 0; + padding-right: 0.5em /* separate table cells */ +} + +table > caption { + text-align: left; + margin-top: 0.2em; + margin-bottom: 0.2em; +} +table.captionbelow { + caption-side: bottom; +} + +/* Document Header and Footer */ +header { border-bottom: 1px solid black; } +footer { border-top: 1px solid black; } + +/* Images are block-level by default in Docutils */ +/* New HTML5 block elements: set display for older browsers */ +img, header, footer, main, aside, nav, section, figure, video, details { + display: block; +} +/* inline images */ +p img, p video, figure img, figure video { + display: inline; +} + + +/* CSS31_ style sheet for the output of Docutils HTML writers. */ +/* Rules for easy reading and pre-defined style variants. */ +/* */ +/* :Author: Günter Milde, based on html4css1.css by David Goodger */ +/* :Id: $Id: plain.css 9338 2023-04-08 21:08:47Z milde $ */ +/* :Copyright: © 2015 Günter Milde. */ +/* :License: Released under the terms of the `2-Clause BSD license`_, */ +/* in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ +/* .. _CSS3: https://www.w3.org/Style/CSS/ */ + + +/* Document Structure */ +/* ****************** */ + +/* "page layout" */ +body { + margin: 0; + max-width: 900px; + background-color: var(--bg-color); + --field-indent: 9em; /* default indent of fields in field lists */ +} +main, footer, header { + line-height:1.6; + /* avoid long lines --> better reading */ + /* optimum is 45…75 characters/line */ + /* OTOH: lines should not be too short because of missing hyphenation, */ + max-width: 60rem; + padding: 1px 2%; /* 1px on top avoids grey bar above title (mozilla) */ + margin: auto; +} +main { + counter-reset: table figure; + background-color: var(--bg-color); +} +footer, header { + font-size: smaller; + padding: 0.5em 2%; + border: none; +} + +/* Table of Contents */ +ul.auto-toc > li > p { + padding-left: 1em; + text-indent: -1em; +} +nav.contents ul { + padding-left: 1em; +} +main > nav.contents ul ul ul ul:not(.auto-toc) { + list-style-type: '\2B29\ '; +} +main > nav.contents ul ul ul ul ul:not(.auto-toc) { + list-style-type: '\2B1D\ '; +} + +/* Transitions */ +hr.docutils { + width: 80%; + margin-top: 1em; + margin-bottom: 1em; + clear: both; +} + +/* Paragraphs */ + +/* vertical space (parskip) */ +p, ol, ul, dl, li, +div.line-block, +.footnote, .citation, +div > math, +table { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +h1, h2, h3, h4, h5, h6, +dd, details > p:last-child { + margin-bottom: 0.5em; +} + +/* Lists */ +/* ===== */ + +/* Definition Lists */ +/* Indent lists nested in definition lists */ +dd > ul:only-child, dd > ol:only-child { padding-left: 1em; } + +/* Description Lists */ +/* styled like in most dictionaries, encyclopedias etc. */ +dl.description { + display: flow-root; +} +dl.description > dt { + font-weight: bold; + clear: left; + float: left; + margin: 0; + padding: 0; + padding-right: 0.3em; +} +dl.description > dd:after { + display: table; + content: ""; + clear: left; /* clearfix for empty descriptions */ +} + +/* Field Lists */ + +dl.field-list > dd, +dl.docinfo > dd { + margin-left: var(--field-indent); /* adapted in media queries or HTML */ +} + +/* example for custom field-name width */ +dl.field-list.narrow > dd { + --field-indent: 5em; +} +/* run-in: start field-body on same line after long field names */ +dl.field-list.run-in > dd p { + display: block; +} + +/* Bibliographic Fields */ + +/* generally, bibliographic fields use dl.docinfo */ +/* but dedication and abstract are placed into divs */ +div.abstract p.topic-title { + text-align: center; +} +div.dedication { + margin: 2em 5em; + text-align: center; + font-style: italic; +} +div.dedication p.topic-title { + font-style: normal; +} + +/* disclosures */ +details { padding-left: 1em; } +summary { margin-left: -1em; } + +/* Text Blocks */ +/* =========== */ + +/* Literal Blocks */ +pre.literal-block, pre.doctest-block, +pre.math, pre.code { + font-family: monospace; + background-color: var(--code-bg-color); + border: thin solid var(--fg-color); + color: var(--code-fg-color); + border-radius: 0.2em; + +} + +/* Block Quotes and Topics */ +blockquote { + background-color: var(--code-bg-color); + color: var(--fg-color); + border: thin solid var(--fg-color); + border-radius: 0.2em; + padding: 0.5em 1em; +} +blockquote p.attribution, +.topic p.attribution { + text-align: right; + margin-left: 20%; +} + +/* Code */ +pre.code { padding: 0.7ex } +pre.code, code { + background-color: var(--code-bg-color); + color: var(--code-fg-color); +} + +sup, sub { line-height: 0.8; } /* do not add leading for lines with sup/sub */ +/* Hyperlink References */ +a { text-decoration: none; } From 340e0c9a2e62b18beffe66d15c1aa52d4c9a3600 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Sun, 17 Mar 2024 18:57:19 +0100 Subject: [PATCH 09/15] Linting --- tests/makefiles/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/makefiles/style.css b/tests/makefiles/style.css index 40378d6bb..ec946d69d 100644 --- a/tests/makefiles/style.css +++ b/tests/makefiles/style.css @@ -517,7 +517,7 @@ pre.math, pre.code { } /* Block Quotes and Topics */ -blockquote { +blockquote { background-color: var(--code-bg-color); color: var(--fg-color); border: thin solid var(--fg-color); @@ -532,7 +532,7 @@ blockquote p.attribution, /* Code */ pre.code { padding: 0.7ex } -pre.code, code { +pre.code, code { background-color: var(--code-bg-color); color: var(--code-fg-color); } From 22af4c66223f602b7d594271b2a49dc40dce487f Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Sun, 17 Mar 2024 18:58:08 +0100 Subject: [PATCH 10/15] Fix Python version in CI --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 956bd0914..10f7080e2 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: 3.10 + python-version: '3.10' - name: Install dependencies run: pip install docutils From d127d4151885c2cece97ff945473d505102ecd3a Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Sun, 17 Mar 2024 19:01:40 +0100 Subject: [PATCH 11/15] Fix CI git config --- .github/workflows/pages.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 10f7080e2..ea0be6e90 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,8 +11,8 @@ jobs: runs-on: ubuntu-latest env: - COMMIT_AUTHOR: Pages Deployment - COMMIT_AUTHOR_EMAIL: action@github.com + COMMIT_AUTHOR: OPTIMADE developers + COMMIT_AUTHOR_EMAIL: dev@optimade.org steps: @@ -28,12 +28,15 @@ jobs: - name: Run rst2html run: make html + - name: Configure git + run: | + git config --global user.name "${COMMIT_AUTHOR}" + git config --global user.email "${COMMIT_AUTHOR_EMAIL}" + - name: Commit to gh-pages run: | git branch -D gh-pages || true git checkout -b gh-pages - git config user.name "${COMMIT_AUTHOR}" - git config user.name "${COMMIT_AUTHOR_EMAIL}" git add optimade.html git commit -m "Deploy to GitHub Pages: ${SHA}" if git diff --cached --quiet; then From bcb36a6e1d4e4ecee9e556f11d90c8cb6e3bd340 Mon Sep 17 00:00:00 2001 From: Matthew Evans <7916000+ml-evs@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:07:10 +0100 Subject: [PATCH 12/15] Apply suggestions from code review Co-authored-by: Antanas Vaitkus Co-authored-by: Rickard Armiento --- tests/makefiles/Makelocal-output | 4 ++-- tests/makefiles/style.css | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/makefiles/Makelocal-output b/tests/makefiles/Makelocal-output index 47b889a76..2da060d66 100644 --- a/tests/makefiles/Makelocal-output +++ b/tests/makefiles/Makelocal-output @@ -17,5 +17,5 @@ HTML_FILES = ${RST_FILES:%.rst=%.html} html: ${HTML_FILES} -%.html: %.rst - rst2html5.py -d --syntax-highlight=none --stylesheet=./tests/makefiles/style.css $< $@ +%.html: %.rst ./tests/makefiles/ + rst2html5 -d --syntax-highlight=none --stylesheet=$(word 2, $^) $< $@ diff --git a/tests/makefiles/style.css b/tests/makefiles/style.css index ec946d69d..23a3723b1 100644 --- a/tests/makefiles/style.css +++ b/tests/makefiles/style.css @@ -2,7 +2,7 @@ :root { --bg-color: white; - --fg-color: #505050; + --fg-color: #000000; --code-bg-color: #F0F0F0; --code-fg-color: #282828; --primary: #007bff; @@ -513,7 +513,8 @@ pre.math, pre.code { border: thin solid var(--fg-color); color: var(--code-fg-color); border-radius: 0.2em; - + padding-left: 0.5em; +overflow: auto; } /* Block Quotes and Topics */ From c93b423c3e75948821e51d4a12ae4e01e39bcf5b Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Mon, 18 Mar 2024 21:20:52 +0100 Subject: [PATCH 13/15] Choose rst2html5 executable dynamically --- tests/makefiles/Makelocal-output | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/makefiles/Makelocal-output b/tests/makefiles/Makelocal-output index 2da060d66..15cea901f 100644 --- a/tests/makefiles/Makelocal-output +++ b/tests/makefiles/Makelocal-output @@ -18,4 +18,8 @@ HTML_FILES = ${RST_FILES:%.rst=%.html} html: ${HTML_FILES} %.html: %.rst ./tests/makefiles/ - rst2html5 -d --syntax-highlight=none --stylesheet=$(word 2, $^) $< $@ + RST2HTML5 = $(shell which rst2html5.py 2>/dev/null || which rst2html5 2>/dev/null || echo "") + ifeq ($(RST2HTML5),) + $(error Neither rst2html5.py nor rst2html5 found in PATH) + endif + $(RST2HTML5) -d --syntax-highlight=none --stylesheet=$(word 2, $^) $< $@ From 46409242b10de338eb96f397641aed4ca3e04fee Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Mon, 18 Mar 2024 21:30:12 +0100 Subject: [PATCH 14/15] Use better default mono font --- tests/makefiles/style.css | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/makefiles/style.css b/tests/makefiles/style.css index 23a3723b1..ba3d5c071 100644 --- a/tests/makefiles/style.css +++ b/tests/makefiles/style.css @@ -1,4 +1,5 @@ @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap'); :root { --bg-color: white; @@ -11,6 +12,8 @@ --quaternary: #7a2dd0; --external-refs: var(--secondary); --inline-refs: var(--primary); + --monospace-font-family: "JetBrains Mono", monospace; + --sans-serif-font-family: Roboto, Arial, Helvetica, 'Liberation Sans', sans-serif; } @media (prefers-color-scheme: dark) { @@ -25,12 +28,14 @@ --quaternary: #7a2dd0; --external-refs: var(--secondary); --inline-refs: var(--tertiary); + --monospace-font-family: "JetBrains Mono", monospace; + --sans-serif-font-family: Roboto, Arial, Helvetica, 'Liberation Sans', sans-serif; } } body { - font-family: Roboto, Arial, Helvetica, 'Liberation Sans', sans-serif; + font-family: var(--sans-serif-font-family); font-size: 16px; color: var(--fg-color); } @@ -131,7 +136,7 @@ span.problematic { /* Inline Literals */ .docutils.literal { - font-family: monospace; + font-family: var(--monospace-font-family); white-space: pre-wrap; color: var(--code-fg-color); background-color: var(--code-bg-color); @@ -508,7 +513,7 @@ summary { margin-left: -1em; } /* Literal Blocks */ pre.literal-block, pre.doctest-block, pre.math, pre.code { - font-family: monospace; + font-family: var(--monospace-font-family); background-color: var(--code-bg-color); border: thin solid var(--fg-color); color: var(--code-fg-color); @@ -535,6 +540,7 @@ blockquote p.attribution, pre.code { padding: 0.7ex } pre.code, code { background-color: var(--code-bg-color); + font-family: var(--monospace-font-family); color: var(--code-fg-color); } From 64667755b6f53cf907665ff46e868b431bdc2836 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Mon, 18 Mar 2024 21:40:26 +0100 Subject: [PATCH 15/15] Fix makefile --- tests/makefiles/Makelocal-output | 8 ++------ tests/makefiles/html_build_metadata.yml | 8 -------- 2 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 tests/makefiles/html_build_metadata.yml diff --git a/tests/makefiles/Makelocal-output b/tests/makefiles/Makelocal-output index 15cea901f..a6ae35cc3 100644 --- a/tests/makefiles/Makelocal-output +++ b/tests/makefiles/Makelocal-output @@ -17,9 +17,5 @@ HTML_FILES = ${RST_FILES:%.rst=%.html} html: ${HTML_FILES} -%.html: %.rst ./tests/makefiles/ - RST2HTML5 = $(shell which rst2html5.py 2>/dev/null || which rst2html5 2>/dev/null || echo "") - ifeq ($(RST2HTML5),) - $(error Neither rst2html5.py nor rst2html5 found in PATH) - endif - $(RST2HTML5) -d --syntax-highlight=none --stylesheet=$(word 2, $^) $< $@ +%.html: %.rst ./tests/makefiles/style.css + $(shell which rst2html5.py || which rst2html5 || echo "rst2html5.py") -d --syntax-highlight=none --stylesheet=$(word 2, $^) $< $@ diff --git a/tests/makefiles/html_build_metadata.yml b/tests/makefiles/html_build_metadata.yml deleted file mode 100644 index c215c111c..000000000 --- a/tests/makefiles/html_build_metadata.yml +++ /dev/null @@ -1,8 +0,0 @@ -author: - - The OPTIMADE consortium -title: The OPTIMADE Specification -mainfont: Arial,Helvetica Neue,sans-serif -linkcolor: cornflowerblue -monofont: monospace -monobackgroundcolor: "#F1F1F1" -backgroundcolor: "white"