-
-
Save brozkeff/5196968cc159317573c00832ff0ff6eb to your computer and use it in GitHub Desktop.
Shell script for converting a batch of *.txt dokuwiki-syntax files into *.html using dokuwiki2mediawiki and then pandoc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script was created to convert a directory full | |
# of dokuwiki files into html. It uses dokuwiki2mediawiki.php for intermediate step converting to mediawiki, and | |
# pandoc to do the conversion from mediawiki to html. | |
# | |
# 1. Install pandoc from http://johnmacfarlane.net/pandoc/ | |
# 2. Copy this script into the directory containing the .txt files | |
# 3. Copy script (https://github.com/tstaerk/mediasyntax/blob/master/tools/dokuwiki2mediawiki.php) to the same directory, make sure you have PHP installed and capable running scripts | |
# 3. Ensure that the script has execute permissions | |
# 4. Run the script | |
# | |
# By default this will keep the original .txt and intermediate .txt.mod file | |
FILES=*.txt | |
for f in $FILES | |
do | |
# extension="${f##*.}" | |
filename="${f%.*}" | |
echo "Intermediate step: Converting $f to mediawiki format" | |
`php ./dokuwiki2mediawiki.php $f` | |
done | |
FILESMOD=*.txt.mod | |
for f in $FILESMOD | |
do | |
# extension="${f##*.}" | |
filename="${f%.*}" | |
echo "Converting $f to $filename.html" | |
`pandoc -f mediawiki $f -t html -o $filename.html` | |
# uncomment this line to delete the source file. | |
# rm $f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment