#!/bin/bash # set root path here? (currently this script is in script/, so org/ is ../) # another 'trick' to fix the path is dir=$(dirname $0/..) # or cd $(dirname $0/..) # $0 contains the full path to the script # -s makes the doc a standalone document instead of a snippet for doc in org/*.org do # This will return a list of files like 'org/somefile.org'. # To only get the filename we use sed and use basename. filename=$(basename $doc) # we want to get rid of .org nosuffix=$(echo "$filename"|sed -E "s/\.org$//") # -E makes it POSIX compatible # $ locks it to the end, ^ to the beginning # * . ( ) { } [ ] need to be escaped with \ htmlfile="html/$nosuffix.html" echo "$doc > $htmlfile" pandoc -s --toc $doc -o - | \ sed -E "s/(<\/title>)/\1\n /" | \ sed -E "s/(
)/\1\n