Add static map workaround for blog

This commit is contained in:
Marty Oehme 2024-07-07 12:06:07 +02:00
parent 04bbfb09a5
commit c3ed54b838
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
4 changed files with 26 additions and 1 deletions

2
.gitignore vendored
View file

@ -3,3 +3,5 @@
/*_files/ /*_files/
*.ipynb *.ipynb
/map.png

View file

@ -5,11 +5,14 @@ project:
- index.qmd - index.qmd
post-render: post-render:
- tools/fix-astro-img.py - tools/fix-astro-img.py
- tools/move-map-to-blog.py
format: format:
hugo-md: hugo-md:
preserve-yaml: true preserve-yaml: true
code-fold: true code-fold: true
keep-ipynb: true
wrap: none
typst: typst:
toc: true toc: true
echo: false echo: false

View file

@ -417,6 +417,7 @@ for country in country_colors.keys():
), ),
).add_to(fg) ).add_to(fg)
folium.LayerControl().add_to(m) folium.LayerControl().add_to(m)
m
``` ```
::: {.content-visible when-format="html"} ::: {.content-visible when-format="html"}
@ -455,7 +456,8 @@ not seem to translate terribly well into an astro blog such as this.
This is why, for now, there is only a static image here. This is why, for now, there is only a static image here.
This is very sad, but for the time being feel free to download and peruse This is very sad, but for the time being feel free to download and peruse
the ipynb notebook [here](./index.ipynb), or the [pdf](./index.pdf) the full repo with source documents [here](https://git.martyoeh.me/datasci/nuclear_explosions),
as well as the [pdf](./index.pdf)
or [docx](./index.docx) versions. or [docx](./index.docx) versions.
::: :::

18
tools/move-map-to-blog.py Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# Simply move the map.png file to the blog output dir
# since it won't do so automatically for pillow creations.
import shutil
import os
import sys
if not os.getenv("QUARTO_PROJECT_RENDER_ALL"):
sys.exit(0)
q_output_dir = os.getenv("QUARTO_PROJECT_OUTPUT_DIR")
if not q_output_dir:
sys.exit(1)
src = "map.png"
shutil.copy(src, q_output_dir)