Compare commits
	
		
			4 Commits
		
	
	
		
			2d0fb9ed84
			...
			7271899b78
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7271899b78 | |||
| 3372bb108d | |||
| 7a29773169 | |||
| 89bdaf95b9 | 
							
								
								
									
										2
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								makefile
									
									
									
									
									
								
							@ -67,7 +67,7 @@ blog: $(HTML_INCLUDES) $(CSS_TARGETS)
 | 
				
			|||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
garden:
 | 
					garden:
 | 
				
			||||||
	make --directory $(GARDEN_BASE_DIR) html
 | 
						make --directory $(GARDEN_BASE_DIR) site
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	make --directory $(GARDEN_BASE_DIR) clean
 | 
						make --directory $(GARDEN_BASE_DIR) clean
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								src/garden/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/garden/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					__pycache__
 | 
				
			||||||
 | 
					*.html
 | 
				
			||||||
@ -1,10 +1,19 @@
 | 
				
			|||||||
html: feed.py Makefile
 | 
					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)
 | 
				
			||||||
	mkdir html
 | 
						mkdir html
 | 
				
			||||||
	cp feed.py Makefile html
 | 
						python md2html.py $(md)
 | 
				
			||||||
	cp *.md html
 | 
						cp -R $(html) $(py) $(journal-images) Makefile html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					journal: $(poetry)
 | 
				
			||||||
 | 
						python journal.py $<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean-html:
 | 
					clean-html:
 | 
				
			||||||
	[[ -d html ]] && rm -r html
 | 
						rm -r html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: clean-html
 | 
					.PHONY: clean-html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,4 +24,4 @@ rss: feed
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
clean: clean-html
 | 
					clean: clean-html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: feed clean
 | 
					.PHONY: feed clean journal
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 95f85eaa95c875d2aa7897c0120f72bf31ade907
 | 
					Subproject commit 170fb442a8c4a0c06b47e28821ab5fb475e35be1
 | 
				
			||||||
							
								
								
									
										30
									
								
								src/garden/journal.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/garden/journal.py
									
									
									
									
									
										Normal 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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										35
									
								
								src/garden/md2html.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/garden/md2html.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					#!/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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user