Commit 17ebc03a authored by gijs's avatar gijs
Browse files

Resolving references at a different moment.

parent 57297cd0
......@@ -170,7 +170,7 @@ def parseReference(match, source=None):
target.fill(metadata)
if contentType == 'tag' and 'tags' in source.metadataFields:
if source and contentType == 'tag' and 'tags' in source.metadataFields:
debug('Trying to extend tags')
current = source.tags if hasattr(source, 'tags') else []
if target not in current:
......@@ -322,7 +322,7 @@ class Model(object):
self.setMetadata(metadata)
if content:
self.empty = False
self.content = resolveReferences(content, source=self)
self.content = content
if source_path:
self.source_path = source_path
......
......@@ -2,7 +2,7 @@ import markdown
import os.path
import urllib
from .models import modelFor, collectionFor, UnknownContentTypeError, knownContentTypes
from .models import modelFor, collectionFor, UnknownContentTypeError, knownContentTypes, resolveReferences
from .utils import info, debug, error, warn, keyFilter
from markdown.extensions.toc import TocExtension
......@@ -52,6 +52,7 @@ def parse_pads ():
info('Reading {}'.format(pad.display_slug))
if extension in ['.md', '.markdown']:
source = resolveReferences(source, source=None)
md = markdown.Markdown(extensions=['extra', 'meta', TocExtension(baselevel=2), 'attr_list'])
content = mark_safe(md.convert(source))
......@@ -91,6 +92,8 @@ def parse_pads ():
else:
error('Model for key {} already filled'.format(key))
# resolveReferences()
except UnknownContentTypeError as e:
debug('Skipped `{}`'.format(name))
debug(e)
......@@ -99,7 +102,7 @@ def parse_pads ():
info('Read {}'.format(pad.display_slug))
return models
class Command(BaseCommand):
args = ''
help = 'Generate a static interpretation of the pads'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment