summaryrefslogtreecommitdiff
path: root/panfry/page.py
diff options
context:
space:
mode:
Diffstat (limited to 'panfry/page.py')
-rwxr-xr-xpanfry/page.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/panfry/page.py b/panfry/page.py
index 42eda1e..7326240 100755
--- a/panfry/page.py
+++ b/panfry/page.py
@@ -56,10 +56,13 @@ class Page(TextFile):
TextFile.__init__(self, filename, source)
self.doc = pandoc.Document()
self.doc._input(self.source, format=format)
+ self._markdown = ''
@property
def markdown(self):
- return self.doc.markdown
+ if not self._markdown:
+ self._markdown = self.doc.markdown
+ return self._markdown
@property
def title(self):
@@ -97,7 +100,8 @@ class Page(TextFile):
'''
toc = []
heading = ''
- for line in self.lines:
+ for line in self.markdown.split('\n'):
+ line = line.strip()
if heading and re.match('[=]{2}', line):
toc.append(TOCItem(heading, 1))
continue