summaryrefslogblamecommitdiff
path: root/Makefile
blob: 05df2971746f1304c098ab7ea65ae2d35262e072 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                  
 
                                  
 
                   
 
       

                                     

                                                     
 
      


                                        
                                           
                                    
                                                                                                                               
                                    
                                                         
                              
                                                                                                                                                                                                                         
                                                                                                                                               
 

                                                       
# Written for FreeBSD make(1), or pmake. Not tested with GNU make.

TEMPLATE = templates/template.html

.PHONY: serve post 

serve: 
	python3.7 -m http.server 3000

profile/adamcarpenter.pdf: profile/adamcarpenter.html
	touch profile/adamcarpenter.pdf

post: 
	@read -p "Title: " TITLE; \
	read -p "Category: " CATEGORY; \
	SHORT_DATE=`date +"%Y-%m-%d"`; \
	LONG_DATE=`date +"%a, %d %b %Y"`; \
	mkdir -p posts/$$CATEGORY; \
	FILENAME=posts/$$CATEGORY/$$SHORT_DATE-`printf "$$TITLE" | tr -Cs "[:alnum:]" '-' | tr "[:upper:]" "[:lower:]"`.html; \
	cp $(TEMPLATE) $$FILENAME; \
	sed -i '' "s/{{ title }}/$$TITLE/g" $$FILENAME; \
	$$EDITOR $$FILENAME; \
	sed -i '' "s#</channel>#<item> <title>$$TITLE</title> <pubDate>$$LONG_DATE</pubDate> <link>https://www.53hor.net/$$FILENAME</link> <guid>https://www.53hor.net/$$FILENAME</guid> </item>\n</channel>#" rss.xml; \
	sed -i '' "s#<ul id=\"index\">#<ul id=\"index\">\n<li> <a href=\"/$$FILENAME\">$$TITLE <code>$$LONG_DATE</code> </a> </li>#" index.html

live:
	rsync -r ./* adam@53hor.net:/srv/www/53hor.net/