72 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # list all recipes
 | |
| default:
 | |
|   just --list --unsorted
 | |
| 
 | |
| # build index
 | |
| @index:
 | |
|   find src -type f -name "*.md" -print0 \
 | |
|   | sort -zr \
 | |
|   | xargs -r0 sed -nr '/^(date|name|title): /p' \
 | |
|   | sed '/^date/{G;}' \
 | |
|   | recfmt '* <time>{{{{date}}</time> [{{{{title}}]({{{{name}}.html)|' \
 | |
|   | sed 's/|/\n\n/g' \
 | |
|   | pandoc \
 | |
|       -f markdown+autolink_bare_uris \
 | |
|       -t html5 \
 | |
|       -s \
 | |
|       --include-in-header templates/headerinclude.html \
 | |
|       -A templates/footer.html \
 | |
|       -M title="a blog that is just a bunch of lists" \
 | |
|   > www/index.html
 | |
| 
 | |
| # build htmls
 | |
| html:
 | |
|   make html
 | |
| 
 | |
| # build rss
 | |
| rss:
 | |
|   #!/usr/bin/env sh
 | |
|   exec > www/feed.xml
 | |
|   echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\"><channel><title>list blog</title>"
 | |
|   echo "<atom:link href=\"http://tilde.town/~dozens/listblog/feed.xml\" rel=\"self\" type=\"application/rss+xml\" />"
 | |
|   echo "<link>http://tilde.town/~dozens/listblog/index.html</link><description>a blog that is just a bunch of lists</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"http://tilde.town/~dozens/listblog/feed.xml\" />"
 | |
|   for f in `ls src/*.md`; do
 | |
|     ed -s $f < commands.ed | recfmt -f templates/feeditem.recfmt | m4
 | |
|   done
 | |
|   echo '</channel></rss>'
 | |
| 
 | |
| # make html and rss
 | |
| build: index html rss recfeed
 | |
| 
 | |
| # upload
 | |
| up:
 | |
|   rsync -zaP www/ tilde:public_html/listblog
 | |
| 
 | |
| # build and upload
 | |
| all: build up
 | |
| 
 | |
| # build recfeed
 | |
| recfeed:
 | |
|   #!/usr/bin/env sh
 | |
|   if [ ! -f src/feed.rec ]
 | |
|     then recinf -d /Users/cb/blogs/lunaware/doc/feed.rec > src/feed.rec
 | |
|   fi
 | |
|   for file in `ls src/*.md | grep 'src/\d\{5\}.md'`
 | |
|   do
 | |
|     sed -e '/^---$/,/^---$/!d' -e '/---/d' "$file"
 | |
|     echo "location: $(pwd)/$file"
 | |
|     echo
 | |
|   done \
 | |
|     | recsel  \
 | |
|         -p title,date:published,location \
 | |
|     | awk 'BEGIN { RS=""; FS="\n" }
 | |
|       {
 | |
|         s = "recins src/feed.rec -t item --verbose";
 | |
|         for(x = 1; x <= NF; x++) {
 | |
|           split($x,a,": ");
 | |
|           s = s " -f " a[1] " -v \"" a[2] "\"";
 | |
|         }
 | |
|         system(s)
 | |
|       }'
 | |
|   recset src/feed.rec -t feed -f updated -s `date -Iseconds`
 |