Compare commits
No commits in common. "7271899b78ccbe5039f184afdfe5df23764eb1b7" and "2d0fb9ed848b30619cf76c53933e9087e7fcacac" have entirely different histories.
7271899b78
...
2d0fb9ed84
2
makefile
2
makefile
|
@ -67,7 +67,7 @@ blog: $(HTML_INCLUDES) $(CSS_TARGETS)
|
|||
done
|
||||
|
||||
garden:
|
||||
make --directory $(GARDEN_BASE_DIR) site
|
||||
make --directory $(GARDEN_BASE_DIR) html
|
||||
|
||||
clean:
|
||||
make --directory $(GARDEN_BASE_DIR) clean
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
__pycache__
|
||||
*.html
|
|
@ -1,19 +1,10 @@
|
|||
py = feed.py books.py
|
||||
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) $(journal-images)
|
||||
html: feed.py Makefile
|
||||
mkdir html
|
||||
python md2html.py $(md)
|
||||
cp -R $(html) $(py) $(journal-images) Makefile html
|
||||
|
||||
journal: $(poetry)
|
||||
python journal.py $<
|
||||
cp feed.py Makefile html
|
||||
cp *.md html
|
||||
|
||||
clean-html:
|
||||
rm -r html
|
||||
[[ -d html ]] && rm -r html
|
||||
|
||||
.PHONY: clean-html
|
||||
|
||||
|
@ -24,4 +15,4 @@ rss: feed
|
|||
|
||||
clean: clean-html
|
||||
|
||||
.PHONY: feed clean journal
|
||||
.PHONY: feed clean
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 170fb442a8c4a0c06b47e28821ab5fb475e35be1
|
||||
Subproject commit 95f85eaa95c875d2aa7897c0120f72bf31ade907
|
|
@ -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)
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import markdown
|
||||
|
||||
def print_usage():
|
||||
print(f"usage: python {sys.argv[0]} PATHS")
|
||||
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)
|
||||
|
||||
paths = sys.argv[1:]
|
||||
|
||||
bad_paths = [p for p in paths if not p.endswith(".md")]
|
||||
if len(bad_paths) != 0:
|
||||
for p in bad_paths:
|
||||
print(f"Not a markdown file: {p}")
|
||||
|
||||
exit(1)
|
||||
|
||||
for p in paths:
|
||||
write_html(p)
|
Loading…
Reference in New Issue