Compare commits

..

9 Commits

Author SHA1 Message Date
ktyl 7271899b78 feat(journal): include specific journal paths
continuous-integration/drone/push Build is failing Details
2023-12-04 22:51:03 +00:00
ktyl 3372bb108d build: fix clean rule 2023-12-04 22:48:55 +00:00
ktyl 7a29773169 build: update make target 2023-12-03 23:33:48 +00:00
ktyl 89bdaf95b9 feat(garden): generate html files 2023-11-18 00:32:49 +00:00
ktyl 2d0fb9ed84 feat(books): start collection
continuous-integration/drone/push Build is failing Details
2023-11-17 23:51:29 +00:00
ktyl 623a463d9f chore(journal): update subdmodule 2023-11-17 23:44:01 +00:00
ktyl f72c3e7f35 update journal
continuous-integration/drone/push Build is failing Details
2023-11-17 21:23:01 +00:00
ktyl 1cc66385ab feat(rss): generate unformatted file titles
continuous-integration/drone/push Build is failing Details
2023-11-15 01:18:53 +00:00
ktyl 17c12cadf4 feat: add journal as submodule 2023-11-15 01:18:53 +00:00
6 changed files with 68 additions and 19 deletions

9
.gitmodules vendored
View File

@ -4,3 +4,12 @@
[submodule "blog"]
path = blog
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 +1,2 @@
__pycache__
*.html

View File

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

1
src/garden/journal Submodule

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

30
src/garden/journal.py Normal file
View File

@ -0,0 +1,30 @@
#!/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,6 +8,16 @@ def print_usage():
print("")
print("\t\PATHS\tpaths of input markdown files")
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()
sys.exit(1)
@ -21,12 +31,5 @@ if len(bad_paths) != 0:
exit(1)
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)