Clean up infrastructure: remove dead code, fix watch script, fix typos
- Remove hugo.sh (broken draft superseded by hugo-new.sh)
- Remove unused mermaid shortcode and partial (only code-block
rendering via render-codeblock-mermaid.html is used)
- Remove dead xparams.mermaid check from extend_head.html
- Fix watch-rmd.sh to pass shared libs args matching the Makefile
- Fix typos in Makefile ("permsions", "Publising")
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
4
Makefile
4
Makefile
@@ -42,7 +42,7 @@ publish: build #> Publish site
|
||||
@# safe-links: ignore symlinks that point outside of tree
|
||||
@# times: preserve modification times
|
||||
@# delete: delete extraneous files, i.e., files on destination
|
||||
@# chmod: set permsions
|
||||
@# chmod: set permissions
|
||||
@echo "\t 📡 Copying from public to ${DEST}"
|
||||
@rsync \
|
||||
--verbose \
|
||||
@@ -56,7 +56,7 @@ publish: build #> Publish site
|
||||
${DEST}
|
||||
@echo "\t 🛡️ Setting permissions"
|
||||
@ssh axs@sdf.org 'mkhomepg -p'
|
||||
@echo "✓ Publising complete"
|
||||
@echo "✓ Publishing complete"
|
||||
@echo "\nThe site should be available on ${SITE_URL}"
|
||||
|
||||
serve: #> Start a Hugo server
|
||||
|
||||
47
hugo.sh
47
hugo.sh
@@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Usage: ./hugo-new.sh "<title>" [md|rmd]
|
||||
|
||||
TITLE="$2"
|
||||
EXTENSION="${1:-rmd}" # default to Rmd if not specified
|
||||
|
||||
# Validate extension
|
||||
if [[ "$EXTENSION" != "md" && "$EXTENSION" != "rmd" ]]; then
|
||||
echo "⚠️ Usage: ./hugo-new.sh \"Post Title\" [md|rmd]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DATE=$(date '+%Y-%m-%d')
|
||||
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
POST_DIR="content/posts/${DATE}-${SLUG}"
|
||||
|
||||
# Create new post using Hugo archetype
|
||||
if [ "$EXTENSION" == "rmd" ]; then
|
||||
POST_FILE="index.Rmd"
|
||||
else
|
||||
POST_DIR="content/posts/${DATE}-${SLUG}"
|
||||
EXTENSION="md"
|
||||
fi
|
||||
|
||||
hugo new "posts/${DATE}-${SLUG}/index.${EXTENSION}"
|
||||
|
||||
# Change to post directory
|
||||
cd "$POST_DIR"
|
||||
|
||||
# Set up .gitignore and renv (for R Markdown)
|
||||
if [ "$EXTENSION" == "rmd" ]; then
|
||||
# Ignore generated Markdown file
|
||||
echo "index.md" > .gitignore
|
||||
|
||||
# Set up minimal renv environment from base snapshot
|
||||
cp ../../../../scripts/base-renv.lock ./renv.lock
|
||||
|
||||
Rscript -e '
|
||||
if (!require("renv")) install.packages("renv");
|
||||
renv::init(bare = TRUE);
|
||||
renv::restore();
|
||||
'
|
||||
fi
|
||||
|
||||
echo "✅ Created post at ${POST_DIR}/index.${EXTENSION}"
|
||||
@@ -3,10 +3,5 @@
|
||||
{{ partialCached "math.html" . }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Mermaid diagrams -->
|
||||
{{ if .Params.xparams.mermaid }}
|
||||
{{ partialCached "mermaid.html" . }}
|
||||
{{ end }}
|
||||
|
||||
<!-- React components -->
|
||||
{{- partial "react.html" . -}}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<!-- Mermaid JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.min.js"></script>
|
||||
<script>
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
</script>
|
||||
@@ -1,6 +0,0 @@
|
||||
{{ $align := .Get "align" | default "center" }}
|
||||
<div style="text-align: {{ $align }};">
|
||||
<div class="mermaid">
|
||||
{{ .Inner | safeHTML }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
WATCH_DIR="content/posts"
|
||||
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LIBS_DIR="static/libs"
|
||||
LIBS_URL="/libs"
|
||||
|
||||
echo "🚨 Watching ${WATCH_DIR} for changes..."
|
||||
|
||||
@@ -9,7 +12,7 @@ inotifywait -m -e close_write --format '%w%f' -r "$WATCH_DIR" | while read FILE;
|
||||
|
||||
echo "🔄 Change detected in $FILE. Rendering..."
|
||||
|
||||
(cd "$POST_DIR" && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd")')
|
||||
(cd "$POST_DIR" && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd", output_root = "'"${PROJECT_ROOT}/${LIBS_DIR}"'", url_root = "'"${LIBS_URL}"'")')
|
||||
|
||||
echo "✅ Rendered ${FILE}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user