diff --git a/pelican/contents.py b/pelican/contents.py index d0859a96..4f72f13a 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -85,8 +85,8 @@ class Page(object): self.locale_date = self.date.strftime(self.date_format.encode('ascii','xmlcharrefreplace')).decode('utf') # manage summary - if not hasattr(self, 'summary'): - self.summary = property(lambda self: truncate_html_words(self.content, 50)).__get__(self, Page) + if not hasattr(self, '_summary'): + self._summary = property(lambda self: truncate_html_words(self.content, 50)).__get__(self, Page) # manage status if not hasattr(self, 'status'): @@ -106,6 +106,15 @@ class Page(object): content = self._content return content + @property + def summary(self): + if hasattr(self, "_get_summary"): + summary = self._get_summary() + else: + summary = self._summary + return summary + + class Article(Page): mandatory_properties = ('title', 'date', 'category') diff --git a/pelican/writers.py b/pelican/writers.py index 4dfc1ba6..c57ae299 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -16,7 +16,8 @@ class Writer(object): def __init__(self, output_path, settings=None): self.output_path = output_path - self.reminder = dict() + self.reminder_content = dict() + self.reminder_summary = dict() self.settings = settings or {} def _create_new_feed(self, feed_type, context): @@ -200,11 +201,20 @@ class Writer(object): self.update_context_contents(name, item) # if it is a content, patch it - elif hasattr(item, '_content'): - relative_path = get_relative_path(name) - - paths = self.reminder.setdefault(item, []) + else: + + if hasattr(item, '_content'): + relative_path = get_relative_path(name) + paths = self.reminder_content.setdefault(item, []) if relative_path not in paths: paths.append(relative_path) setattr(item, "_get_content", partial(_update_content, name, item)) + + if hasattr(item, '_summary'): + relative_path = get_relative_path(name) + paths = self.reminder_summary.setdefault(item, []) + if relative_path not in paths: + paths.append(relative_path) + setattr(item, "_get_summary", + partial(_update_content, name, item))