publish.sh 738 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. title() { grep "^title: " $f | sed -e "s/^title: //"; }
  3. date() { grep "^date: " $f | sed -e "s/^date: //"; }
  4. description() { perl -p0e 's/^---[\s\S]*?\.\.\.\n\n//' $f |
  5. perl -p0e 's/(\.|\?|\!)( |\n)(.|\n)*/.../g'; }
  6. cat blog-list.md > blog/index.md
  7. find blog/*.md -exec ./redate.sh \{} \;
  8. cd blog
  9. for f in $(ls -1t *.md | sed -e s-.*index.md--); do
  10. touch -d "$(date)" $f
  11. echo -e "[$(title)](${f%.md}.html){.title}\n" >> index.md
  12. echo -e "$(description)\n" >> index.md
  13. done
  14. cd ..
  15. for f in $(find . -type f -name "*.md"); do
  16. pandoc $f --filter pandoc-citeproc --css style.css -T "Alyssa Rosenzweig" \
  17. license.md -s --smart > ${f%.md}.html
  18. done