# This script converts a directory full of Markdown files into reStructuredText files.
# It uses pandoc to do the conversion.
#
# 1. Copy this script into the directory containing the .md files
# 2. Run 'sh md-to-rst.sh'
# 3. ReStructuredText files will be outputted with same filename as the original Markdown files
FILES=*.md
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.rst"
# Remove -s flag to generate fragment file instead (i.e. no header or footer)
`pandoc -s $f -t rst -o $filename.rst`
# Uncomment to delete the source .md files.
# rm $f
done