change the cwd to content dir before running pandoc

This commit is contained in:
liob 2014-03-26 11:59:49 +01:00
parent dc50988b4e
commit f907f764c9
2 changed files with 4 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea
*~

View File

@ -1,3 +1,4 @@
import os
from datetime import datetime from datetime import datetime
from pelican import signals from pelican import signals
from pelican.readers import BaseReader from pelican.readers import BaseReader
@ -28,6 +29,7 @@ class NewReader(BaseReader):
meta = self.process_metadata(name, value) meta = self.process_metadata(name, value)
metadata[name] = meta metadata[name] = meta
os.chdir(self.settings['PATH']) # change the cwd to the content dir
if 'PANDOC_ARGS' in self.settings: if 'PANDOC_ARGS' in self.settings:
output = pypandoc.convert(MD, 'html5', format='md', extra_args=self.settings['PANDOC_ARGS']) output = pypandoc.convert(MD, 'html5', format='md', extra_args=self.settings['PANDOC_ARGS'])
else: else: