Commits

Alexis Metaireau committed 6e46a40

Parse the metadatas before translating content to HTML

Comments (0)

Files changed (2)

pelican/generators.py

                 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

pelican/readers.py

         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):
         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')