mpi-theme 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mpi_theme/__init__.py +1 -0
- mpi_theme/assets/book-callouts.css +92 -0
- mpi_theme/assets/book-header.css +230 -0
- mpi_theme/assets/book-objective-tags.css +91 -0
- mpi_theme/assets/book-publication.css +337 -0
- mpi_theme/assets/brand/field-mark-span.svg +9 -0
- mpi_theme/assets/django-header.css +60 -0
- mpi_theme/assets/fonts.css +72 -0
- mpi_theme/assets/inventory.json +26 -0
- mpi_theme/assets/marp.css +45 -0
- mpi_theme/assets/mermaid.json +27 -0
- mpi_theme/assets/mermaid.lua +42 -0
- mpi_theme/assets/print-book.tex +192 -0
- mpi_theme/assets/print-values.json +3 -0
- mpi_theme/assets/print.tex +6 -0
- mpi_theme/assets/slides.css +21 -0
- mpi_theme/assets/tokens.json +21 -0
- mpi_theme/assets/vendor/fonts/FONTS_LICENSE.txt +40 -0
- mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-Bold.otf +494 -0
- mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-BoldItalic.otf +494 -0
- mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-Italic.otf +494 -0
- mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-Regular.otf +494 -0
- mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-Bold.otf +0 -0
- mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-BoldItalic.otf +0 -0
- mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-Italic.otf +0 -0
- mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-Regular.otf +0 -0
- mpi_theme/cli.py +232 -0
- mpi_theme/fonts.py +106 -0
- mpi_theme/presentation.py +61 -0
- mpi_theme-0.2.0.dist-info/METADATA +100 -0
- mpi_theme-0.2.0.dist-info/RECORD +33 -0
- mpi_theme-0.2.0.dist-info/WHEEL +4 -0
- mpi_theme-0.2.0.dist-info/entry_points.txt +2 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
mpi_theme/cli.py
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"""Export immutable presentation assets without consumer runtime dependencies."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import hashlib
|
|
5
|
+
import json
|
|
6
|
+
from importlib.resources import files
|
|
7
|
+
from pathlib import Path, PurePosixPath
|
|
8
|
+
|
|
9
|
+
from mpi_theme import __version__
|
|
10
|
+
from mpi_theme.presentation import plot_style
|
|
11
|
+
|
|
12
|
+
MANIFEST = "mpi-theme-manifest.json"
|
|
13
|
+
ADAPTERS = ("book", "django", "slides", "print", "marp", "plot")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def digest(data: bytes) -> str:
|
|
17
|
+
return hashlib.sha256(data).hexdigest()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def safe_name(name: str) -> None:
|
|
21
|
+
path = PurePosixPath(name)
|
|
22
|
+
if (
|
|
23
|
+
not path.parts
|
|
24
|
+
or path.is_absolute()
|
|
25
|
+
or ".." in path.parts
|
|
26
|
+
or "\\" in name
|
|
27
|
+
or path.as_posix() != name
|
|
28
|
+
):
|
|
29
|
+
raise ValueError(f"Invalid export path: {name}")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def target_path(output: Path, name: str) -> Path:
|
|
33
|
+
safe_name(name)
|
|
34
|
+
target = output / name
|
|
35
|
+
for path in (target, *target.parents):
|
|
36
|
+
if path == output.parent:
|
|
37
|
+
break
|
|
38
|
+
if path.is_symlink():
|
|
39
|
+
raise ValueError(f"Symlink in export path: {name}")
|
|
40
|
+
return target
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def source_assets() -> tuple[dict[str, bytes], str]:
|
|
44
|
+
root = files("mpi_theme").joinpath("assets")
|
|
45
|
+
inventory_data = root.joinpath("inventory.json").read_bytes()
|
|
46
|
+
assets = {}
|
|
47
|
+
for name, checksum in json.loads(inventory_data).items():
|
|
48
|
+
safe_name(name)
|
|
49
|
+
data = root.joinpath(name).read_bytes()
|
|
50
|
+
if digest(data) != checksum:
|
|
51
|
+
raise ValueError(f"Package asset checksum mismatch: {name}")
|
|
52
|
+
assets[name] = data
|
|
53
|
+
return assets, digest(inventory_data)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def tokens_css(tokens: dict[str, str], adapter: str) -> bytes:
|
|
57
|
+
values = dict(tokens)
|
|
58
|
+
if adapter == "book":
|
|
59
|
+
values["--mpi-prose-size"] = "18px"
|
|
60
|
+
lines = [":root {"]
|
|
61
|
+
lines.extend(f" {key}: {value};" for key, value in values.items())
|
|
62
|
+
lines.extend(
|
|
63
|
+
f" --product-{key.removeprefix('--mpi-')}: var({key});"
|
|
64
|
+
for key in values
|
|
65
|
+
if key not in {"--mpi-table-stripe"} and not key.startswith(("--mpi-font", "--mpi-prose"))
|
|
66
|
+
)
|
|
67
|
+
return ("\n".join([*lines, "}", ""]) + "\n").encode()
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def composition(adapter: str) -> tuple[dict[str, bytes], str]:
|
|
71
|
+
if adapter not in ADAPTERS:
|
|
72
|
+
raise ValueError(f"Unknown adapter: {adapter}")
|
|
73
|
+
assets, inventory_hash = source_assets()
|
|
74
|
+
result = {}
|
|
75
|
+
tokens = json.loads(assets["tokens.json"])
|
|
76
|
+
if adapter == "plot":
|
|
77
|
+
result["plot-style.json"] = (json.dumps(plot_style(), indent=2) + "\n").encode()
|
|
78
|
+
elif adapter == "marp":
|
|
79
|
+
css = tokens_css(tokens, adapter).decode().replace(":root {", "section {")
|
|
80
|
+
result["styles/mpi-marp.css"] = (
|
|
81
|
+
assets["marp.css"].decode().replace("{{tokens}}", css).encode()
|
|
82
|
+
)
|
|
83
|
+
elif adapter == "print":
|
|
84
|
+
# Derive colour mappings from the same tokens, not a second palette.
|
|
85
|
+
colours = {"MPIInk": "ink", "MPIPrimary": "primary", "MPIMuted": "muted"}
|
|
86
|
+
result["mpi-theme.tex"] = (
|
|
87
|
+
"\\usepackage{xcolor}\n"
|
|
88
|
+
+ "".join(
|
|
89
|
+
f"\\definecolor{{{name}}}{{HTML}}"
|
|
90
|
+
f"{{{tokens['--mpi-' + role].lstrip('#').upper()}}}\n"
|
|
91
|
+
for name, role in colours.items()
|
|
92
|
+
)
|
|
93
|
+
).encode()
|
|
94
|
+
print_text = assets["print-book.tex"].decode()
|
|
95
|
+
print_values = json.loads(assets["print-values.json"])
|
|
96
|
+
for role, value in print_values.items():
|
|
97
|
+
print_text = print_text.replace(
|
|
98
|
+
"{{" + role + "}}", "{" + value.lstrip("#").upper() + "}"
|
|
99
|
+
)
|
|
100
|
+
for key, value in tokens.items():
|
|
101
|
+
print_text = print_text.replace(
|
|
102
|
+
"{{" + key.removeprefix("--mpi-") + "}}", "{" + value.lstrip("#").upper() + "}"
|
|
103
|
+
)
|
|
104
|
+
result["mpi-book.tex"] = print_text.encode()
|
|
105
|
+
else:
|
|
106
|
+
css = tokens_css(tokens, adapter)
|
|
107
|
+
if adapter in {"book", "slides"}:
|
|
108
|
+
css = assets["fonts.css"] + css
|
|
109
|
+
result["styles/mpi-theme.css"] = css
|
|
110
|
+
if adapter == "book":
|
|
111
|
+
result["styles/global-header.css"] = assets["book-header.css"]
|
|
112
|
+
for name in ("publication", "callouts", "objective-tags"):
|
|
113
|
+
result[f"styles/{name}.css"] = assets[f"book-{name}.css"]
|
|
114
|
+
elif adapter == "django":
|
|
115
|
+
result["styles/mpi-theme-header.css"] = assets["django-header.css"]
|
|
116
|
+
else:
|
|
117
|
+
result["styles/mpi-slides.css"] = assets["slides.css"]
|
|
118
|
+
if adapter == "book":
|
|
119
|
+
result.update(
|
|
120
|
+
{
|
|
121
|
+
"vendor/fonts/latin/" + name.removeprefix("book-fonts/"): data
|
|
122
|
+
for name, data in assets.items()
|
|
123
|
+
if name.startswith("book-fonts/")
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
config = assets["mermaid.json"].decode()
|
|
127
|
+
for key, value in tokens.items():
|
|
128
|
+
if key == "--mpi-font-heading":
|
|
129
|
+
value = value.replace('"', "")
|
|
130
|
+
elif value.startswith("#"):
|
|
131
|
+
value = value.upper()
|
|
132
|
+
config = config.replace("{{" + key.removeprefix("--mpi-") + "}}", value)
|
|
133
|
+
directive = "%%{init: " + json.dumps(json.loads(config)) + "}%%"
|
|
134
|
+
result["filters/mermaid.lua"] = (
|
|
135
|
+
assets["mermaid.lua"].decode().replace("{{directive}}", directive).encode()
|
|
136
|
+
)
|
|
137
|
+
if adapter not in {"django", "plot"}:
|
|
138
|
+
result.update(
|
|
139
|
+
{name: data for name, data in assets.items() if name.startswith("vendor/fonts/")}
|
|
140
|
+
)
|
|
141
|
+
if adapter != "plot":
|
|
142
|
+
result.update(
|
|
143
|
+
{"assets/" + name: data for name, data in assets.items() if name.startswith("brand/")}
|
|
144
|
+
)
|
|
145
|
+
return result, inventory_hash
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def verify(output: Path, *, against_package: bool = True) -> dict:
|
|
149
|
+
manifest_path = target_path(output, MANIFEST)
|
|
150
|
+
manifest = json.loads(manifest_path.read_bytes())
|
|
151
|
+
if manifest.get("schema_version") != 1 or manifest.get("adapter") not in ADAPTERS:
|
|
152
|
+
raise ValueError("Invalid theme manifest")
|
|
153
|
+
if against_package:
|
|
154
|
+
expected, inventory_hash = composition(manifest["adapter"])
|
|
155
|
+
expected_hashes = {name: digest(data) for name, data in expected.items()}
|
|
156
|
+
if (
|
|
157
|
+
manifest.get("theme_version") != __version__
|
|
158
|
+
or manifest.get("source_inventory_sha256") != inventory_hash
|
|
159
|
+
or manifest.get("files") != expected_hashes
|
|
160
|
+
):
|
|
161
|
+
raise ValueError("Export does not match the installed theme package")
|
|
162
|
+
for name, checksum in manifest["files"].items():
|
|
163
|
+
if name == MANIFEST:
|
|
164
|
+
raise ValueError("Manifest cannot checksum itself")
|
|
165
|
+
if digest(target_path(output, name).read_bytes()) != checksum:
|
|
166
|
+
raise ValueError(f"Export checksum mismatch: {name}")
|
|
167
|
+
return manifest
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def export(adapter: str, output: Path, *, replace: bool = False) -> dict:
|
|
171
|
+
data, inventory_hash = composition(adapter)
|
|
172
|
+
# Validate all collisions before writing. Consumer-owned files are untouched.
|
|
173
|
+
previous = {}
|
|
174
|
+
manifest_path = target_path(output, MANIFEST)
|
|
175
|
+
if manifest_path.exists():
|
|
176
|
+
if not replace:
|
|
177
|
+
raise ValueError("Existing export requires --replace")
|
|
178
|
+
previous_manifest = verify(output, against_package=False)
|
|
179
|
+
if previous_manifest["adapter"] != adapter:
|
|
180
|
+
raise ValueError("Cannot replace a different adapter")
|
|
181
|
+
previous = previous_manifest["files"]
|
|
182
|
+
for name in data:
|
|
183
|
+
target = target_path(output, name)
|
|
184
|
+
if target.exists() and name not in previous:
|
|
185
|
+
raise ValueError(f"Unmanaged export collision: {name}")
|
|
186
|
+
if target.exists() and not target.is_file():
|
|
187
|
+
raise ValueError(f"Export destination is not a file: {name}")
|
|
188
|
+
for parent in target.parents:
|
|
189
|
+
if parent == output.parent:
|
|
190
|
+
break
|
|
191
|
+
if parent.exists() and not parent.is_dir():
|
|
192
|
+
raise ValueError(f"Export parent is not a directory: {name}")
|
|
193
|
+
if set(previous) - set(data):
|
|
194
|
+
raise ValueError("Adapter removed assets; use a fresh build directory")
|
|
195
|
+
manifest = {
|
|
196
|
+
"schema_version": 1,
|
|
197
|
+
"theme_version": __version__,
|
|
198
|
+
"adapter": adapter,
|
|
199
|
+
"source_inventory_sha256": inventory_hash,
|
|
200
|
+
"files": {name: digest(content) for name, content in sorted(data.items())},
|
|
201
|
+
}
|
|
202
|
+
output.mkdir(parents=True, exist_ok=True)
|
|
203
|
+
for name, content in data.items():
|
|
204
|
+
target = target_path(output, name)
|
|
205
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
206
|
+
target.write_bytes(content)
|
|
207
|
+
manifest_path.write_text(json.dumps(manifest, indent=2) + "\n")
|
|
208
|
+
return manifest
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def main() -> None:
|
|
212
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
213
|
+
commands = parser.add_subparsers(dest="command", required=True)
|
|
214
|
+
export_parser = commands.add_parser("export")
|
|
215
|
+
export_parser.add_argument("adapter", choices=ADAPTERS)
|
|
216
|
+
export_parser.add_argument("--output", type=Path, required=True)
|
|
217
|
+
export_parser.add_argument("--replace", action="store_true")
|
|
218
|
+
verify_parser = commands.add_parser("verify")
|
|
219
|
+
verify_parser.add_argument("output", type=Path)
|
|
220
|
+
args = parser.parse_args()
|
|
221
|
+
try:
|
|
222
|
+
if args.command == "export":
|
|
223
|
+
manifest = export(args.adapter, args.output, replace=args.replace)
|
|
224
|
+
else:
|
|
225
|
+
manifest = verify(args.output)
|
|
226
|
+
except (ValueError, OSError) as error:
|
|
227
|
+
parser.exit(1, f"mpi-theme: {error}\n")
|
|
228
|
+
print(json.dumps(manifest, sort_keys=True))
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
if __name__ == "__main__":
|
|
232
|
+
main()
|
mpi_theme/fonts.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Font configuration management for the theme.
|
|
2
|
+
|
|
3
|
+
Fonts are declared centrally in pyproject.toml and used consistently
|
|
4
|
+
across all outputs (web CSS, LaTeX, presentations).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
# Default font configuration
|
|
13
|
+
DEFAULT_FONTS = {
|
|
14
|
+
"serif": "Linux Libertine",
|
|
15
|
+
"sans": "Linux Libertine G",
|
|
16
|
+
"mono": "IBM Plex Mono",
|
|
17
|
+
"math": "STIX Two Math",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
FONT_VARIANTS = {
|
|
21
|
+
"linux-libertine": {
|
|
22
|
+
"serif": "Linux Libertine",
|
|
23
|
+
"sans": "Linux Libertine G",
|
|
24
|
+
"mono": "IBM Plex Mono",
|
|
25
|
+
"math": "STIX Two Math",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class FontConfig:
|
|
32
|
+
"""Font configuration for the theme."""
|
|
33
|
+
|
|
34
|
+
serif: str
|
|
35
|
+
sans: str
|
|
36
|
+
mono: str
|
|
37
|
+
math: str
|
|
38
|
+
|
|
39
|
+
def for_latex(self) -> dict[str, str]:
|
|
40
|
+
"""Return font config for LaTeX (Quarto PDF format)."""
|
|
41
|
+
return {
|
|
42
|
+
"mainfont": self.serif,
|
|
43
|
+
"sansfont": self.sans,
|
|
44
|
+
"monofont": self.mono,
|
|
45
|
+
"mathfont": self.math,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def for_css(self) -> dict[str, str]:
|
|
49
|
+
"""Return font config for CSS/web rendering."""
|
|
50
|
+
return {
|
|
51
|
+
"serif": self.serif,
|
|
52
|
+
"sans": self.sans,
|
|
53
|
+
"mono": self.mono,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_fonts() -> FontConfig:
|
|
58
|
+
"""Load font configuration from pyproject.toml.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
FontConfig with current font settings
|
|
62
|
+
"""
|
|
63
|
+
theme_root = Path(__file__).resolve().parent.parent
|
|
64
|
+
pyproject_path = theme_root / "pyproject.toml"
|
|
65
|
+
|
|
66
|
+
if pyproject_path.exists():
|
|
67
|
+
try:
|
|
68
|
+
import tomllib
|
|
69
|
+
except ImportError:
|
|
70
|
+
import tomli as tomllib # type: ignore
|
|
71
|
+
|
|
72
|
+
with open(pyproject_path, "rb") as f:
|
|
73
|
+
data = tomllib.load(f)
|
|
74
|
+
if "tool" in data and "mpi-theme" in data["tool"]:
|
|
75
|
+
font_config = data["tool"]["mpi-theme"].get("fonts", {})
|
|
76
|
+
if font_config:
|
|
77
|
+
return FontConfig(
|
|
78
|
+
serif=font_config.get("serif", DEFAULT_FONTS["serif"]),
|
|
79
|
+
sans=font_config.get("sans", DEFAULT_FONTS["sans"]),
|
|
80
|
+
mono=font_config.get("mono", DEFAULT_FONTS["mono"]),
|
|
81
|
+
math=font_config.get("math", DEFAULT_FONTS["math"]),
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# Fall back to defaults
|
|
85
|
+
return FontConfig(**DEFAULT_FONTS)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def get_variant(name: str) -> FontConfig:
|
|
89
|
+
"""Get a predefined font variant by name.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
name: One of 'source', 'linux-libertine', 'plex', 'latin-modern'
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
FontConfig for the specified variant
|
|
96
|
+
|
|
97
|
+
Raises:
|
|
98
|
+
ValueError: if variant name is not recognized
|
|
99
|
+
"""
|
|
100
|
+
if name not in FONT_VARIANTS:
|
|
101
|
+
raise ValueError(
|
|
102
|
+
f"Unknown font variant '{name}'. "
|
|
103
|
+
f"Available: {', '.join(FONT_VARIANTS.keys())}"
|
|
104
|
+
)
|
|
105
|
+
variant = FONT_VARIANTS[name]
|
|
106
|
+
return FontConfig(**variant)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Renderer-neutral presentation values from the packaged token inventory."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from importlib.resources import files
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def tokens() -> dict[str, str]:
|
|
8
|
+
"""Return an independent copy of the shared presentation tokens."""
|
|
9
|
+
return json.loads(files("mpi_theme").joinpath("assets/tokens.json").read_text())
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def plot_style() -> dict:
|
|
13
|
+
"""Return palette and rc values without importing a plotting library."""
|
|
14
|
+
values = tokens()
|
|
15
|
+
|
|
16
|
+
def colour(role: str) -> str:
|
|
17
|
+
return values["--mpi-" + role].upper()
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
"colors": {
|
|
21
|
+
role: colour(role)
|
|
22
|
+
for role in (
|
|
23
|
+
"canvas",
|
|
24
|
+
"surface",
|
|
25
|
+
"ink",
|
|
26
|
+
"muted",
|
|
27
|
+
"border",
|
|
28
|
+
"primary",
|
|
29
|
+
"primary-hover",
|
|
30
|
+
"focus",
|
|
31
|
+
"success",
|
|
32
|
+
"warning",
|
|
33
|
+
"danger",
|
|
34
|
+
"info",
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
"palette": [
|
|
38
|
+
colour(role)
|
|
39
|
+
for role in (
|
|
40
|
+
"primary",
|
|
41
|
+
"info",
|
|
42
|
+
"warning",
|
|
43
|
+
"success",
|
|
44
|
+
"danger",
|
|
45
|
+
"muted",
|
|
46
|
+
)
|
|
47
|
+
],
|
|
48
|
+
"rc": {
|
|
49
|
+
key: colour(role)
|
|
50
|
+
for key, role in {
|
|
51
|
+
"axes.edgecolor": "border",
|
|
52
|
+
"axes.facecolor": "surface",
|
|
53
|
+
"figure.facecolor": "canvas",
|
|
54
|
+
"grid.color": "border",
|
|
55
|
+
"text.color": "ink",
|
|
56
|
+
"axes.labelcolor": "ink",
|
|
57
|
+
"xtick.color": "muted",
|
|
58
|
+
"ytick.color": "muted",
|
|
59
|
+
}.items()
|
|
60
|
+
},
|
|
61
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mpi-theme
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Shared MPI presentation assets and renderer adapters
|
|
5
|
+
License-Expression: LicenseRef-Proprietary
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# MPI Theme
|
|
10
|
+
|
|
11
|
+
Shared tokens, licensed fonts/brand assets and renderer-specific adapters under
|
|
12
|
+
MPI LMS ADR-0021 (accepted October 5, 2026). Initial extraction preserves the
|
|
13
|
+
book and Django appearance; product behavior remains with consumers.
|
|
14
|
+
|
|
15
|
+
The [0.1.5 book-only correction](RELEASE-0.1.5.md) addresses first-paint layout
|
|
16
|
+
and self-hosted Latin font transfer without changing other adapters.
|
|
17
|
+
|
|
18
|
+
Run `uv run mpi-theme export book --output /path/to/build-assets` (or `django`,
|
|
19
|
+
`slides`, `print`, `marp`, `plot`). Export into an empty build directory. Existing managed exports
|
|
20
|
+
can be replaced with `--replace`; edited managed files and unmanaged collisions
|
|
21
|
+
are rejected. `uv run mpi-theme verify /path/to/build-assets` checks export hashes.
|
|
22
|
+
Package code and extracted MPI assets retain restricted project licensing until
|
|
23
|
+
the owner selects distribution terms; extraction does not relicense them.
|
|
24
|
+
Fonts carry their original SIL OFL licenses. Initial source asset provenance is
|
|
25
|
+
recorded in `SOURCE-ASSETS.md`; private assessment content is not included.
|
|
26
|
+
|
|
27
|
+
Book consumers load styles/mpi-theme.css before local publication CSS and load
|
|
28
|
+
styles/global-header.css in its existing position. Django consumes the tokens
|
|
29
|
+
and header CSS before local workflow styles. Django intentionally keeps its
|
|
30
|
+
existing system-font fallback behavior; bundled fonts are used only by book,
|
|
31
|
+
slides and print adapters. Book prose remains 18px rather than adopting the
|
|
32
|
+
Django 1.125rem token. Reveal.js/PDF specimens need renderer-specific review;
|
|
33
|
+
the initial mappings do not establish accessibility conformance.
|
|
34
|
+
|
|
35
|
+
Consumers pin the package independently and export assets at build time. No
|
|
36
|
+
runtime service or remote fonts are used. The final remote distribution location
|
|
37
|
+
is not selected; local wheel/source builds are for the coordinated pilot.
|
|
38
|
+
|
|
39
|
+
Checks: `uv run python -m unittest discover -s tests`, `uv run ruff check`,
|
|
40
|
+
`uv build`. Render consumer specimens before migration acceptance.
|
|
41
|
+
|
|
42
|
+
Render specimens from their directory after exporting slides to slide-assets and print to print-assets. Run quarto render slides.qmd and quarto render print.qmd. Keep generated files outside source control.
|
|
43
|
+
|
|
44
|
+
Consumer setup, import commands and immutable release rules are in
|
|
45
|
+
[INTEGRATION.md](INTEGRATION.md). Versioned source and release artifacts use the
|
|
46
|
+
private GitHub repository; see [0.1.4 release notes](RELEASE-0.1.4.md).
|
|
47
|
+
|
|
48
|
+
The expanded book adapter exports styles/objective-tags.css, styles/callouts.css,
|
|
49
|
+
and styles/publication.css. Preserve their consumer CSS order; assessment-link
|
|
50
|
+
composition remains local. Version 0.1.3 supplies the completed local extraction described below.
|
|
51
|
+
|
|
52
|
+
## Completed local extraction — October 13, 2026
|
|
53
|
+
|
|
54
|
+
The book adapter exports `filters/mermaid.lua`, deriving its palette and heading
|
|
55
|
+
font from shared tokens while preserving authored-option handling. `marp` is a
|
|
56
|
+
separate adapter from Reveal.js `slides`: it exports `styles/mpi-marp.css`, fonts
|
|
57
|
+
and brand artwork. Consumers register the `mpi` theme and import it from their
|
|
58
|
+
own theme; talk-specific layouts and slide counts stay local. Resolve exported
|
|
59
|
+
font URLs relative to the exported CSS when composing consumer build output.
|
|
60
|
+
|
|
61
|
+
The print adapter retains its small `mpi-theme.tex` interface and additionally
|
|
62
|
+
exports `mpi-book.tex` for KOMA book presentation: palette, monochrome mapping,
|
|
63
|
+
field mark, heading/running styles, lists, tables, code and objective badges.
|
|
64
|
+
Book cover composition, video wording and release conversion stay local. Set
|
|
65
|
+
`\def\MPIMonochrome{}` before loading the book design for monochrome text.
|
|
66
|
+
|
|
67
|
+
`from mpi_theme.presentation import tokens, plot_style` exposes independent
|
|
68
|
+
value dictionaries without importing plotting libraries. `mpi-theme export plot`
|
|
69
|
+
exports the same values as `plot-style.json`; statistical computations and rules
|
|
70
|
+
requiring particular settings belong to consumers. Authored teaching examples
|
|
71
|
+
may still spell out these values explicitly.
|
|
72
|
+
|
|
73
|
+
Version 0.1.3 is an immutable local wheel adoption with source hashes and a source
|
|
74
|
+
snapshot. Existing adopted wheels remain unchanged. Source commits, tags, remote
|
|
75
|
+
publishing and LMS dependency upgrades have not been performed.
|
|
76
|
+
|
|
77
|
+
## Next book-adapter slice
|
|
78
|
+
|
|
79
|
+
The [consolidated next-slice brief](BOOK-ADAPTER-NEXT-SLICE-2026-10-15.md) combines current book diagnostics, navigation/header/disclosure presentation, producer-owned semantics and requests back to LMS.
|
|
80
|
+
It incorporates the active-navigation color request. Theme implementation status
|
|
81
|
+
and the remaining consumer integration gates are recorded below.
|
|
82
|
+
|
|
83
|
+
The [requirements and acceptance record](BOOK-ADAPTER-REQUIREMENTS.md)
|
|
84
|
+
defines theme deliverables, measurable checks and external dependencies.
|
|
85
|
+
|
|
86
|
+
Version 0.1.4 implements book navigation targets/current
|
|
87
|
+
states, native disclosure presentation and header composition support. It
|
|
88
|
+
requires the producer to place the product row inside Quarto's fixed header;
|
|
89
|
+
see the [rendered specimen and markup contract](specimens/book/README.md).
|
|
90
|
+
Coordinate that markup change and removal of legacy layout overrides with
|
|
91
|
+
consumer adoption. This candidate has not upgraded or promoted any consumer.
|
|
92
|
+
Results and remaining integration gates are in the
|
|
93
|
+
[validation and handoff record](BOOK-ADAPTER-VALIDATION-2026-10-15.md).
|
|
94
|
+
|
|
95
|
+
## Code and notebook styling scope
|
|
96
|
+
|
|
97
|
+
The [draft code and notebook requirements](CODE-NOTEBOOK-REQUIREMENTS.md) cover
|
|
98
|
+
rendered-book code, standalone notebook HTML and live Jupyter notebook styling.
|
|
99
|
+
This is a separate planned slice; frontend integration and implementation remain
|
|
100
|
+
pending and are not covered by 0.1.4's validation.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
mpi_theme/__init__.py,sha256=rPSfWgIeq2YWVPyESOAwCBt8vftsTpIkuLAGDEzyRQc,22
|
|
2
|
+
mpi_theme/cli.py,sha256=X77D4fP3maJgw2BR3j_Bumg-DNijDFlzU641tlshg04,9365
|
|
3
|
+
mpi_theme/fonts.py,sha256=f-qnQ9VcS0-iP529FM4A3p0UR6HbeBYR8D2ptZmOwZ8,2932
|
|
4
|
+
mpi_theme/presentation.py,sha256=NpKZ25-Sn-jmCZUP8R747pa0lc5MKfOv1xkb7KucdWM,1664
|
|
5
|
+
mpi_theme/assets/book-callouts.css,sha256=C1C4mjfkGVYXYKpGean4S2pDax5H70JxZzK8G9-KZIw,2677
|
|
6
|
+
mpi_theme/assets/book-header.css,sha256=1MKfu0h2cX5xszw6nvScjc4tSCyZyvtAIeX6wWXkTXA,5572
|
|
7
|
+
mpi_theme/assets/book-objective-tags.css,sha256=iQYw4Ht-Pd4onduBgBAUVLYk--cLcr-zJn1MTVBlAs0,2091
|
|
8
|
+
mpi_theme/assets/book-publication.css,sha256=3vWYI0mXo-hUbLYNUt4ZALHz-OOHLG2ug9SY331FlVQ,8390
|
|
9
|
+
mpi_theme/assets/django-header.css,sha256=XLf_fZoxZynD0HlzpNnK5SAKye6rpOScNxsZQBEGiY8,1134
|
|
10
|
+
mpi_theme/assets/fonts.css,sha256=b46p-YfMyuUOywkrAjtIj5BWlMODQTT3A5XCG5sXRC8,1805
|
|
11
|
+
mpi_theme/assets/inventory.json,sha256=t0L93SwuWn3rmFp00KgBABUMPxNGoGLRRknbwZ9TVdg,2416
|
|
12
|
+
mpi_theme/assets/marp.css,sha256=gExiLNfnNU43_TtXkX9HxxusuozfMHMOn4jxR7lLdho,2681
|
|
13
|
+
mpi_theme/assets/mermaid.json,sha256=OLbOtCq7RAj6yyvhHqxAZZ_7qe8E2PrhHZePqKaKaqs,752
|
|
14
|
+
mpi_theme/assets/mermaid.lua,sha256=pCKfCr0iZf0mnBUIod5TXVY3_dO9Wn4uerGXiDFQBMA,909
|
|
15
|
+
mpi_theme/assets/print-book.tex,sha256=wcA8D8wm9EPZIZQo1_IIu7J7rD7_pXcFPo0t2Y1Hqck,9158
|
|
16
|
+
mpi_theme/assets/print-values.json,sha256=Jqm3dGcHg3xEUxIX6815Plqw1othh6dSLv0OseXBCLo,30
|
|
17
|
+
mpi_theme/assets/print.tex,sha256=HMtqY7jbPmMSfzc57jdvSKzmJJPQ11lA7esoWSlink4,209
|
|
18
|
+
mpi_theme/assets/slides.css,sha256=i0gW03XKyyk9fckJJywLSA6ixU8F0s8Twx1RLkZiAvY,879
|
|
19
|
+
mpi_theme/assets/tokens.json,sha256=CwuVSZfImNRDJFKgbD3xX0xmJ-tAPNts0nEKoUIMUHU,686
|
|
20
|
+
mpi_theme/assets/brand/field-mark-span.svg,sha256=z-4X16P8x3nzn3dA3sjIk1R_0Hi_RXsQAOeLRYGNstA,447
|
|
21
|
+
mpi_theme/assets/vendor/fonts/FONTS_LICENSE.txt,sha256=a_VpCAObkC_Oc3nKWUTQ--uXMYreykqNxlRk9oUVmn8,1375
|
|
22
|
+
mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-Bold.otf,sha256=jYpCz6huvWGLpa_8KMOi2gkX6FpQcR9ECFYAnx5RJF0,224878
|
|
23
|
+
mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-BoldItalic.otf,sha256=fz8l5dJehiDaoQMEgJy287ZtQDdtxrXNPIJbSVMlbI0,224957
|
|
24
|
+
mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-Italic.otf,sha256=BE2GLczkqQusmd4OCddztXEhjJrWuWJ3njy1ayENIcI,224908
|
|
25
|
+
mpi_theme/assets/vendor/fonts/ibm-plex/IBMPlexMono-Regular.otf,sha256=qy_D94catYUzT_fP-HzOrErbEyWU_zJn1sZD9p5qQeM,224921
|
|
26
|
+
mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-Bold.otf,sha256=AvQJzravx7fhsrfGRlaPAlL8kO7Q0J4_f2jGSqyEiag,431804
|
|
27
|
+
mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-BoldItalic.otf,sha256=05-RRtzTzzI1WWQpnUqsXABxyqDOj8f9cETYzIq-QKk,325684
|
|
28
|
+
mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-Italic.otf,sha256=PwifGtOjSGumrRzFcRWS5fYglb0tBAHKPtHtJe0b3Ak,416444
|
|
29
|
+
mpi_theme/assets/vendor/fonts/linux-libertine/LinLibertine-Regular.otf,sha256=rKSx7pns1b10owK2H3WLt53-dV9YIDEz7yiwB0JIVwo,444664
|
|
30
|
+
mpi_theme-0.2.0.dist-info/METADATA,sha256=nkMMYjGCQm3NmI3oihYKoWKjsaDVLCzAS4KirmLLmyc,5784
|
|
31
|
+
mpi_theme-0.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
32
|
+
mpi_theme-0.2.0.dist-info/entry_points.txt,sha256=Ewln8yjmQsXApqVHhyqWzyMYDi_hsXKTy9NqrPQJvp4,49
|
|
33
|
+
mpi_theme-0.2.0.dist-info/RECORD,,
|