mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Use docinfo fields instead of comments.
This commit is contained in:
parent
ed021f02c9
commit
3ea2968a83
5 changed files with 15 additions and 15 deletions
|
|
@ -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" ?
|
||||
------------------------
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 ?
|
||||
=========
|
||||
|
|
|
|||
|
|
@ -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 !
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Unbelievable !
|
||||
##############
|
||||
|
||||
.. date: 2010-10-15 20:30
|
||||
:date: 2010-10-15 20:30
|
||||
|
||||
Or completely awesome. Depends the needs.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue