diff options
| author | Scott Bahling <sbahling@mudgum.net> | 2013-03-23 18:30:40 +0100 |
|---|---|---|
| committer | Scott Bahling <sbahling@mudgum.net> | 2013-03-23 18:30:40 +0100 |
| commit | 4a3dfa8b2c45b339b5dc8db868fd1f9abcb6f14e (patch) | |
| tree | 85b182cc56e59a8b06fde4b4f09b7b678e083633 /panfry | |
| parent | e92d8e5b4459527b13fbe7dfc78e890ddcbf0b7c (diff) | |
| download | panfry-4a3dfa8b2c45b339b5dc8db868fd1f9abcb6f14e.tar.gz panfry-4a3dfa8b2c45b339b5dc8db868fd1f9abcb6f14e.tar.xz panfry-4a3dfa8b2c45b339b5dc8db868fd1f9abcb6f14e.zip | |
Make sure we parse markdown
Cache markdown after first call.
Diffstat (limited to 'panfry')
| -rwxr-xr-x | panfry/page.py | 8 |
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 |
