Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boilerplate/copyright.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Copyright © 2020-[YEAR]
<a href="https://www.openmicroscopy.org/"><abbr title="Open Microscopy Environment">OME</abbr></a><sup>®</sup>
(<a href="https://dundee.ac.uk/"><abbr title="University of Dundee">U. Dundee</abbr></a>).
OME trademark rules apply.
31 changes: 31 additions & 0 deletions boilerplate/header.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>[TITLE]</title>
<style data-fill-with="stylesheet">
</style>
</head>
<body class="h-entry">
<div class="head">

<img src="http://www.openmicroscopy.org/img/logos/ome-logomark.svg" alt="OME logo (6 circles in a hexagon)" style="float:right;width:42px;height:42px;">

<h1 id="title" class="p-name no-ref">[TITLE]</h1>
<h2 id="subtitle" class="no-num no-toc no-ref">[LONGSTATUS],
<time class="dt-updated" datetime="[ISODATE]">[DATE]</time></h2>
<div data-fill-with="spec-metadata"></div>
<div data-fill-with="warning"></div>
<p class='copyright' data-fill-with='copyright'></p>
<hr title="Separator for header">
</div>

<div class="p-summary" data-fill-with="abstract"></div>

<h2 class='no-num no-toc no-ref' id='sotd'>Status of this document</h2>
<div data-fill-with="status"></div>
<div data-fill-with="at-risk"></div>

<nav data-fill-with="table-of-contents" id="toc"></nav>
<main>
64 changes: 43 additions & 21 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
"myst_parser",
"sphinx_reredirects",
"sphinx_design",
"sphinxcontrib.bibtex"]
"sphinxcontrib.bibtex",
]
bibtex_bibfiles = ["references.bib"]
source_suffix = [".rst", ".md"]
myst_heading_anchors = 5
myst_enable_extensions = [
"deflist",
"strikethrough",
"colon_fence"
]
myst_enable_extensions = ["deflist", "strikethrough", "colon_fence"]

templates_path = ["_templates"]
exclude_patterns = [
Expand Down Expand Up @@ -57,7 +54,7 @@
"latest/index": "../specifications/0.5/index.html",
"latest/": "../specifications/0.5/index.html",
"dev/index": "../specifications/dev/index.html",
"dev/": "../specifications/dev/index.html"
"dev/": "../specifications/dev/index.html",
}

# -- Options for HTML output -------------------------------------------------
Expand Down Expand Up @@ -93,6 +90,7 @@
"_html_extra",
]


def build_served_html():
import glob
import subprocess
Expand All @@ -102,34 +100,58 @@ def build_served_html():
from pathlib import Path

os.chdir(Path(__file__).parent)
versions = [d for d in os.listdir("specifications") if os.path.isdir(os.path.join("specifications", d))]
versions = [
d
for d in os.listdir("specifications")
if os.path.isdir(os.path.join("specifications", d))
]

for version in versions:

# copy schemas to _html_extra
os.makedirs(f'_html_extra/{version}/schemas', exist_ok=True)
schemas = glob.glob(f'specifications/{version}/**/*.schema', recursive=True)
os.makedirs(f"_html_extra/{version}/schemas", exist_ok=True)
schemas = glob.glob(f"specifications/{version}/**/*.schema", recursive=True)
for schema in schemas:
shutil.copy2(schema, f'_html_extra/{version}/schemas/')
print(f'✅ Copied schemas for version {version}')
shutil.copy2(schema, f"_html_extra/{version}/schemas/")
print(f"✅ Copied schemas for version {version}")

# find 'pre_build.py' in 'specifications' subdirectories
script = glob.glob(f'specifications/{version}/**/pre_build.py', recursive=True)[0]
script = glob.glob(f"specifications/{version}/**/pre_build.py", recursive=True)[
0
]

# Inject shared OME boilerplate next to index.bs so the legacy Bikeshed
# build renders OME branding instead of falling back to the W3C default.
# Kept here in the superproject so we never have to edit, commit, and
# bump every ngff-spec version submodule (the includes were lost exactly
# that way during the ngff -> ngff-spec migration).
spec_dir = os.path.dirname(script)
for inc in ("header.include", "copyright.include"):
src = os.path.join("boilerplate", inc)
if os.path.exists(src):
shutil.copy2(src, os.path.join(spec_dir, inc))
print(f"✅ Injected {inc} for version {version}")
else:
print(
f"⚠️ Missing boilerplate/{inc}; {version} will use Bikeshed defaults"
)

subprocess.check_call([sys.executable, script])
print('✅ Built rendered examples/schemas for version', version)
print("✅ Built rendered examples/schemas for version", version)

# build jupyter-book docs in specification submodules
myst_file = glob.glob(f'specifications/{version}/**/myst.yml', recursive=True)[0]
bikeshed_output = f'specifications/{version}/index.html'
myst_file = glob.glob(f"specifications/{version}/**/myst.yml", recursive=True)[
0
]
bikeshed_output = f"specifications/{version}/index.html"

# copy built html files to _html_extra
try:
if os.path.exists(bikeshed_output):
shutil.copy2(bikeshed_output, f'_html_extra/{version}/index.html')
print(f'✅ Found legacy bikeshed, serving as extra html for {version}')
shutil.copy2(bikeshed_output, f"_html_extra/{version}/index.html")
print(f"✅ Found legacy bikeshed, serving as extra html for {version}")
except Exception as e:
print(f'⚠️ Could not copy served html for version {version}: {e}')
print(f"⚠️ Could not copy served html for version {version}: {e}")


build_served_html()

4 changes: 2 additions & 2 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-24.04
tools:
python: "3.10"
python: "3.13"
nodejs: "22"

submodules:
Expand All @@ -21,4 +21,4 @@ python:
install:
- requirements: requirements.txt
- method: pip
path: specifications/dev
path: specifications/dev
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bikeshed<4.2
bikeshed
myst-parser
pydata-sphinx-theme
json-schema-for-humans
Expand Down
Loading