Skip to content

Instantly share code, notes, and snippets.

@njamescouk
Created February 22, 2018 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njamescouk/6d41a9f9bbc1a608d00f96e7e9d3a72f to your computer and use it in GitHub Desktop.
Save njamescouk/6d41a9f9bbc1a608d00f96e7e9d3a72f to your computer and use it in GitHub Desktop.
generate default templates for pandoc
@echo off
goto main
My installation of pandoc didn't have the advertised templates or the
advertised directory they were meant to be in, which is a nuisance if
you need to modify them. This batch file should do the job.
:main
pandoc -v | grep "fault user" | sed "s/^[^:]*: *\(.*\)/\1/" > genT_tmpfile
set /p PANDOC_USER_DIR=<genT_tmpfile
del genT_tmpfile
pushd %PANDOC_USER_DIR%
if NOT %errorlevel%==0 echo cannot access pandoc user data directory & goto :eof
if not exist templates md templates
for /f %%t in ('pandoc --list-output-formats') do pandoc --print-default-template=%%t > templates\default.%%t
popd
set PANDOC_USER_DIR=
@njamescouk
Copy link
Author

My installation of pandoc didn't have the advertised templates or the
advertised directory they were meant to be in, which is a nuisance if
you need to modify them. This batch file should do the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment