Compare commits

..

5 Commits

Author SHA1 Message Date
ktyl e4b7d7af2b build: fix clean rule
continuous-integration/drone/push Build is failing Details
2023-12-06 22:44:57 +00:00
ktyl 60998ee701 build: update make target 2023-12-06 22:44:57 +00:00
ktyl 09b24d782f feat(garden): generate html files 2023-12-06 22:44:57 +00:00
ktyl b68fe4264a feat(books): start collection 2023-12-06 22:44:57 +00:00
ktyl bb7f7fa1d4 feat(rss): generate unformatted file titles 2023-12-06 22:44:57 +00:00
6 changed files with 19 additions and 68 deletions

9
.gitmodules vendored
View File

@ -4,12 +4,3 @@
[submodule "blog"] [submodule "blog"]
path = blog path = blog
url = https://sauce.pizzawednes.day/ktyl/blog.git url = https://sauce.pizzawednes.day/ktyl/blog.git
[submodule "journal"]
path = sr/garden/journal
url = git@sauce.pizzawednes.day:ktyl/journal.git
[submodule "src/garden/period3.xyz"]
path = src/garden/period3.xyz
url = git@sauce.pizzawedney.day:ktyl/period3.xyz
[submodule "src/garden/journal"]
path = src/garden/journal
url = git@sauce.pizzawednes.day:ktyl/journal

View File

@ -1,2 +1 @@
__pycache__
*.html *.html

View File

@ -1,16 +1,11 @@
py = feed.py books.py py = feed.py books.py
poetry = journal/poetry/fallen-leaves.md md = rss.md book-collecting.md gardens.md
journal-images = journal/poetry/tree.jpg
md = rss.md book-collecting.md gardens.md $(poetry)
html = $(md:%.md=%.html) html = $(md:%.md=%.html)
site: Makefile $(md) $(py) $(journal-images) site: Makefile $(md) $(py)
mkdir html mkdir html
python md2html.py $(md) python md2html.py $(md)
cp -R $(html) $(py) $(journal-images) Makefile html cp $(html) $(py) Makefile html
journal: $(poetry)
python journal.py $<
clean-html: clean-html:
rm -r html rm -r html
@ -24,4 +19,4 @@ rss: feed
clean: clean-html clean: clean-html
.PHONY: feed clean journal .PHONY: feed clean

@ -1 +0,0 @@
Subproject commit 170fb442a8c4a0c06b47e28821ab5fb475e35be1

View File

@ -1,30 +0,0 @@
#!/usr/bin/env python
import sys
import os
import md2html
def print_usage():
print(f"usage: python {sys.argv[0]} PATHS")
print("")
print("\t\PATHS\tpaths of input markdown files")
if len(sys.argv) < 2:
print_usage()
exit(1)
# we don't want to publish *everything* in the journal, so for now let's just
# hardcode the files we want.
files = sys.argv[1:]
# TODO: copy images
# TODO: separate md fromm images
for f in files:
md2html.write_html(f)
html_path = f.replace(".md", ".html")
print(html_path)

View File

@ -8,28 +8,25 @@ def print_usage():
print("") print("")
print("\t\PATHS\tpaths of input markdown files") print("\t\PATHS\tpaths of input markdown files")
if len(sys.argv) < 2:
def write_html(src : str):
with open(src) as md:
dest = src.replace(".md", ".html")
with open(dest, "w") as html:
html.write(markdown.markdown(md.read()))
if __name__ == "__main__":
if len(sys.argv) < 2:
print_usage() print_usage()
sys.exit(1) sys.exit(1)
paths = sys.argv[1:] paths = sys.argv[1:]
bad_paths = [p for p in paths if not p.endswith(".md")] bad_paths = [p for p in paths if not p.endswith(".md")]
if len(bad_paths) != 0: if len(bad_paths) != 0:
for p in bad_paths: for p in bad_paths:
print(f"Not a markdown file: {p}") print(f"Not a markdown file: {p}")
exit(1) exit(1)
for p in paths: def write_html(src : str):
with open(src) as md:
dest = src.replace(".md", ".html")
with open(dest, "w") as html:
print(f"{src} -> {dest}")
html.write(markdown.markdown(md.read()))
for p in paths:
write_html(p) write_html(p)