werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

convert.rc (487B)


      1 #!/usr/bin/env rc
      2 
      3 path=($PLAN9/bin/ $path)
      4 
      5 for(p in *.md) {
      6     echo
      7     echo '========================='
      8     echo p $p
      9     pp=`{echo $p | sed 's/^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])[\-_](.*).md$/\1 \2 \3 \4/' }
     10     echo pp $pp
     11 
     12     d=$pp(1)^'/'^$pp(2)^'/'^$pp(3)^'/'^$pp(4)^'/'
     13 
     14     mkdir -p $d
     15     echo $pp(4) | sed -e 's/^[0-9]_//; s/_/ /g;' > $d/index.md
     16     echo '=================================' >> $d/index.md
     17     echo >> $d/index.md
     18     cat $p >> $d/index.md
     19 
     20 }