Merge pull request #1274 from pypa/diagram-fix
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
try:
|
||||||
|
from html2image import Html2Image # type: ignore[import]
|
||||||
|
except ImportError:
|
||||||
|
sys.exit(
|
||||||
|
"""
|
||||||
|
html2image not found. Ensure you have Chrome (on Mac/Windows) or
|
||||||
|
Chromium (on Linux) installed, and then do:
|
||||||
|
pip install html2image
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
subprocess.run(["mkdocs", "build"])
|
||||||
|
|
||||||
|
hti = Html2Image(custom_flags=["--force-device-scale-factor=2"])
|
||||||
|
|
||||||
|
html_str = Path("docs/diagram.md").read_text()
|
||||||
|
css_tags = f"""
|
||||||
|
<style>{Path("site/css/theme.css").read_text()}</style>
|
||||||
|
<style>{Path("site/css/theme_extra.css").read_text()}</style>
|
||||||
|
<style>{Path("site/extra.css").read_text()}</style>
|
||||||
|
<style>
|
||||||
|
body {{
|
||||||
|
background: white;
|
||||||
|
}}
|
||||||
|
</style>
|
||||||
|
"""
|
||||||
|
html_str = css_tags + html_str
|
||||||
|
|
||||||
|
[screenshot, *_] = hti.screenshot(
|
||||||
|
html_str=html_str,
|
||||||
|
size=(830, 405),
|
||||||
|
)
|
||||||
|
|
||||||
|
dest_path = Path("docs/data/how-it-works.png")
|
||||||
|
if dest_path.exists():
|
||||||
|
dest_path.unlink()
|
||||||
|
|
||||||
|
Path(screenshot).rename(dest_path)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 67 KiB |
+3
-3
@@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid-column-label"
|
<div class="grid-column-label"
|
||||||
style="grid-row: 2 / span 1;
|
style="grid-row: 2 / span 1;
|
||||||
grid-column: 8 / -3;
|
grid-column: 9 / -3;
|
||||||
margin-bottom: 0.5em;">
|
margin-bottom: 0.5em;">
|
||||||
<div class="label">If tests are configured</div>
|
<div class="label">If tests are configured</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -382,7 +382,7 @@
|
|||||||
}
|
}
|
||||||
.grid-column-label .label {
|
.grid-column-label .label {
|
||||||
background: #fcfcfc;
|
background: #fcfcfc;
|
||||||
padding: 0 2em;
|
padding: 0 1em;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.grid-row-label {
|
.grid-row-label {
|
||||||
@@ -420,7 +420,7 @@
|
|||||||
grid-column: 3 / -2;
|
grid-column: 3 / -2;
|
||||||
}
|
}
|
||||||
.grid-outline.testVenv {
|
.grid-outline.testVenv {
|
||||||
grid-column: 8 / span 4;
|
grid-column: 9 / span 3;
|
||||||
}
|
}
|
||||||
.grid-outline .outline {
|
.grid-outline .outline {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user