Compare commits
No commits in common. "1a7c02ca64a6cd74d02030a037a25c6ec932dea5" and "9355856dc4b99533ab0e0bfc4b9be61dd20d50ac" have entirely different histories.
1a7c02ca64
...
9355856dc4
17
Makefile
17
Makefile
|
@ -1,26 +1,23 @@
|
||||||
.PHONY: *
|
.PHONY: *
|
||||||
|
|
||||||
help: ## display this help
|
build:
|
||||||
@awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST)
|
./build.py out/ --draft
|
||||||
|
|
||||||
build: ## compile src/ into out/ with pagefind
|
|
||||||
./build.py out/
|
|
||||||
pagefind --site out/
|
pagefind --site out/
|
||||||
|
|
||||||
clean: ## delete out/ and src/
|
clean:
|
||||||
test -e out && rm -rf out || true
|
test -e out && rm -rf out || true
|
||||||
test -e srv && rm -rf srv || true
|
test -e srv && rm -rf srv || true
|
||||||
|
|
||||||
watch: ## rebuild on changes
|
watch:
|
||||||
while inotifywait -r -e modify -e move -e create -e delete build.py Makefile src/; do make build; done
|
while inotifywait -r -e modify -e move -e create -e delete build.py Makefile src/; do make build; done
|
||||||
|
|
||||||
serve: ## serve out/
|
serve:
|
||||||
python -m http.server --directory out/
|
python -m http.server --directory out/
|
||||||
|
|
||||||
pubdate: ## Replace "pubdate: now" with the current date
|
pubdate:
|
||||||
sed -i "s/pubdate: now/pubdate: $$(date -Isec)/" src/blog/**/*.md
|
sed -i "s/pubdate: now/pubdate: $$(date -Isec)/" src/blog/**/*.md
|
||||||
|
|
||||||
upload: ## build to srv/ and upload to www.alogoulogoi.com
|
upload:
|
||||||
test -e srv && rm -rf srv || true
|
test -e srv && rm -rf srv || true
|
||||||
./build.py srv/
|
./build.py srv/
|
||||||
pagefind --site srv/
|
pagefind --site srv/
|
||||||
|
|
19
build.py
19
build.py
|
@ -6,26 +6,16 @@ import copy
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
|
||||||
|
|
||||||
import bs4
|
import bs4
|
||||||
from feedgen.feed import FeedGenerator
|
from feedgen.feed import FeedGenerator
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
|
|
||||||
def get_pubdate(src_path):
|
|
||||||
pubdate = subprocess.run(
|
|
||||||
["git", "log", "--diff-filter=A", "--format=%aI", "--", src_path],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
check=True,
|
|
||||||
)
|
|
||||||
return datetime.fromisoformat(pubdate.stdout.strip())
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("out", help="output directory")
|
parser.add_argument("out", help="output directory")
|
||||||
|
parser.add_argument("--draft", action="store_true", help="include draft pages")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
src = pathlib.Path("src")
|
src = pathlib.Path("src")
|
||||||
|
@ -134,8 +124,11 @@ def main():
|
||||||
page.header.append(aside)
|
page.header.append(aside)
|
||||||
|
|
||||||
# RSS metadata
|
# RSS metadata
|
||||||
if "feed" in meta:
|
if "pubdate" in meta and meta["pubdate"][0] == "draft" and not args.draft:
|
||||||
pubdate = get_pubdate(path.as_posix())
|
continue
|
||||||
|
|
||||||
|
if "feed" in meta and "pubdate" in meta and meta["pubdate"][0] != "draft":
|
||||||
|
pubdate = datetime.fromisoformat(meta["pubdate"][0])
|
||||||
link = f"https://www.alogoulogoi.com/{dest.relative_to(out).as_posix()}"
|
link = f"https://www.alogoulogoi.com/{dest.relative_to(out).as_posix()}"
|
||||||
for feed in meta["feed"]:
|
for feed in meta["feed"]:
|
||||||
if feed not in feeds:
|
if feed not in feeds:
|
||||||
|
|
|
@ -23,7 +23,12 @@
|
||||||
pkgs.pagefind
|
pkgs.pagefind
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
make help
|
echo "make build - compile src/ into out/ with pagefind"
|
||||||
|
echo "make clean - delete out/ and srv/"
|
||||||
|
echo "make watch - rebuild on changes"
|
||||||
|
echo "make serve - serve out/"
|
||||||
|
echo "make pubdate - replace 'now' with the current date"
|
||||||
|
echo "make upload - build to srv/ and upload to alogoulogoi"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
title: The traditional first software engineer blog post
|
title: The traditional first software engineer blog post
|
||||||
|
pubdate: 2023-09-28T15:39:59-07:00
|
||||||
feed: blog
|
feed: blog
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
title: SHLVL PS1
|
title: SHLVL PS1
|
||||||
|
pubdate: 2023-12-18T09:53:17-08:00
|
||||||
feed: blog
|
feed: blog
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
title: Backing up my ZFS NAS to an external drive
|
title: Backing up my ZFS NAS to an external drive
|
||||||
|
pubdate: 2023-09-29T16:23:49-07:00
|
||||||
feed: blog
|
feed: blog
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
title: Archiving bookmarks
|
title: Archiving bookmarks
|
||||||
|
pubdate: 2024-05-27T21:06:37-07:00
|
||||||
feed: blog
|
feed: blog
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue