#!/bin/bash # -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 could enter the folder or # use sed to replace it by regex or use basename. filename=$(basename $doc) # we want to get rid of .org nosuffix=$(echo "$filename"|sed -E "s/\.org$//") # this looks terrible, i know. -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
\n/" | \ sed -E "s/(<\/body>)/\n<\/div>\n\1>/" > $htmlfile pandoc -s $doc -o md/$nosuffix.md # lets try! # after this, I would like to do a bit of styling, but not sure what # that looks like yet. maybe done in CSS instead . # search and replace? it depends on how the CSS is. # The Skeleton template requires that everything is wrapped in a # div class="container" for example, but we could put the container # styling on body instaed. etc. Whatever has the least overhead. done # thanks emacs! # one time only pandoc org/README.org -o ./README.md # one more thing: we need to write the link to the css stylesheet... one sec # fi!