mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add a possibility to define the summary of an article directly in rst.
This commit is contained in:
parent
d8e8bc868f
commit
ec06e6ed95
3 changed files with 5 additions and 5 deletions
1
THANKS
1
THANKS
|
|
@ -12,3 +12,4 @@ bugs or giving ideas. Thanks to them !
|
||||||
- nblock (Florian)
|
- nblock (Florian)
|
||||||
- Bruno Bord
|
- Bruno Bord
|
||||||
- Laureline Guérin
|
- Laureline Guérin
|
||||||
|
- Samuel Martin
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ class Page(object):
|
||||||
if hasattr(self, 'date'):
|
if hasattr(self, 'date'):
|
||||||
self.locale_date = self.date.strftime(self.date_format.encode('ascii','xmlcharrefreplace')).decode('utf')
|
self.locale_date = self.date.strftime(self.date_format.encode('ascii','xmlcharrefreplace')).decode('utf')
|
||||||
|
|
||||||
|
if not hasattr(self, 'summary'):
|
||||||
|
self.summary = property(lambda self: truncate_html_words(self.content, 50))
|
||||||
|
|
||||||
# store the settings ref.
|
# store the settings ref.
|
||||||
self._settings = settings
|
self._settings = settings
|
||||||
|
|
||||||
|
|
@ -74,11 +77,6 @@ class Page(object):
|
||||||
content = self._content
|
content = self._content
|
||||||
return content
|
return content
|
||||||
|
|
||||||
@property
|
|
||||||
def summary(self):
|
|
||||||
return truncate_html_words(self.content, 50)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Article(Page):
|
class Article(Page):
|
||||||
mandatory_properties = ('title', 'date', 'category')
|
mandatory_properties = ('title', 'date', 'category')
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ This is a super article !
|
||||||
:date: 2010-12-02 10:14
|
:date: 2010-12-02 10:14
|
||||||
:category: yeah
|
:category: yeah
|
||||||
:author: Alexis Métaireau
|
:author: Alexis Métaireau
|
||||||
|
:summary: This is a simple test
|
||||||
|
|
||||||
Some content here !
|
Some content here !
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue