forked from github/pelican
Parse the metadatas before translating content to HTML
This commit is contained in:
parent
536245b006
commit
93fa87f5d3
2 changed files with 5 additions and 2 deletions
|
|
@ -226,7 +226,7 @@ class ArticlesGenerator(Generator):
|
|||
fromp = os.path.expanduser(os.path.join(self.theme, path))
|
||||
to = os.path.expanduser(os.path.join(self.output_path, path))
|
||||
shutil.copytree(fromp, to)
|
||||
print u' ✔ copying %s to %s' % (fromp, to)
|
||||
print u' ✔ copying %s' % fromp
|
||||
|
||||
except OSError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ class RstReader(object):
|
|||
output = {}
|
||||
for m in re.compile(':([a-z]+): (.*)\s', re.M).finditer(content):
|
||||
name, value = m.group(1).lower(), m.group(2)
|
||||
output[name] = _METADATAS_FIELDS[name](value)
|
||||
if name in _METADATAS_FIELDS:
|
||||
output[name] = _METADATAS_FIELDS[name](value)
|
||||
return output
|
||||
|
||||
def read(self, filename):
|
||||
|
|
@ -29,6 +30,8 @@ class RstReader(object):
|
|||
metadatas = self._parse_metadata(text)
|
||||
extra_params = {'input_encoding': 'unicode',
|
||||
'initial_header_level': '2'}
|
||||
from ipdb import set_trace
|
||||
set_trace()
|
||||
rendered_content = core.publish_parts(text, writer_name='html',
|
||||
settings_overrides=extra_params)
|
||||
title = rendered_content.get('title')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue