From 3ea2968a8365d51086871ef21a8e444a04710093 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 15 Oct 2010 01:26:21 +0100 Subject: [PATCH] Use docinfo fields instead of comments. --- README.rst | 8 ++++---- pelican/bloggenerator.py | 4 ++-- samples/content/another_super_article.rst | 8 ++++---- samples/content/super_article.rst | 8 ++++---- samples/content/unbelievable.rst | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index ee5a0f24..ffe12665 100644 --- a/README.rst +++ b/README.rst @@ -39,10 +39,10 @@ following syntax:: My super title ############## - .. date: 2010-10-03 10:20 - .. tags: thats, awesome - .. category: yeah - .. author: Alexis Metaireau + :date: 2010-10-03 10:20 + :tags: thats, awesome + :category: yeah + :author: Alexis Metaireau Why the name "Pelican" ? ------------------------ diff --git a/pelican/bloggenerator.py b/pelican/bloggenerator.py index 96dc1053..938c508d 100644 --- a/pelican/bloggenerator.py +++ b/pelican/bloggenerator.py @@ -224,7 +224,7 @@ def read_settings(filename): context[key] = tempdict[key] return context -_METADATA = re.compile('.. ([a-z]+): (.*)', re.M) +_METADATA = re.compile(':([a-z]+): (.*)', re.M) _METADATAS_FIELDS = {'tags': lambda x: x.split(', '), 'date': lambda x: get_date(x), 'category': lambda x: x, @@ -252,7 +252,7 @@ def parse_metadata(string): """ output = {} for m in _METADATA.finditer(string): - name = m.group(1) + name = m.group(1).lower() value = m.group(2) if name in _METADATAS_FIELDS: output[name] = _METADATAS_FIELDS[name](value) diff --git a/samples/content/another_super_article.rst b/samples/content/another_super_article.rst index a6bb18a6..fb9b4c28 100644 --- a/samples/content/another_super_article.rst +++ b/samples/content/another_super_article.rst @@ -1,10 +1,10 @@ Oh yeah ! ######################### -.. tags: oh, bar, yeah -.. date: 2010-10-20 10:14 -.. category: bar -.. author: Alexis Métaireau +:tags: oh, bar, yeah +:date: 2010-10-20 10:14 +:category: bar +:author: Alexis Métaireau Why not ? ========= diff --git a/samples/content/super_article.rst b/samples/content/super_article.rst index f11a2cc0..8f53a0b6 100644 --- a/samples/content/super_article.rst +++ b/samples/content/super_article.rst @@ -1,10 +1,10 @@ This is a super article ! ######################### -.. tags: foo, bar, foobar -.. date: 2010-10-02 10:14 -.. category: yeah -.. author: Alexis Métaireau +:tags: foo, bar, foobar +:date: 2010-10-02 10:14 +:category: yeah +:author: Alexis Métaireau Some content here ! diff --git a/samples/content/unbelievable.rst b/samples/content/unbelievable.rst index bb3c6318..11443e9a 100644 --- a/samples/content/unbelievable.rst +++ b/samples/content/unbelievable.rst @@ -1,6 +1,6 @@ Unbelievable ! ############## -.. date: 2010-10-15 20:30 +:date: 2010-10-15 20:30 Or completely awesome. Depends the needs.