From c266e28a8019a9bfa1b7d0284f50fbff7bf6149f Mon Sep 17 00:00:00 2001 From: Alex Burke Date: Wed, 24 Jul 2024 14:38:12 +0200 Subject: [PATCH] Implement a notion of multiple sites. --- Makefile | 6 ++- docs/{ => _sites/erda.dk}/conf.py | 28 ++++++++++--- docs/_sites/erda.dk/variables.ini | 2 + docs/_sites/generic/conf.py | 65 +++++++++++++++++++++++++++++ docs/_sites/generic/variables.ini | 2 + docs/_sites/sif.ku.dk/conf.py | 65 +++++++++++++++++++++++++++++ docs/_sites/sif.ku.dk/variables.ini | 2 + docs/index.rst | 6 +-- 8 files changed, 166 insertions(+), 10 deletions(-) rename docs/{ => _sites/erda.dk}/conf.py (68%) create mode 100644 docs/_sites/erda.dk/variables.ini create mode 100644 docs/_sites/generic/conf.py create mode 100644 docs/_sites/generic/variables.ini create mode 100644 docs/_sites/sif.ku.dk/conf.py create mode 100644 docs/_sites/sif.ku.dk/variables.ini diff --git a/Makefile b/Makefile index 66caa56..143f740 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ +BRANDING := erda.dk +CONFIGDIR = "./docs/_sites/$(BRANDING)" SPHINXBUILD = ./.venv/bin/sphinx-build -SPHINXOPTS = +SPHINXOPTS = -c "$(CONFIGDIR)" SOURCEDIR = docs -BUILDDIR = build +BUILDDIR = "build/$(BRANDING)" # Put it first so that "make" without argument is like "make help". .PHONY: help diff --git a/docs/conf.py b/docs/_sites/erda.dk/conf.py similarity index 68% rename from docs/conf.py rename to docs/_sites/erda.dk/conf.py index af41fea..8cfb2b3 100644 --- a/docs/conf.py +++ b/docs/_sites/erda.dk/conf.py @@ -1,13 +1,31 @@ # Configuration file for the modi-helper-scripts documentation site. # import sphinx_rtd_theme +from configparser import ConfigParser +import os +from types import SimpleNamespace + +_SITE_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def _sitevars_and_epilog(): + parser = ConfigParser() + parser.read(os.path.join(_SITE_DIR, "variables.ini")) + + sitevars = SimpleNamespace(**parser['site']) + + epilog_lines = [".. |%s| replace:: %s" % (k, v) for k, v in sitevars.__dict__.items()] + epilog = '\n'.join(epilog_lines) + + return sitevars, epilog + # -- Project information ----------------------------------------------------- -project = "ERDA & SIF support" +sitevars, rst_epilog = _sitevars_and_epilog() +project = "%s support" % (sitevars.project_name,) copyright = "2023 SCIENCE HPC Center Support Team" author = "SCIENCE HPC Center Support Team" - # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be @@ -27,7 +45,7 @@ exclude_patterns = [] # HTML logo which will show on top of the sidebar -html_logo = "_static/faelles.svg" +html_logo = "../../_static/faelles.svg" # -- Options for HTML output ------------------------------------------------- @@ -39,7 +57,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] +html_static_path = ["../../_static"] html_css_files = ["custom.css"] # Favicon for browsertab etcetera -html_favicon = '_static/favicon.ico' +html_favicon = '../../_static/favicon.ico' diff --git a/docs/_sites/erda.dk/variables.ini b/docs/_sites/erda.dk/variables.ini new file mode 100644 index 0000000..db7a302 --- /dev/null +++ b/docs/_sites/erda.dk/variables.ini @@ -0,0 +1,2 @@ +[site] +project_name = ERDA & SIF diff --git a/docs/_sites/generic/conf.py b/docs/_sites/generic/conf.py new file mode 100644 index 0000000..c5fa2c7 --- /dev/null +++ b/docs/_sites/generic/conf.py @@ -0,0 +1,65 @@ +# Configuration file for the modi-helper-scripts documentation site. +# import sphinx_rtd_theme + +from configparser import ConfigParser +import os +from types import SimpleNamespace + +_SITE_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def _sitevars_and_epilog(): + parser = ConfigParser() + parser.read(os.path.join(_SITE_DIR, "variables.ini")) + + sitevars = SimpleNamespace(**parser['site']) + + epilog_lines = [".. |%s| replace:: %s" % (k, v) for k, v in sitevars.__dict__.items()] + epilog = '\n'.join(epilog_lines) + + return sitevars, epilog + + +# -- Project information ----------------------------------------------------- + +sitevars, rst_epilog = _sitevars_and_epilog() +project = "%s support" % (sitevars.project_name,) +copyright = "2023 SCIENCE HPC Center Support Team" +author = "SCIENCE HPC Center Support Team" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx_rtd_theme", + "sphinxemoji.sphinxemoji", +] +pygments_style = 'sphinx' +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# HTML logo which will show on top of the sidebar +html_logo = "../../_static/faelles.svg" + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["../../_static"] +html_css_files = [] +# Favicon for browsertab etcetera +html_favicon = '../../_static/favicon.ico' diff --git a/docs/_sites/generic/variables.ini b/docs/_sites/generic/variables.ini new file mode 100644 index 0000000..c63bc55 --- /dev/null +++ b/docs/_sites/generic/variables.ini @@ -0,0 +1,2 @@ +[site] +project_name = Generic diff --git a/docs/_sites/sif.ku.dk/conf.py b/docs/_sites/sif.ku.dk/conf.py new file mode 100644 index 0000000..c5fa2c7 --- /dev/null +++ b/docs/_sites/sif.ku.dk/conf.py @@ -0,0 +1,65 @@ +# Configuration file for the modi-helper-scripts documentation site. +# import sphinx_rtd_theme + +from configparser import ConfigParser +import os +from types import SimpleNamespace + +_SITE_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def _sitevars_and_epilog(): + parser = ConfigParser() + parser.read(os.path.join(_SITE_DIR, "variables.ini")) + + sitevars = SimpleNamespace(**parser['site']) + + epilog_lines = [".. |%s| replace:: %s" % (k, v) for k, v in sitevars.__dict__.items()] + epilog = '\n'.join(epilog_lines) + + return sitevars, epilog + + +# -- Project information ----------------------------------------------------- + +sitevars, rst_epilog = _sitevars_and_epilog() +project = "%s support" % (sitevars.project_name,) +copyright = "2023 SCIENCE HPC Center Support Team" +author = "SCIENCE HPC Center Support Team" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx_rtd_theme", + "sphinxemoji.sphinxemoji", +] +pygments_style = 'sphinx' +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# HTML logo which will show on top of the sidebar +html_logo = "../../_static/faelles.svg" + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["../../_static"] +html_css_files = [] +# Favicon for browsertab etcetera +html_favicon = '../../_static/favicon.ico' diff --git a/docs/_sites/sif.ku.dk/variables.ini b/docs/_sites/sif.ku.dk/variables.ini new file mode 100644 index 0000000..5efc540 --- /dev/null +++ b/docs/_sites/sif.ku.dk/variables.ini @@ -0,0 +1,2 @@ +[site] +project_name = Secure Information Facility diff --git a/docs/index.rst b/docs/index.rst index b33d65e..5d26a42 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ .. _index-start: -ERDA/SIF: User Guides -===================== +|project_name|: User Guides +=========================== .. toctree:: :maxdepth: 2 @@ -39,7 +39,7 @@ Welcome to the documentation site for ERDA and SIF! `ERDA ` To quickly get started with ERDA or SIF, we recommend our :ref:`getting-started` page. If you are looking for something specific, the search functionality and the sidebar on the left is a good way to find what you are looking for! -|:file_cabinet:| About ERDA +|:file_cabinet:| About |project_name| ERDA (Electronic Research Data Archive) at the University of Copenhagen (KU/UCPH) is meant for storing, sharing, analyzing and archiving research data. ERDA delivers safe central storage space for ones own and shared files, interactive analysis tools in addition to archiving for safe-keeping and publishing.