Fix for dynamic js map embed in blog output
This commit is contained in:
parent
f508be0740
commit
bff3cb22fa
4 changed files with 2678 additions and 19 deletions
|
|
@ -1,18 +1,36 @@
|
|||
#!/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.
|
||||
# A HACK TO PUT THE LEAFLET JS INTO THE CORRECT PUBLIC BLOG DIR
|
||||
# will have to be changed when the hardcoded public dir path changes
|
||||
|
||||
import shutil
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
if not os.getenv("QUARTO_PROJECT_RENDER_ALL"):
|
||||
sys.exit(0)
|
||||
|
||||
relative_pub_dir = Path(
|
||||
"../../../../public/blog/2024-07-02-nuclear-explosions-analysis/"
|
||||
)
|
||||
|
||||
q_output_dir = os.getenv("QUARTO_PROJECT_OUTPUT_DIR")
|
||||
if not q_output_dir:
|
||||
print(f"ERROR: output dir: {q_output_dir} DOES NOT EXIST.")
|
||||
sys.exit(1)
|
||||
|
||||
src = "map.png"
|
||||
dest = Path(q_output_dir).joinpath(relative_pub_dir)
|
||||
|
||||
shutil.copy(src, q_output_dir)
|
||||
# Correct relative WORKING DIR DOES NOT EXIST
|
||||
if not dest.is_dir():
|
||||
print(f"ERROR: map.html destination path: {dest} DOES NOT EXIST.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
src = "map.html"
|
||||
|
||||
shutil.copy(src, dest)
|
||||
|
||||
print("sucessfully moved map.html to ")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue