diff options
Diffstat (limited to 'panfry/document.py')
| -rwxr-xr-x | panfry/document.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/panfry/document.py b/panfry/document.py index 035bf56..e6e35c8 100755 --- a/panfry/document.py +++ b/panfry/document.py @@ -1,18 +1,19 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import print_function import os import re import pandoc from tempfile import NamedTemporaryFile from panfry.util import * -from panfry.page import TextFile, Page, TOCItem +from panfry.page import TextFile, Page from panfry.toc import TOCItem class Document: - def __init__(self, path): - self.src_path = os.path.join(path, 'src') + def __init__(self, path, subdoc=''): + self.src_path = os.path.join(path, 'src', subdoc) self.meta = self.get_meta(self.src_path) self.pages = self.get_pages(self.src_path) self.full_toc = True @@ -289,9 +290,11 @@ class Document: # If there is not explicit index.html, then link 'index.html' # to the toplevel page. - if self.standalone and not 'index.md' in self.pages: + htmlfiles = [page.htmlfile for page in self.pages] + if self.standalone and not 'index.html' in htmlfiles: src = os.path.join(self.pages[0].htmlfile) ref = os.path.join(pub_path, 'index.html') + print("Linking %s to %s", (ref, src)) if os.path.exists(ref): os.remove(ref) os.symlink(src, ref) |
