summaryrefslogtreecommitdiff
path: root/panfry/document.py
diff options
context:
space:
mode:
authorScott Bahling <sbahling@suse.de>2013-07-18 12:43:07 +0200
committerScott Bahling <sbahling@suse.de>2013-07-18 12:43:07 +0200
commit66120bb19e24096f2482df5e479e7e4b9ca59fed (patch)
tree3290393c96773ad1096ef3f3ade79ec1a13be801 /panfry/document.py
parent094530f92d678f9c2f2ad498a2c21653de399a99 (diff)
downloadpanfry-66120bb19e24096f2482df5e479e7e4b9ca59fed.tar.gz
panfry-66120bb19e24096f2482df5e479e7e4b9ca59fed.tar.xz
panfry-66120bb19e24096f2482df5e479e7e4b9ca59fed.zip
Implement multi-level documentation handling
Diffstat (limited to 'panfry/document.py')
-rwxr-xr-xpanfry/document.py11
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)