From c3ed54b838e136ac2bfd5e4096a6ebade1adbba9 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 7 Jul 2024 12:06:07 +0200 Subject: [PATCH] Add static map workaround for blog --- .gitignore | 2 ++ _quarto-blog.yml | 3 +++ index.qmd | 4 +++- tools/move-map-to-blog.py | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tools/move-map-to-blog.py diff --git a/.gitignore b/.gitignore index d23586c..7179a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /*_files/ *.ipynb + +/map.png diff --git a/_quarto-blog.yml b/_quarto-blog.yml index a3f0b72..a6417d3 100644 --- a/_quarto-blog.yml +++ b/_quarto-blog.yml @@ -5,11 +5,14 @@ project: - index.qmd post-render: - tools/fix-astro-img.py + - tools/move-map-to-blog.py format: hugo-md: preserve-yaml: true code-fold: true + keep-ipynb: true + wrap: none typst: toc: true echo: false diff --git a/index.qmd b/index.qmd index 2d63d6d..698a948 100644 --- a/index.qmd +++ b/index.qmd @@ -417,6 +417,7 @@ for country in country_colors.keys(): ), ).add_to(fg) folium.LayerControl().add_to(m) +m ``` ::: {.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 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. ::: diff --git a/tools/move-map-to-blog.py b/tools/move-map-to-blog.py new file mode 100644 index 0000000..25a43c3 --- /dev/null +++ b/tools/move-map-to-blog.py @@ -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)