summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/compile/pandoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'nikola/plugins/compile/pandoc.py')
-rw-r--r--nikola/plugins/compile/pandoc.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/nikola/plugins/compile/pandoc.py b/nikola/plugins/compile/pandoc.py
index 85e84fc..2368ae9 100644
--- a/nikola/plugins/compile/pandoc.py
+++ b/nikola/plugins/compile/pandoc.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2015 Roberto Alsina and others.
+# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -54,7 +54,22 @@ class CompilePandoc(PageCompiler):
"""Compile source file into HTML and save as dest."""
makedirs(os.path.dirname(dest))
try:
+ try:
+ post = self.site.post_per_input_file[source]
+ except KeyError:
+ post = None
subprocess.check_call(['pandoc', '-o', dest, source] + self.site.config['PANDOC_OPTIONS'])
+ with open(dest, 'r', encoding='utf-8') as inf:
+ output, shortcode_deps = self.site.apply_shortcodes(inf.read(), with_dependencies=True)
+ with open(dest, 'w', encoding='utf-8') as outf:
+ outf.write(output)
+ if post is None:
+ if shortcode_deps:
+ self.logger.error(
+ "Cannot save dependencies for post {0} due to unregistered source file name",
+ source)
+ else:
+ post._depfile[dest] += shortcode_deps
except OSError as e:
if e.strreror == 'No such file or directory':
req_missing(['pandoc'], 'build this site (compile with pandoc)', python=False)