#!/bin/sh cat < EOF if test `uname -s` = 'Darwin'; then SED=gsed else SED=sed fi for file in `find ../../content/ -name '*.md'`; do echo "$file.." 1>&2 slug=`echo $file | $SED 's@../../content@@g' | $SED 's@/_index.md$@@g' | $SED 's@.md$@@g'` if test "x$slug" = "x"; then slug="/" fi slug=`echo $slug | sed 's@^//@/@g'` awk 'BEGIN { i = 0 } /\+\+\+/{x="F"++i;}{print > x;}' $file >/dev/null 2>&1 if test ! -f F1 -a -f F2; then continue fi tail -n +2 F1 > meta.toml tail -n +3 F2 > body.md $SED -i 's/\&/&/g' meta.toml $SED -i 's//\>/g' meta.toml $SED -i 's/\&/&/g' body.md $SED -i 's//\>/g' body.md remarshal -if toml -of json meta.toml > meta.json pandoc -f markdown -t docbook body.md > body.xml echo "" echo "$slug" echo "$file" echo "" cat meta.json echo "" echo "" cat body.xml echo "" echo "" rm -f meta.* body.* F1 F2 done cat < EOF