From a9bb789b14550d28287aacecee3d6dc5afabc819 Mon Sep 17 00:00:00 2001 From: mviera Date: Wed, 3 Aug 2011 21:59:22 +0200 Subject: [PATCH 1/5] Adding markdown module as requirement. Even I install pelican in a new virtualenv and i tried to execute the pelican command it shows an error such as 'No module md'. Issue #145 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e2bd4c60..3f836293 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import sys VERSION = "2.7.2" # find a better way to do so. -requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils'] +requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils', 'markdown'] if sys.version_info < (2,7): requires.append('argparse') From 319b553f69ea602f106c652cf2c472fcd28b9375 Mon Sep 17 00:00:00 2001 From: mviera Date: Wed, 3 Aug 2011 22:00:41 +0200 Subject: [PATCH 2/5] I developed the ARTICLE_PERMALINK_STRUCTURE option into the wrong method, because urls in feed are not being modified. Now, it's fixed. Issue #145. --- pelican/generators.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 8d6de666..f6ac35a0 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -161,20 +161,6 @@ class ArticlesGenerator(Generator): # in writer, articles pass first article_template = self.get_template('article') for article in chain(self.translations, self.articles): - add_to_url = u'' - if 'ARTICLE_PERMALINK_STRUCTURE' in self.settings: - article_permalink_structure = self.settings['ARTICLE_PERMALINK_STRUCTURE'] - article_permalink_structure = article_permalink_structure.lstrip('/') - - # try to substitute any python datetime directive - add_to_url = article.date.strftime(article_permalink_structure) - # try to substitute any article metadata in rest file - add_to_url = add_to_url % article.__dict__ - add_to_url = [slugify(i) for i in add_to_url.split('/')] - add_to_url = os.path.join(*add_to_url) - - article.url = urlparse.urljoin(add_to_url, article.url) - article.save_as = urlparse.urljoin(add_to_url, article.save_as) write(article.save_as, article_template, self.context, article=article, category=article.category) @@ -247,6 +233,21 @@ class ArticlesGenerator(Generator): if not is_valid_content(article, f): continue + add_to_url = u'' + if 'ARTICLE_PERMALINK_STRUCTURE' in self.settings: + article_permalink_structure = self.settings['ARTICLE_PERMALINK_STRUCTURE'] + article_permalink_structure = article_permalink_structure.lstrip('/') + + # try to substitute any python datetime directive + add_to_url = article.date.strftime(article_permalink_structure) + # try to substitute any article metadata in rest file + add_to_url = add_to_url % article.__dict__ + add_to_url = [slugify(i) for i in add_to_url.split('/')] + add_to_url = os.path.join(*add_to_url) + + article.url = urlparse.urljoin(add_to_url, article.url) + article.save_as = urlparse.urljoin(add_to_url, article.save_as) + if article.status == "published": if hasattr(article, 'tags'): for tag in article.tags: From e8cac3bffff684c1b99f773c64bd69a0dd0b0d6a Mon Sep 17 00:00:00 2001 From: mviera Date: Wed, 3 Aug 2011 22:01:45 +0200 Subject: [PATCH 3/5] I change article.slug to article.url for always referencing the disqus thread to the correct url. Issue #145 --- pelican/themes/notmyidea/templates/comments.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/themes/notmyidea/templates/comments.html b/pelican/themes/notmyidea/templates/comments.html index ea693afb..bb033c0f 100644 --- a/pelican/themes/notmyidea/templates/comments.html +++ b/pelican/themes/notmyidea/templates/comments.html @@ -1 +1 @@ -{% if DISQUS_SITENAME %}

There are comments.

{% endif %} +{% if DISQUS_SITENAME %}

There are comments.

{% endif %} From a32dc03616b33af9b1ec4f58b9e99a20b6be829c Mon Sep 17 00:00:00 2001 From: mviera Date: Wed, 3 Aug 2011 22:11:16 +0200 Subject: [PATCH 4/5] Keeping simple theme up-to-date too. Issue #145 --- pelican/themes/simple/templates/article.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 0bfed07a..30d31fb6 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %}
-

{{ article.title }}

+

{{ article.title }}