summaryrefslogtreecommitdiff
path: root/panfry/document.py
diff options
context:
space:
mode:
authorScott Bahling <sbahling@mudgum.net>2013-03-23 17:29:45 +0100
committerScott Bahling <sbahling@mudgum.net>2013-03-23 17:29:45 +0100
commitb517bd162198c9c2ef0f645e1722af84475be2ce (patch)
treebd3ac6809d0477880074ca5de088ef79e37cc05d /panfry/document.py
parent0426fce3b39ebedf6b92bfe6b18aa08987b11ea2 (diff)
downloadpanfry-b517bd162198c9c2ef0f645e1722af84475be2ce.tar.gz
panfry-b517bd162198c9c2ef0f645e1722af84475be2ce.tar.xz
panfry-b517bd162198c9c2ef0f645e1722af84475be2ce.zip
Add panfry serve command and pandoc-options
Diffstat (limited to 'panfry/document.py')
-rwxr-xr-xpanfry/document.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/panfry/document.py b/panfry/document.py
index edf1cf8..d95d447 100755
--- a/panfry/document.py
+++ b/panfry/document.py
@@ -18,11 +18,15 @@ class Document:
self.css_file = 'css/style.css'
self.assets_dir = 'assets'
+ self.pandoc_options = []
@property
def set_simple_toc(self):
self.full_toc = False
+ def set_pandoc_options(self, options):
+ self.pandoc_options = options
+
@property
def set_full_toc(self):
self.full_toc = True
@@ -178,6 +182,8 @@ class Document:
pandoc.set_cwd(os.path.abspath(self.src_path))
doc.add_argument('latex-engine=xelatex')
+ for option in self.pandoc_options:
+ doc.add_argument(option)
doc.to_file(pdf_path)
pandoc.set_cwd(None)
@@ -194,6 +200,8 @@ class Document:
print("epub_path: %s" % epub_path)
pandoc.set_cwd(os.path.abspath(self.src_path))
+ for option in self.pandoc_options:
+ doc.add_argument(option)
doc.to_file(epub_path)
pandoc.set_cwd(None)
@@ -222,7 +230,9 @@ class Document:
doc.add_argument('toc')
doc.add_argument('template=%s' % template_file.name)
doc.add_argument('css=%s' % self.css_file)
- doc.markdown = '%s\n%s' % (self.header.source,
+ for option in self.pandoc_options:
+ doc.add_argument(option)
+ doc.markdown = '%s\n%s' % (self.header.source,
self.expand_int_links(page.markdown))
content = doc.html
write_file(os.path.join(pub_path, page.htmlfile),