From cc1988fbda5f191768b9d20ef0f942b572d0bb39 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Thu, 14 Jun 2012 23:08:34 -0400 Subject: [PATCH 0001/1975] new HTMLReader --- pelican/readers.py | 186 ++++++++---------- tests/content/article_with_keywords.html | 6 + tests/content/article_with_metadata.html | 15 ++ .../article_with_uppercase_metadata.html | 6 + tests/test_readers.py | 38 ++++ 5 files changed, 150 insertions(+), 101 deletions(-) create mode 100644 tests/content/article_with_keywords.html create mode 100644 tests/content/article_with_metadata.html create mode 100644 tests/content/article_with_uppercase_metadata.html diff --git a/pelican/readers.py b/pelican/readers.py index 83cb7e3b..9ce3e3c0 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -129,117 +129,101 @@ class MarkdownReader(Reader): metadata[name] = self.process_metadata(name, value[0]) return content, metadata -""" -class HtmlReader(Reader): - file_extensions = ['html', 'htm'] - _re = re.compile('\<\!\-\-\#\s?[A-z0-9_-]*\s?\:s?[A-z0-9\s_-]*\s?\-\-\>') - - def read(self, filename): - with open(filename) as content: - metadata = {'title': 'unnamed'} - for i in self._re.findall(content): - key = i.split(':')[0][5:].strip() - value = i.split(':')[-1][:-3].strip() - name = key.lower() - metadata[name] = self.process_metadata(name, value) - - return content, metadata -""" - -class PelicanHTMLParser(HTMLParser): - def __init__(self, settings): - HTMLParser.__init__(self) - self.body = '' - self.metadata = {} - self.settings = settings - - self._data_buffer = '' - - self._in_top_level = True - self._in_head = False - self._in_title = False - self._in_body = False - self._in_tags = False - - def handle_starttag(self, tag, attrs): - if tag == 'head' and self._in_top_level: - self._in_top_level = False - self._in_head = True - elif tag == 'title' and self._in_head: - self._in_title = True - self._data_buffer = '' - elif tag == 'body' and self._in_top_level: - self._in_top_level = False - self._in_body = True - self._data_buffer = '' - elif tag == 'meta' and self._in_head: - self._handle_meta_tag(attrs) - - elif self._in_body: - self._data_buffer += self.build_tag(tag, attrs, False) - - def handle_endtag(self, tag): - if tag == 'head': - if self._in_head: - self._in_head = False - self._in_top_level = True - elif tag == 'title': - self._in_title = False - self.metadata['title'] = self._data_buffer - elif tag == 'body': - self.body = self._data_buffer - self._in_body = False - self._in_top_level = True - elif self._in_body: - self._data_buffer += ''.format(cgi.escape(tag)) - - def handle_startendtag(self, tag, attrs): - if tag == 'meta' and self._in_head: - self._handle_meta_tag(attrs) - if self._in_body: - self._data_buffer += self.build_tag(tag, attrs, True) - - def handle_comment(self, data): - if self._in_body and data.strip() == 'PELICAN_END_SUMMARY': - self.metadata['summary'] = self._data_buffer - - def handle_data(self, data): - self._data_buffer += data - - def build_tag(self, tag, attrs, close_tag): - result = '<{}'.format(cgi.escape(tag)) - result += ''.join((' {}="{}"'.format(cgi.escape(k), cgi.escape(v)) for k,v in attrs)) - if close_tag: - return result + ' />' - return result + '>' - - def _handle_meta_tag(self, attrs): - name = self._attr_value(attrs, 'name') - contents = self._attr_value(attrs, 'contents', '') - if name == 'keywords': - if contents: - self.metadata['tags'] = [Tag(unicode(tag), self.settings) for tag in contents.split(',')] - elif name == 'date': - self.metadata['date'] = get_date(contents) - else: - self.metadata[name] = contents - - @classmethod - def _attr_value(cls, attrs, name, default=None): - return next((x[1] for x in attrs if x[0] == name), default) - class HTMLReader(Reader): + """Parses HTML files as input, looking for meta, title, and body tags""" file_extensions = ['htm', 'html'] enabled = True + class _HTMLParser(HTMLParser): + def __init__(self, settings): + HTMLParser.__init__(self) + self.body = '' + self.metadata = {} + self.settings = settings + + self._data_buffer = '' + + self._in_top_level = True + self._in_head = False + self._in_title = False + self._in_body = False + self._in_tags = False + + def handle_starttag(self, tag, attrs): + if tag == 'head' and self._in_top_level: + self._in_top_level = False + self._in_head = True + elif tag == 'title' and self._in_head: + self._in_title = True + self._data_buffer = '' + elif tag == 'body' and self._in_top_level: + self._in_top_level = False + self._in_body = True + self._data_buffer = '' + elif tag == 'meta' and self._in_head: + self._handle_meta_tag(attrs) + + elif self._in_body: + self._data_buffer += self.build_tag(tag, attrs, False) + + def handle_endtag(self, tag): + if tag == 'head': + if self._in_head: + self._in_head = False + self._in_top_level = True + elif tag == 'title': + self._in_title = False + self.metadata['title'] = self._data_buffer + elif tag == 'body': + self.body = self._data_buffer + self._in_body = False + self._in_top_level = True + elif self._in_body: + self._data_buffer += ''.format(cgi.escape(tag)) + + def handle_startendtag(self, tag, attrs): + if tag == 'meta' and self._in_head: + self._handle_meta_tag(attrs) + if self._in_body: + self._data_buffer += self.build_tag(tag, attrs, True) + + def handle_comment(self, data): + if self._in_body and data.strip() == 'PELICAN_END_SUMMARY': + self.metadata['summary'] = self._data_buffer + + def handle_data(self, data): + self._data_buffer += data + + def build_tag(self, tag, attrs, close_tag): + result = '<{}'.format(cgi.escape(tag)) + result += ''.join((' {}="{}"'.format(cgi.escape(k), cgi.escape(v)) for k,v in attrs)) + if close_tag: + return result + ' />' + return result + '>' + + def _handle_meta_tag(self, attrs): + name = self._attr_value(attrs, 'name').lower() + contents = self._attr_value(attrs, 'contents', '') + + if name == 'keywords': + name = 'tags' + self.metadata[name] = contents + + @classmethod + def _attr_value(cls, attrs, name, default=None): + return next((x[1] for x in attrs if x[0] == name), default) + def read(self, filename): """Parse content and metadata of markdown files""" with open(filename) as content: - parser = PelicanHTMLParser(self.settings) + parser = self._HTMLParser(self.settings) parser.feed(content) parser.close() - return parser.body, parser.metadata + metadata = {} + for k in parser.metadata: + metadata[k] = self.process_metadata(k, parser.metadata[k]) + return parser.body, metadata _EXTENSIONS = {} diff --git a/tests/content/article_with_keywords.html b/tests/content/article_with_keywords.html new file mode 100644 index 00000000..c869f514 --- /dev/null +++ b/tests/content/article_with_keywords.html @@ -0,0 +1,6 @@ + + + This is a super article ! + + + diff --git a/tests/content/article_with_metadata.html b/tests/content/article_with_metadata.html new file mode 100644 index 00000000..2bd77241 --- /dev/null +++ b/tests/content/article_with_metadata.html @@ -0,0 +1,15 @@ + + + This is a super article ! + + + + + + + + Multi-line metadata should be supported + as well as inline markup. + + + diff --git a/tests/content/article_with_uppercase_metadata.html b/tests/content/article_with_uppercase_metadata.html new file mode 100644 index 00000000..4fe5a9ee --- /dev/null +++ b/tests/content/article_with_uppercase_metadata.html @@ -0,0 +1,6 @@ + + + This is a super article ! + + + diff --git a/tests/test_readers.py b/tests/test_readers.py index a921cfc2..52887068 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -86,3 +86,41 @@ class MdReaderTest(unittest.TestCase): "

This is another markdown test file. Uses the mkd extension.

" self.assertEqual(content, expected) + +class HTMLReaderTest(unittest.TestCase): + + def test_article_with_metadata(self): + reader = readers.HTMLReader({}) + content, metadata = reader.read(_filename('article_with_metadata.html')) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'This is a super article !', + 'summary': u''' + Multi-line metadata should be supported + as well as inline markup. + ''', + 'date': datetime.datetime(2010, 12, 2, 10, 14), + 'tags': ['foo', 'bar', 'foobar'], + 'custom_field': 'http://notmyidea.org', + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + def test_article_with_keywords(self): + reader = readers.HTMLReader({}) + content, metadata = reader.read(_filename('article_with_keywords.html')) + expected = { + 'tags': ['foo', 'bar', 'foobar'], + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + def test_article_metadata_key_lowercase(self): + """Keys of metadata should be lowercase.""" + reader = readers.HTMLReader({}) + content, metadata = reader.read(_filename('article_with_uppercase_metadata.html')) + self.assertIn('category', metadata, "Key should be lowercase.") + self.assertEquals('Yeah', metadata.get('category'), "Value keeps cases.") From 0373c15e430e168928b645be3b9513f093b97403 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Thu, 14 Jun 2012 23:16:27 -0400 Subject: [PATCH 0002/1975] include html comments properly in reader --- pelican/readers.py | 2 ++ tests/content/article_with_comments.html | 7 +++++ tests/test_readers.py | 36 ++++++++++++++++++------ 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 tests/content/article_with_comments.html diff --git a/pelican/readers.py b/pelican/readers.py index 9ce3e3c0..e3d0e0dd 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -190,6 +190,8 @@ class HTMLReader(Reader): def handle_comment(self, data): if self._in_body and data.strip() == 'PELICAN_END_SUMMARY': self.metadata['summary'] = self._data_buffer + else: + self._data_buffer += ''.format(data) def handle_data(self, data): self._data_buffer += data diff --git a/tests/content/article_with_comments.html b/tests/content/article_with_comments.html new file mode 100644 index 00000000..f222682d --- /dev/null +++ b/tests/content/article_with_comments.html @@ -0,0 +1,7 @@ + + + Summary comment is not included. + + + + diff --git a/tests/test_readers.py b/tests/test_readers.py index 52887068..b3e30bfc 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -88,6 +88,33 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) class HTMLReaderTest(unittest.TestCase): + def test_article_with_comments(self): + reader = readers.HTMLReader({}) + content, metadata = reader.read(_filename('article_with_comments.html')) + expected = { + 'summary': ''' + Summary comment is not included. + ''', + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + self.assertEquals(''' + Summary comment is not included. + + + ''', content) + + def test_article_with_keywords(self): + reader = readers.HTMLReader({}) + content, metadata = reader.read(_filename('article_with_keywords.html')) + expected = { + 'tags': ['foo', 'bar', 'foobar'], + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) def test_article_with_metadata(self): reader = readers.HTMLReader({}) @@ -108,15 +135,6 @@ class HTMLReaderTest(unittest.TestCase): for key, value in expected.items(): self.assertEquals(value, metadata[key], key) - def test_article_with_keywords(self): - reader = readers.HTMLReader({}) - content, metadata = reader.read(_filename('article_with_keywords.html')) - expected = { - 'tags': ['foo', 'bar', 'foobar'], - } - - for key, value in expected.items(): - self.assertEquals(value, metadata[key], key) def test_article_metadata_key_lowercase(self): """Keys of metadata should be lowercase.""" From c608d39aa40b8304f4e2e241564796201e582da4 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Wed, 20 Jun 2012 19:52:17 -0400 Subject: [PATCH 0003/1975] re-import htmlparser --- pelican/readers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/readers.py b/pelican/readers.py index 870c11c8..1916fa1e 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -15,6 +15,8 @@ except ImportError: Markdown = False # NOQA import re +from htmlparser import HTMLParser + from pelican.contents import Category, Tag, Author from pelican.utils import get_date, open From caa4442abb145d419a3120c7339ad7ecf91ac56c Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Wed, 20 Jun 2012 19:59:32 -0400 Subject: [PATCH 0004/1975] re-import cgi. properly turn utils.open into a context manager --- pelican/readers.py | 3 ++- pelican/utils.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 1916fa1e..d05ab40f 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -15,7 +15,8 @@ except ImportError: Markdown = False # NOQA import re -from htmlparser import HTMLParser +import cgi +from HTMLParser import HTMLParser from pelican.contents import Category, Tag, Author from pelican.utils import get_date, open diff --git a/pelican/utils.py b/pelican/utils.py index 0940bf72..088a8faa 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -34,10 +34,15 @@ def get_date(string): raise ValueError("'%s' is not a valid date" % string) -def open(filename): +class open(object): """Open a file and return it's content""" - return _open(filename, encoding='utf-8').read() + def __init__(self, filename): + self.filename = filename + def __enter__(self): + return _open(self.filename, encoding='utf-8').read() + def __exit__(self, exc_type, exc_value, traceback): + pass def slugify(value): """ From 56800a1d43ff9e07659d0f5ad570a9004d44cd74 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Wed, 20 Jun 2012 20:02:41 -0400 Subject: [PATCH 0005/1975] fix failing test with new open context manager --- pelican/readers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index d05ab40f..1d06bd6d 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -119,9 +119,9 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - text = open(filename) - md = Markdown(extensions=set(self.extensions + ['meta'])) - content = md.convert(text) + with open(filename) as text: + md = Markdown(extensions=set(self.extensions + ['meta'])) + content = md.convert(text) metadata = {} for name, value in md.Meta.items(): From c0578eb9ab77c7be4a045f58a7844222ccbe6b95 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Wed, 20 Jun 2012 23:19:06 -0400 Subject: [PATCH 0006/1975] handle escaped chars in html properly --- pelican/readers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pelican/readers.py b/pelican/readers.py index 1d06bd6d..08ef4cf8 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -196,6 +196,12 @@ class HTMLReader(Reader): def handle_data(self, data): self._data_buffer += data + def handle_entityref(self, data): + self._data_buffer += '&{};'.format(data) + + def handle_charref(self, data): + self._data_buffer += '&{};'.format(data) + def build_tag(self, tag, attrs, close_tag): result = '<{}'.format(cgi.escape(tag)) result += ''.join((' {}="{}"'.format(cgi.escape(k), cgi.escape(v)) for k,v in attrs)) From 036728a194695d463123c714954c25a3d6a826d5 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Thu, 21 Jun 2012 09:05:27 -0400 Subject: [PATCH 0007/1975] properly write out charref's --- pelican/readers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/readers.py b/pelican/readers.py index 08ef4cf8..93549d96 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -200,7 +200,7 @@ class HTMLReader(Reader): self._data_buffer += '&{};'.format(data) def handle_charref(self, data): - self._data_buffer += '&{};'.format(data) + self._data_buffer += '&#{};'.format(data) def build_tag(self, tag, attrs, close_tag): result = '<{}'.format(cgi.escape(tag)) From 847a6fe3cee7f05e36679d6b12fafaf58cfc1045 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Thu, 21 Jun 2012 09:12:38 -0400 Subject: [PATCH 0008/1975] change 'markdown' to HTML in the comments --- pelican/readers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/readers.py b/pelican/readers.py index 93549d96..9d200599 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -222,7 +222,7 @@ class HTMLReader(Reader): return next((x[1] for x in attrs if x[0] == name), default) def read(self, filename): - """Parse content and metadata of markdown files""" + """Parse content and metadata of HTML files""" with open(filename) as content: parser = self._HTMLParser(self.settings) parser.feed(content) From a86d5fda71a2d2ce7295cb385641331b139bf361 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Mon, 9 Jul 2012 22:43:51 -0400 Subject: [PATCH 0009/1975] add documentation for html reader --- docs/getting_started.rst | 30 ++++++++++++++++++++++++++++++ docs/internals.rst | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 93d578a0..d60cce83 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -154,6 +154,36 @@ Markdown posts should follow this pattern:: This is the content of my super blog post. +Lastly, you can use Vanilla HTML (files ending in ``.htm`` and ``.html``). Pelican +interprets the HTML in a very straightforward manner, reading meta data out +of ``meta`` tags, the title out of the ``title`` tag, and the body out of the +``body`` tag:: + + + + My super title + + + + + + + This is the content of my super blog post. + + Content continues down here. + + + +With HTML, there are two simple exceptions to the standard metadata. First, +``tags`` can be specified either with the ``tags`` metadata, as is standard in +Pelican, or with the ``keywords`` metadata, as is standard in HTML. The two can +be used interchangeably. The second note is that summaries are done differently +in HTML posts. Either a ``summary`` metadata tag can be supplied, or, as seen +above, you can place an HTML comment, ````, that +Pelican will recognize. Everything before the comment will be treated as a +summary. The content of the post will contain everything in the body tag, with +the special comment stripped out. + Note that, aside from the title, none of this metadata is mandatory: if the date is not specified, Pelican will rely on the file's "mtime" timestamp, and the category can be determined by the directory in which the file resides. For diff --git a/docs/internals.rst b/docs/internals.rst index 6b6f991f..a94d1c56 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -23,7 +23,7 @@ The logic is separated into different classes and concepts: on. Since those operations are commonly used, the object is created once and then passed to the generators. -* **Readers** are used to read from various formats (Markdown and +* **Readers** are used to read from various formats (HTML, Markdown and reStructuredText for now, but the system is extensible). Given a file, they return metadata (author, tags, category, etc.) and content (HTML-formatted). From 4ec6cefe1db92c0bc6cea9a95c810e3f5b455865 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Mon, 9 Jul 2012 22:45:34 -0400 Subject: [PATCH 0010/1975] fix grammar --- docs/getting_started.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index d60cce83..5e553815 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -154,7 +154,7 @@ Markdown posts should follow this pattern:: This is the content of my super blog post. -Lastly, you can use Vanilla HTML (files ending in ``.htm`` and ``.html``). Pelican +Lastly, you can use vanilla HTML (files ending in ``.htm`` and ``.html``). Pelican interprets the HTML in a very straightforward manner, reading meta data out of ``meta`` tags, the title out of the ``title`` tag, and the body out of the ``body`` tag:: From 172555bbceaed599a219fc9b7c1676f7eb79a6ba Mon Sep 17 00:00:00 2001 From: Iuri de Silvio Date: Fri, 20 Jul 2012 21:23:27 -0300 Subject: [PATCH 0011/1975] Use async Google Analytics code. --- pelican/themes/notmyidea/templates/analytics.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pelican/themes/notmyidea/templates/analytics.html b/pelican/themes/notmyidea/templates/analytics.html index ba174fcc..4de2c86b 100644 --- a/pelican/themes/notmyidea/templates/analytics.html +++ b/pelican/themes/notmyidea/templates/analytics.html @@ -1,11 +1,12 @@ {% if GOOGLE_ANALYTICS %} - {% endif %} \ No newline at end of file From baeec62e07b68a00637d7cfa045199f2b2b8e49d Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 1 Aug 2012 13:02:15 -0400 Subject: [PATCH 0012/1975] Ignore coverage.py --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9274ba2d..9f9404ef 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ build dist tags .tox +.coverage +htmlcov From 7cb18a088ee37521bcdbd668a321f754bf83c28d Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 1 Aug 2012 13:36:47 -0400 Subject: [PATCH 0013/1975] Reimplement settings loading to preserve __file__ --- pelican/settings.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/pelican/settings.py b/pelican/settings.py index e9888f94..645a9809 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +import imp +import inspect import os import locale import logging @@ -84,21 +86,31 @@ def read_settings(filename=None): return configured_settings -def get_settings_from_file(filename, default_settings=None): - """Load a Python file into a dictionary. +def get_settings_from_module(module=None, default_settings=_DEFAULT_CONFIG): """ - if default_settings == None: - default_settings = _DEFAULT_CONFIG + Load settings from a module, returning a dict. + + """ + context = default_settings.copy() - if filename: - tempdict = {} - execfile(filename, tempdict) - for key in tempdict: - if key.isupper(): - context[key] = tempdict[key] + if module is not None: + context.update( + (k, v) for k, v in inspect.getmembers(module) if k.isupper() + ) return context +def get_settings_from_file(filename, default_settings=_DEFAULT_CONFIG): + """ + Load settings from a file path, returning a dict. + + """ + + name = os.path.basename(filename).rpartition(".")[0] + module = imp.load_source(name, filename) + return get_settings_from_module(module, default_settings=default_settings) + + def configure_settings(settings, default_settings=None, filename=None): """Provide optimizations, error checking, and warnings for loaded settings""" if default_settings is None: From cadcfa43c3337aaa3461d0fa197d19b02b38fd6a Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 8 Aug 2012 12:18:02 -0700 Subject: [PATCH 0014/1975] Increment version to 3.1 in changelog and setup.py --- docs/changelog.rst | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 064818c9..6cea6d93 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Release history ############### +3.1 (XXXX-XX-XX) +================ + +* Improve handling of links to intra-site resources + 3.0 (2012-08-08) ================== diff --git a/setup.py b/setup.py index 96d7b8e6..90c469ca 100755 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ entry_points = { setup( name = "pelican", - version = "3.0", + version = "3.1", url = 'http://getpelican.com/', author = 'Alexis Metaireau', author_email = 'alexis@notmyidea.org', From 10f75524fc6824496afea0104f754cbd5e46d9f9 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 13 Aug 2012 20:55:26 +0200 Subject: [PATCH 0015/1975] PEP8-ify --- setup.py | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index 90c469ca..472f0f73 100755 --- a/setup.py +++ b/setup.py @@ -1,10 +1,11 @@ #!/usr/bin/env python from setuptools import setup -requires = ['feedgenerator', 'jinja2 >= 2.4', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode'] +requires = ['feedgenerator', 'jinja2 >= 2.4', 'pygments', 'docutils', 'pytz', + 'blinker', 'unidecode'] try: - import argparse + import argparse # NOQA except ImportError: requires.append('argparse') @@ -18,24 +19,26 @@ entry_points = { } setup( - name = "pelican", - version = "3.1", - url = 'http://getpelican.com/', - author = 'Alexis Metaireau', - author_email = 'alexis@notmyidea.org', - description = "A tool to generate a static blog from reStructuredText or Markdown input files.", + name="pelican", + version="3.1", + url='http://getpelican.com/', + author='Alexis Metaireau', + author_email='alexis@notmyidea.org', + description="A tool to generate a static blog from reStructuredText or "\ + "Markdown input files.", long_description=open('README.rst').read(), - packages = ['pelican', 'pelican.tools', 'pelican.plugins'], - include_package_data = True, - install_requires = requires, - entry_points = entry_points, - classifiers = ['Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'License :: OSI Approved :: GNU Affero General Public License v3', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], + packages=['pelican', 'pelican.tools', 'pelican.plugins'], + include_package_data=True, + install_requires=requires, + entry_points=entry_points, + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'License :: OSI Approved :: GNU Affero General Public License v3', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Topic :: Internet :: WWW/HTTP', + 'Topic :: Software Development :: Libraries :: Python Modules', + ], ) From ec14df9fbbb04d824705259f1bdcf0d527025490 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 13 Aug 2012 20:56:43 +0200 Subject: [PATCH 0016/1975] add a way to run setup.py test --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 472f0f73..97c8ca64 100755 --- a/setup.py +++ b/setup.py @@ -41,4 +41,5 @@ setup( 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development :: Libraries :: Python Modules', ], + test_suite='tests', ) From 515847fdd24a952af4f858b05e6a9aebcf8d056f Mon Sep 17 00:00:00 2001 From: Zoresvit Date: Thu, 16 Aug 2012 14:17:46 +0300 Subject: [PATCH 0017/1975] Include index in format() string. Argument index is included in .format() method format string in order to be friendly with various Python versions and consistent with the rest of the code. --- pelican/tools/pelican_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index dab3c3a8..b6437c92 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -233,7 +233,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals # Replace newlines with paragraphs wrapped with

so # HTML is valid before conversion paragraphs = content.split('\n\n') - paragraphs = [u'

{}

'.format(p) for p in paragraphs] + paragraphs = [u'

{0}

'.format(p) for p in paragraphs] new_content = ''.join(paragraphs) fp.write(new_content) From 892761f73222233777b90da9634bacc95001ad93 Mon Sep 17 00:00:00 2001 From: Zoresvit Date: Thu, 16 Aug 2012 14:19:10 +0300 Subject: [PATCH 0018/1975] Fixed description of copying themes/static content. The content from `static` directory is actually copied into `theme/`, not `theme/static/`. --- docs/themes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/themes.rst b/docs/themes.rst index 25cdd682..d3dd4d9e 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -29,7 +29,7 @@ To make your own theme, you must follow the following structure:: └── tags.html // must list all the tags. Can be a tag cloud. * `static` contains all the static assets, which will be copied to the output - `theme/static` folder. I've put the CSS and image folders here, but they are + `theme` folder. I've put the CSS and image folders here, but they are just examples. Put what you need here. * `templates` contains all the templates that will be used to generate the content. From ef3cad54219382f7290ce5bc0da05ac1d2dc7c42 Mon Sep 17 00:00:00 2001 From: Wladislaw Merezhko Date: Sat, 18 Aug 2012 20:32:43 +0300 Subject: [PATCH 0019/1975] Fixing pdf generation issue --- pelican/generators.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ae9334da..a1901889 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -6,6 +6,7 @@ import logging import datetime import subprocess +from codecs import open from collections import defaultdict from functools import partial from itertools import chain @@ -16,7 +17,7 @@ from jinja2.exceptions import TemplateNotFound from pelican.contents import Article, Page, Category, is_valid_content from pelican.readers import read_file -from pelican.utils import copy, process_translations, open +from pelican.utils import copy, process_translations from pelican import signals @@ -269,7 +270,7 @@ class ArticlesGenerator(Generator): if 'category' not in metadata: if os.path.dirname(f) == article_path: # if the article is not in a subdirectory - category = self.settings['DEFAULT_CATEGORY'] + category = self.settings['DEFAULT_CATEGORY'] else: category = os.path.basename(os.path.dirname(f))\ .decode('utf-8') @@ -352,7 +353,7 @@ class ArticlesGenerator(Generator): self.authors = list(self.authors.items()) self.authors.sort(key=lambda item: item[0].name) - + self._update_context(('articles', 'dates', 'tags', 'categories', 'tag_cloud', 'authors', 'related_posts')) @@ -370,7 +371,7 @@ class PagesGenerator(Generator): self.hidden_translations = [] super(PagesGenerator, self).__init__(*args, **kwargs) signals.pages_generator_init.send(self) - + def generate_context(self): all_pages = [] hidden_pages = [] @@ -467,7 +468,7 @@ class PdfGenerator(Generator): output_pdf = os.path.join(output_path, filename) # print "Generating pdf for", obj.filename, " in ", output_pdf with open(obj.filename) as f: - self.pdfcreator.createPdf(text=f, output=output_pdf) + self.pdfcreator.createPdf(text=f.read(), output=output_pdf) logger.info(u' [ok] writing %s' % output_pdf) def generate_context(self): From b1866c8f92b691969820d9485864f4f9189f5a19 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 21 Aug 2012 09:04:37 -0700 Subject: [PATCH 0020/1975] Change email address in docs to "authors@" alias --- README.rst | 2 +- docs/index.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 3a62d0ca..018f73ba 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ If you want to see new features in Pelican, don't hesitate to offer suggestions, clone the repository, etc. There are many ways to contribute_. That's open source, dude! -Send a message to "alexis at notmyidea dot org" with any requests/feedback! You +Send a message to "authors at getpelican dot com" with any requests/feedback! You can also join the team at `#pelican on Freenode`_ (or if you don't have an IRC client handy, use the webchat_ for quick feedback. diff --git a/docs/index.rst b/docs/index.rst index b04557eb..477b4342 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -44,7 +44,7 @@ If you want to see new features in Pelican, don't hesitate to offer suggestions, clone the repository, etc. There are many ways to :doc:`contribute`. That's open source, dude! -Send a message to "alexis at notmyidea dot org" with any requests/feedback! You +Send a message to "authors at getpelican dot com" with any requests/feedback! You can also join the team at `#pelican on Freenode`_ (or if you don't have an IRC client handy, use the webchat_ for quick feedback. From be5b5e880dce407ad3b80d73020aa55b4aa30fab Mon Sep 17 00:00:00 2001 From: Eric Case Date: Tue, 21 Aug 2012 14:14:10 -0700 Subject: [PATCH 0021/1975] added a missing space --- docs/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index 4efefaf2..c5c751e6 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -76,7 +76,7 @@ include the following at the top of the article:: That meta-data can then be accessed in the template:: {% if article.modified %} - Last modified: {{ article.modified}} + Last modified: {{ article.modified }} {% endif %} How do I assign custom templates on a per-page basis? From e9a0717aeab4a9fb8eb59795a19a043b1e88ef55 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Wed, 22 Aug 2012 23:05:07 +0200 Subject: [PATCH 0022/1975] Added a new signal `finalized` that is dispatched when pelican finishes. This signal can then be used for post processing. --- docs/plugins.rst | 1 + pelican/__init__.py | 2 ++ pelican/signals.py | 1 + 3 files changed, 4 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index 53858668..bce17ddb 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -57,6 +57,7 @@ Here is the list of currently implemented signals: Signal Arguments Description ========================= ============================ ========================================= initialized pelican object +finalized pelican object article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ pages_generate_context pages_generator, metadata diff --git a/pelican/__init__.py b/pelican/__init__.py index ba48c4c7..803e289a 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -178,6 +178,8 @@ class Pelican(object): if hasattr(p, 'generate_output'): p.generate_output(writer) + signals.finalized.send(self) + def get_generator_classes(self): generators = [StaticGenerator, ArticlesGenerator, PagesGenerator] if self.settings['PDF_GENERATOR']: diff --git a/pelican/signals.py b/pelican/signals.py index 4d9ab512..ddd59621 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -1,6 +1,7 @@ from blinker import signal initialized = signal('pelican_initialized') +finalized = signal('pelican_finalized') article_generate_context = signal('article_generate_context') article_generator_init = signal('article_generator_init') pages_generate_context = signal('pages_generate_context') From 62f190d574c5738efa5782885cf4c40d33cb2142 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Thu, 23 Aug 2012 07:58:39 -0700 Subject: [PATCH 0023/1975] use lowercase pwd since only Mac OS X allows uppercase commands Fix #473 --- pelican/tools/templates/Makefile.in | 2 +- pelican/tools/templates/develop_server.sh.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 9a26e315..1445f0b0 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -1,7 +1,7 @@ PELICAN=$pelican PELICANOPTS=$pelicanopts -BASEDIR=$$(PWD) +BASEDIR=$$(pwd) INPUTDIR=$$(BASEDIR)/content OUTPUTDIR=$$(BASEDIR)/output CONFFILE=$$(BASEDIR)/pelicanconf.py diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in index 2f8c07dd..b1e3b60c 100755 --- a/pelican/tools/templates/develop_server.sh.in +++ b/pelican/tools/templates/develop_server.sh.in @@ -5,7 +5,7 @@ PELICAN=$pelican PELICANOPTS=$pelicanopts -BASEDIR=$$(PWD) +BASEDIR=$$(pwd) INPUTDIR=$$BASEDIR/content OUTPUTDIR=$$BASEDIR/output CONFFILE=$$BASEDIR/pelicanconf.py From 86da6d1f2e954ae575f0b3a78d39eb3106a11c46 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Thu, 23 Aug 2012 11:05:07 -0700 Subject: [PATCH 0024/1975] Check for value error caused by no valid files found with files_changed This causes an infinite loop when in auto-reload Fix #467 Fix #451 Fix #443 --- pelican/utils.py | 12 ++++++++---- tests/test_utils.py | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index 53e6e52b..c79c7cee 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -241,10 +241,14 @@ def files_changed(path, extensions): yield os.stat(os.path.join(root, f)).st_mtime global LAST_MTIME - mtime = max(file_times(path)) - if mtime > LAST_MTIME: - LAST_MTIME = mtime - return True + try: + mtime = max(file_times(path)) + if mtime > LAST_MTIME: + LAST_MTIME = mtime + return True + except ValueError: + logger.info("No files found in path") + return False return False diff --git a/tests/test_utils.py b/tests/test_utils.py index 2ea756dc..7ea0cf23 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -74,7 +74,8 @@ class TestUtils(unittest.TestCase): self.assertNotIn(fr_article1, index) def test_files_changed(self): - "Test if file changes are correctly detected" + """Test if file changes are correctly detected + Make sure to handle not getting any files correctly""" path = os.path.join(os.path.dirname(__file__), 'content') filename = os.path.join(path, 'article_with_metadata.rst') @@ -90,6 +91,18 @@ class TestUtils(unittest.TestCase): self.assertEquals(changed, True) self.assertAlmostEqual(utils.LAST_MTIME, t, delta=1) + empty_path = os.path.join(os.path.dirname(__file__), 'empty') + try: + os.mkdir(empty_path) + os.mkdir(os.path.join(empty_path, "empty_folder")) + shutil.copy(__file__, empty_path) + changed = utils.files_changed(empty_path, 'rst') + self.assertFalse(changed) + except OSError: + self.fail("OSError Exception in test_files_changed test") + finally: + shutil.rmtree(empty_path, True) + def test_clean_output_dir(self): test_directory = os.path.join(os.path.dirname(__file__), 'clean_output') content = os.path.join(os.path.dirname(__file__), 'content') From a37ba369ef49ae1643a5b7602860c6be804cf8ad Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Thu, 23 Aug 2012 12:44:22 -0700 Subject: [PATCH 0025/1975] Implemented better "valid files not found" behavior. Used an exception so show error state. Used a bool flag to make sure the error is only shown once PER error. Updated tests to check for the correct Exception raised --- pelican/__init__.py | 9 ++++++++- pelican/utils.py | 6 ++++-- tests/test_utils.py | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index ba48c4c7..64e334d4 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -11,7 +11,7 @@ from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator, LessCSSGenerator) from pelican.log import init from pelican.settings import read_settings, _DEFAULT_CONFIG -from pelican.utils import clean_output_dir, files_changed, file_changed +from pelican.utils import clean_output_dir, files_changed, file_changed, NoFilesError from pelican.writers import Writer __major__ = 3 @@ -265,6 +265,7 @@ def main(): try: if args.autoreload: + files_found_error = True while True: try: # Check source dir for changed files ending with the given @@ -274,6 +275,8 @@ def main(): # have. if files_changed(pelican.path, pelican.markup) or \ files_changed(pelican.theme, ['']): + if files_found_error == False: + files_found_error = True pelican.run() # reload also if settings.py changed @@ -287,6 +290,10 @@ def main(): except KeyboardInterrupt: logger.warning("Keyboard interrupt, quitting.") break + except NoFilesError: + if files_found_error == True: + logger.warning("No valid files found in content. Nothing to generate.") + files_found_error = False except Exception, e: logger.warning( "Caught exception \"{}\". Reloading.".format(e) diff --git a/pelican/utils.py b/pelican/utils.py index c79c7cee..ca3015ce 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -14,6 +14,9 @@ from operator import attrgetter logger = logging.getLogger(__name__) +class NoFilesError(Exception): + pass + def get_date(string): """Return a datetime object from a string. @@ -247,8 +250,7 @@ def files_changed(path, extensions): LAST_MTIME = mtime return True except ValueError: - logger.info("No files found in path") - return False + raise NoFilesError("No files with the given extension(s) found.") return False diff --git a/tests/test_utils.py b/tests/test_utils.py index 7ea0cf23..0ebaf346 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -96,8 +96,8 @@ class TestUtils(unittest.TestCase): os.mkdir(empty_path) os.mkdir(os.path.join(empty_path, "empty_folder")) shutil.copy(__file__, empty_path) - changed = utils.files_changed(empty_path, 'rst') - self.assertFalse(changed) + with self.assertRaises(NoFilesError): + utils.files_changed(empty_path, 'rst') except OSError: self.fail("OSError Exception in test_files_changed test") finally: From 95af2e46ec95647a055a029bc81b531ecca86bb6 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Thu, 23 Aug 2012 13:13:41 -0700 Subject: [PATCH 0026/1975] Missed a line in commit. --- tests/test_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 0ebaf346..148e322a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,6 +6,7 @@ import time from pelican import utils from .support import get_article, unittest +from pelican.utils import NoFilesError class TestUtils(unittest.TestCase): From 831e1d04b98e872770af578bc3bedc84d42cd933 Mon Sep 17 00:00:00 2001 From: David Marble Date: Thu, 23 Aug 2012 18:31:45 -0700 Subject: [PATCH 0027/1975] docs: Pelican outputs to output/ not content/. Markdown ::: syntax must be indented --- docs/getting_started.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 282d6c23..b7cbe951 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -186,7 +186,7 @@ the content. The ``pelican`` command can also be run directly:: $ pelican /path/to/your/content/ [-s path/to/your/settings.py] -The above command will generate your weblog and save it in the ``content/`` +The above command will generate your weblog and save it in the ``output/`` folder, using the default theme to produce a simple site. The default theme is simple HTML without styling and is provided so folks may use it as a basis for creating their own themes. @@ -271,19 +271,21 @@ Pelican is able to provide colorized syntax highlighting for your code blocks. To do so, you have to use the following conventions (you need to put this in your content files). -For RestructuredText:: +For RestructuredText, use the code-block directive:: .. code-block:: identifier - your code goes here + -For Markdown, format your code blocks thusly:: +For Markdown, include the language identifier just above code blocks:: - :::identifier - your code goes here + :::identifier + + + (indent both the identifier and code) -The specified identifier should be one that appears on the -`list of available lexers `_. +The specified identifier (e.g. ``python``, ``ruby``) should be one that +appears on the `list of available lexers `_. Publishing drafts ----------------- From 9435b381ed042db13292d2fb474c400d0c595f91 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Fri, 24 Aug 2012 13:14:14 -0700 Subject: [PATCH 0028/1975] Cleaned up tests. Used assertItemsEqual in article generation to create more precise tests than with an elif chain Separated out categories out into their own named test for clarity Closes #405 --- tests/test_generators.py | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/test_generators.py b/tests/test_generators.py index e984b484..3a4ea1e3 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -63,29 +63,26 @@ class TestArticlesGenerator(unittest.TestCase): def test_generate_context(self): - settings = _DEFAULT_CONFIG.copy() - settings['ARTICLE_DIR'] = 'content' - settings['DEFAULT_CATEGORY'] = 'Default' - generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR, - _DEFAULT_CONFIG['THEME'], None, - _DEFAULT_CONFIG['MARKUP']) - generator.generate_context() - for article in generator.articles: - relfilepath = os.path.relpath(article.filename, CUR_DIR) - if relfilepath == os.path.join("TestCategory", - "article_with_category.rst"): - self.assertEquals(article.category.name, 'yeah') - elif relfilepath == os.path.join("TestCategory", - "article_without_category.rst"): - self.assertEquals(article.category.name, 'TestCategory') - elif relfilepath == "article_without_category.rst": - self.assertEquals(article.category.name, 'Default') + generator = self.get_populated_generator() + articles = self.distill_articles(generator.articles) + articles_expected = [ + [u'Article title', 'published', 'Default', 'article'], + [u'Article with template', 'published', 'Default', 'custom'], + [u'Test md File', 'published', 'test', 'article'], + [u'This is a super article !', 'published', 'Yeah', 'article'], + [u'This is an article with category !', 'published', 'yeah', 'article'], + [u'This is an article without category !', 'published', 'Default', 'article'], + [u'This is an article without category !', 'published', 'TestCategory', 'article'], + [u'This is a super article !', 'published', 'yeah', 'article'] + ] + self.assertItemsEqual(articles_expected, articles) + def test_generate_categories(self): + + generator = self.get_populated_generator() categories = [cat.name for cat, _ in generator.categories] - # assert that the categories are ordered as expected - self.assertEquals( - categories, ['Default', 'TestCategory', 'Yeah', 'test', - 'yeah']) + categories_expected = ['Default', 'TestCategory', 'Yeah', 'test', 'yeah'] + self.assertEquals(categories, categories_expected) def test_direct_templates_save_as_default(self): From d1d737777c97146037e7b0c32dc973fe93cd6dc1 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 25 Aug 2012 22:50:19 +0200 Subject: [PATCH 0029/1975] fix issue #480 --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index c219ed12..9ea6071d 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -468,7 +468,7 @@ template tag, for example: .. code-block:: jinja {% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %} - + {% endassets %} will produce a minified css file with the version identifier: From 472063e98c6a7e170c0cad34e2ef040ddc1b21e4 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 25 Aug 2012 23:16:50 +0200 Subject: [PATCH 0030/1975] add some doc for webassets: - usage of the sass compiler as discussed in PR #441 - debug mode and compilers (#481) --- docs/settings.rst | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 9ea6071d..ad08f020 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -73,7 +73,7 @@ Setting name (default value) What doe `SITENAME` (``'A Pelican Blog'``) Your site name `SITEURL` Base URL of your website. Not defined by default, so it is best to specify your SITEURL; if you do not, feeds - will not be generated with properly-formed URLs. You should + will not be generated with properly-formed URLs. You should include ``http://`` and your domain, with no trailing slash at the end. Example: ``SITEURL = 'http://mydomain.com'`` `STATIC_PATHS` (``['images']``) The static paths you want to have accessible @@ -95,12 +95,12 @@ Setting name (default value) What doe index pages for collections of content e.g. tags and category index pages. `PAGINATED_DIRECT_TEMPLATES` (``('index',)``) Provides the direct templates that should be paginated. -`SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will +`SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will be the default length in words of the text created. - This only applies if your content does not otherwise - specify a summary. Setting to None will cause the summary + This only applies if your content does not otherwise + specify a summary. Setting to None will cause the summary to be a copy of the original content. - + ===================================================================== ===================================================================== .. [#] Default is the system locale. @@ -367,7 +367,7 @@ Ordering content ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`NEWEST_FIRST_ARCHIVES` (``True``) Order archives by newest first by date. (False: +`NEWEST_FIRST_ARCHIVES` (``True``) Order archives by newest first by date. (False: orders by date with older articles first.) `REVERSE_CATEGORY_ORDER` (``False``) Reverse the category order. (True: lists by reverse alphabetical order; default lists alphabetically.) @@ -477,6 +477,15 @@ will produce a minified css file with the version identifier: +The filters can be combined, for example to use the `sass` compiler and minify +the output:: + +.. code-block:: jinja + +{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} + +{% endassets %} + Another example for javascript: .. code-block:: jinja @@ -491,6 +500,12 @@ will produce a minified and gzipped js file: +Pelican's debug mode is propagated to webassets to disable asset packaging, +and instead work with the uncompressed assets. However, this also means that +the `less` and `sass` files are not compiled, this should be fixed in a future +version of webassets (cf. the related `bug report +`_). + .. _webassets: https://github.com/miracle2k/webassets .. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html From 000210d875a9eab01f4133595311598de5634388 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 27 Aug 2012 13:09:25 -0700 Subject: [PATCH 0031/1975] Improve devserver durability. Refs #473. Three changes: 1. Fix inconsistent "pwd" behavior by using make's $(CURDIR) builtin. 2. Change bash shebang to the more-portable form. 3. Tell users when Pelican and SimpleHTTPServer have been backgrounded. --- pelican/tools/templates/Makefile.in | 2 +- pelican/tools/templates/develop_server.sh.in | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 1445f0b0..4c5a4fcb 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -1,7 +1,7 @@ PELICAN=$pelican PELICANOPTS=$pelicanopts -BASEDIR=$$(pwd) +BASEDIR=$$(CURDIR) INPUTDIR=$$(BASEDIR)/content OUTPUTDIR=$$(BASEDIR)/output CONFFILE=$$(BASEDIR)/pelicanconf.py diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in index b1e3b60c..3e97610b 100755 --- a/pelican/tools/templates/develop_server.sh.in +++ b/pelican/tools/templates/develop_server.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## # This section should match your Makefile ## @@ -65,6 +65,7 @@ function start_up(){ python -m SimpleHTTPServer & echo $$! > $$SRV_PID cd $$BASEDIR + sleep 1 && echo 'Pelican and SimpleHTTPServer processes now running in background.' } ### From bba3caa697313a26c632275a0b32fb99c8d0d90d Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 27 Aug 2012 18:40:02 +0200 Subject: [PATCH 0032/1975] avoid repeatition in the functional tests --- tests/test_pelican.py | 56 +++++++++++-------------------------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 15088ed0..78f083f9 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -35,6 +35,18 @@ class TestPelican(unittest.TestCase): rmtree(self.temp_path) locale.setlocale(locale.LC_ALL, self.old_locale) + def assertFilesEqual(self, diff): + msg = "some generated files differ from the expected functional " \ + "tests output.\n" \ + "This is probably because the HTML generated files " \ + "changed. If these changes are normal, please refer " \ + "to docs/contribute.rst to update the expected " \ + "output of the functional tests." + + self.assertEqual(diff.left_only, [], msg=msg) + self.assertEqual(diff.right_only, [], msg=msg) + self.assertEqual(diff.diff_files, [], msg=msg) + @unittest.skip("Test failing") def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default @@ -47,27 +59,7 @@ class TestPelican(unittest.TestCase): pelican.run() diff = dircmp( self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertEqual(diff.left_only, [], msg="some generated " \ - "files are absent from the expected functional " \ - "tests output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.right_only, [], msg="some files from " \ - "the expected functional tests output are absent " \ - "from the current output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.diff_files, [], msg="some generated " \ - "files differ from the expected functional tests " \ - "output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") + self.assertFilesEqual(diff) def test_custom_generation_works(self): # the same thing with a specified set of settings should work @@ -75,24 +67,4 @@ class TestPelican(unittest.TestCase): settings=read_settings(SAMPLE_CONFIG)) pelican.run() diff = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom"))) - self.assertEqual(diff.left_only, [], msg="some generated " \ - "files are absent from the expected functional " \ - "tests output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.right_only, [], msg="some files from " \ - "the expected functional tests output are absent " \ - "from the current output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") - self.assertEqual(diff.diff_files, [], msg="some generated " \ - "files differ from the expected functional tests " \ - "output.\n" \ - "This is probably because the HTML generated files " \ - "changed. If these changes are normal, please refer " \ - "to docs/contribute.rst to update the expected " \ - "output of the functional tests.") + self.assertFilesEqual(diff) From 0ec0cf9d0e822f25eee92910689a2763c377d8c2 Mon Sep 17 00:00:00 2001 From: Dirk Makowski Date: Tue, 28 Aug 2012 00:38:17 +0200 Subject: [PATCH 0033/1975] Patch to allow relative ASSET_URL Previously, webassets' ASSET_URL always was absolute. This patch allows a relative ASSET_URL, depending on Pelican's RELATIVE_URLS setting. Hint for templates: ------------------- Current version of webassets seem to remove any relative paths at the beginning of the URL. So, if RELATIVE_URLS is on, ASSET_URL will start with 'theme/', regardless if we set assets_url here to './theme/' or to 'theme/'. XXX However, this breaks the ASSET_URL if user navigates to a sub-URL, e.g. if he clicks on a category. To workaround this issue, I use instead of Maybe this hint is worth to be included in the documentation. I have it also written as comments in the source. --- pelican/generators.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index ae9334da..9876da3b 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -429,7 +429,23 @@ class StaticGenerator(Generator): # Define the assets environment that will be passed to the # generators. The StaticGenerator must then be run first to have # the assets in the output_path before generating the templates. - assets_url = self.settings['SITEURL'] + '/theme/' + + # Let ASSET_URL honor Pelican's RELATIVE_URLS setting. + # Hint for templates: + # Current version of webassets seem to remove any relative + # paths at the beginning of the URL. So, if RELATIVE_URLS + # is on, ASSET_URL will start with 'theme/', regardless if we + # set assets_url here to './theme/' or to 'theme/'. + # XXX However, this breaks the ASSET_URL if user navigates to + # a sub-URL, e.g. if he clicks on a category. To workaround this + # issue, I use + # + # instead of + # + if self.settings.get('RELATIVE_URLS'): + assets_url = './theme/' + else: + assets_url = self.settings['SITEURL'] + '/theme/' assets_src = os.path.join(self.output_path, 'theme') self.assets_env = AssetsEnvironment(assets_src, assets_url) From 644fd4ed5f95715d2207b146de9e0eafeee96f37 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Wed, 29 Aug 2012 12:17:59 -0700 Subject: [PATCH 0034/1975] Deep copy _DEFAULT_SETTINGS instead of linking. This caused the defaults to be overwritten and edge case bugs with tests. The test for empty setting needed to be updated to reflect that the method for setting up the local settings sets extra settings. --- pelican/__init__.py | 3 ++- pelican/contents.py | 3 ++- pelican/settings.py | 10 +++++----- tests/test_settings.py | 8 ++++++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index ba48c4c7..8c4930f9 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -1,3 +1,4 @@ +import copy import os import re import sys @@ -29,7 +30,7 @@ class Pelican(object): before doing anything else. """ if settings is None: - settings = _DEFAULT_CONFIG + settings = copy.deepcopy(_DEFAULT_CONFIG) self.path = path or settings['PATH'] if not self.path: diff --git a/pelican/contents.py b/pelican/contents.py index a5e3be8f..851607a5 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import copy import locale import logging import functools @@ -29,7 +30,7 @@ class Page(object): if not metadata: metadata = {} if not settings: - settings = _DEFAULT_CONFIG + settings = copy.deepcopy(_DEFAULT_CONFIG) self.settings = settings self._content = content diff --git a/pelican/settings.py b/pelican/settings.py index 645a9809..92c68ddc 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import copy import imp import inspect import os @@ -81,7 +82,7 @@ def read_settings(filename=None): if filename: local_settings = get_settings_from_file(filename) else: - local_settings = _DEFAULT_CONFIG + local_settings = copy.deepcopy(_DEFAULT_CONFIG) configured_settings = configure_settings(local_settings, None, filename) return configured_settings @@ -89,10 +90,9 @@ def read_settings(filename=None): def get_settings_from_module(module=None, default_settings=_DEFAULT_CONFIG): """ Load settings from a module, returning a dict. - """ - context = default_settings.copy() + context = copy.deepcopy(default_settings) if module is not None: context.update( (k, v) for k, v in inspect.getmembers(module) if k.isupper() @@ -114,7 +114,7 @@ def get_settings_from_file(filename, default_settings=_DEFAULT_CONFIG): def configure_settings(settings, default_settings=None, filename=None): """Provide optimizations, error checking, and warnings for loaded settings""" if default_settings is None: - default_settings = _DEFAULT_CONFIG + default_settings = copy.deepcopy(_DEFAULT_CONFIG) # Make the paths relative to the settings file if filename: @@ -138,7 +138,7 @@ def configure_settings(settings, default_settings=None, filename=None): for locale_ in locales: try: locale.setlocale(locale.LC_ALL, locale_) - break # break if it is successfull + break # break if it is successful except locale.Error: pass else: diff --git a/tests/test_settings.py b/tests/test_settings.py index 25df74bd..7b534616 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,6 +1,7 @@ +import copy from os.path import dirname, abspath, join -from pelican.settings import read_settings, configure_settings, _DEFAULT_CONFIG +from pelican.settings import read_settings, configure_settings, _DEFAULT_CONFIG, DEFAULT_THEME from .support import unittest @@ -31,7 +32,10 @@ class TestSettingsConfiguration(unittest.TestCase): def test_read_empty_settings(self): """providing no file should return the default values.""" settings = read_settings(None) - self.assertDictEqual(settings, _DEFAULT_CONFIG) + expected = copy.deepcopy(_DEFAULT_CONFIG) + expected["FEED_DOMAIN"] = '' #This is added by configure settings + self.maxDiff = None + self.assertDictEqual(settings, expected) def test_configure_settings(self): """Manipulations to settings should be applied correctly.""" From 663d1e7347116b46746c728278747658a4c36ea1 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Thu, 30 Aug 2012 14:50:52 -0700 Subject: [PATCH 0035/1975] Added extra tests to help prevent regression. --- tests/test_settings.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_settings.py b/tests/test_settings.py index 7b534616..873df824 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -37,6 +37,22 @@ class TestSettingsConfiguration(unittest.TestCase): self.maxDiff = None self.assertDictEqual(settings, expected) + def test_settings_return_independent(self): + """Make sure that the results from one settings call doesn't + effect past or future instances.""" + self.PATH = abspath(dirname(__file__)) + default_conf = join(self.PATH, 'default_conf.py') + settings = read_settings(default_conf) + settings['SITEURL'] = 'new-value' + new_settings = read_settings(default_conf) + self.assertNotEqual(new_settings['SITEURL'], settings['SITEURL']) + + def test_defaults_not_overwritten(self): + """This assumes 'SITENAME': 'A Pelican Blog'""" + settings = read_settings(None) + settings['SITENAME'] = 'Not a Pelican Blog' + self.assertNotEqual(settings['SITENAME'], _DEFAULT_CONFIG['SITENAME']) + def test_configure_settings(self): """Manipulations to settings should be applied correctly.""" From c1b0e83a44676d1a13aaf394f6279df2db06cc7f Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Fri, 31 Aug 2012 22:17:19 +0200 Subject: [PATCH 0036/1975] Added description for the finalized signal in the docs --- docs/plugins.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index bce17ddb..f95cb684 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -53,16 +53,16 @@ List of signals Here is the list of currently implemented signals: -========================= ============================ ========================================= +========================= ============================ =========================================================================== Signal Arguments Description -========================= ============================ ========================================= +========================= ============================ =========================================================================== initialized pelican object -finalized pelican object +finalized pelican object invoked after all the generators are executed and just before pelican exits article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ -========================= ============================ ========================================= +========================= ============================ =========================================================================== The list is currently small, don't hesitate to add signals and make a pull request if you need them! From b91197271694e101ec3faa90c01f7cfbff692aea Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Fri, 31 Aug 2012 23:12:09 -0400 Subject: [PATCH 0037/1975] Add Gittip to social icons. This allows someone to include their gittip link so people can donate to them. --- pelican/themes/notmyidea/static/css/main.css | 3 ++- .../notmyidea/static/images/icons/gittip.png | Bin 0 -> 671 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 pelican/themes/notmyidea/static/images/icons/gittip.png diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index bd1eba75..b4ba7888 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -308,7 +308,8 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} .social a[type$='atom+xml'], .social a[type$='rss+xml'] {background-image: url('../images/icons/rss.png');} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} - .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.org');} + .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');} + .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} /* About diff --git a/pelican/themes/notmyidea/static/images/icons/gittip.png b/pelican/themes/notmyidea/static/images/icons/gittip.png new file mode 100644 index 0000000000000000000000000000000000000000..bb12a1391ace96a9d4cedffebedd7db7d6a84d48 GIT binary patch literal 671 zcmV;Q0$}}#P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyq( z0|^AkZL;YA00JLLL_t(I%cYY)XcJ)=#((d3xhB;?Z4q3Q2+iPN8`Po0btyO{gS$f$ z>?&0%sHg=UtYR`L-82b;;35bKaWNLW7QsJgH?8zfG)VDJ#Ui$(&Fhf6cnLcB4F~sq z&+|Tazk5#bRx06;FS(?XPM@lt5s_ga>K!ksYDGjcxuW~t*8&JYI_Z!rx}*|LUW5@q z{j7>&K%=-!BSF%K72e^Ox7SrX27-KkiWRTI*7g_!Knd|3I zva$Zlm&dGlZ0}VOIjpL3?Dz?WjwZ3~E)ES2@nz)`k!{;KJ9(3EB*M;~UV3-$;ko++ zV~nb5IONe50Aoy(tO%+~dh8rO*Va(g)?QPio=k>~|EWZTnaAZ8ED<3Tve~h#r^P}< zn5jI%vO>NrYJ!Ao)kR)Cd+G&r&{yT-@&Yesr`z@ou;ky^b{A9EE>W*}wU8^i1L Date: Sun, 2 Sep 2012 09:26:58 +0200 Subject: [PATCH 0038/1975] fix encoding problem in Windows --- pelican/tools/pelican_quickstart.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index c8064bf1..8fe7b69e 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -4,6 +4,8 @@ import os import string import argparse +import sys +import codecs from pelican import __version__ @@ -29,6 +31,16 @@ CONF = { } +def decoding_maybe(f): + running_windows = (os.name == 'nt') + def wrapper(*args, **kwargs): + out = f(*args, **kwargs) + if isinstance(out, basestring) and running_windows: + return out.decode(sys.stdin.encoding) + return out + return wrapper + + def get_template(name): template = os.path.join(_TEMPLATES_DIR, "{0}.in".format(name)) @@ -43,6 +55,7 @@ def get_template(name): fd.close() +@decoding_maybe def ask(question, answer=str, default=None, l=None): if answer == str: r = '' @@ -167,7 +180,7 @@ Please answer the following questions so this script can generate the files need if ask('Do you want to upload your website using FTP?', answer=bool, default=False): CONF['ftp_host'] = ask('What is the hostname of your FTP server?', str, CONF['ftp_host']) CONF['ftp_user'] = ask('What is your username on that server?', str, CONF['ftp_user']) - CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) + CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) if ask('Do you want to upload your website using SSH?', answer=bool, default=False): CONF['ssh_host'] = ask('What is the hostname of your SSH server?', str, CONF['ssh_host']) CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) @@ -187,7 +200,7 @@ Please answer the following questions so this script can generate the files need print('Error: {0}'.format(e)) try: - with open(os.path.join(CONF['basedir'], 'pelicanconf.py'), 'w') as fd: + with codecs.open(os.path.join(CONF['basedir'], 'pelicanconf.py'), 'w', 'utf-8') as fd: for line in get_template('pelicanconf.py'): template = string.Template(line) fd.write(template.safe_substitute(CONF)) From 39db9ddcfde6199d7b89232d222b2b5a9c3e1e6b Mon Sep 17 00:00:00 2001 From: Florian Jacob Date: Sun, 2 Sep 2012 10:09:08 +0200 Subject: [PATCH 0039/1975] Get HtmlReader to work again wrote unit tests and documentation, improved regular expression. The HtmlReader is enabled by default now and parses metadata in html files of the form: --- docs/getting_started.rst | 11 +++++++ docs/settings.rst | 4 +-- pelican/readers.py | 31 +++++++++++++------ pelican/settings.py | 2 +- tests/content/article_with_html_metadata.html | 13 ++++++++ tests/test_generators.py | 3 +- tests/test_readers.py | 21 +++++++++++++ 7 files changed, 71 insertions(+), 14 deletions(-) create mode 100644 tests/content/article_with_html_metadata.html diff --git a/docs/getting_started.rst b/docs/getting_started.rst index b7cbe951..3f622dee 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -171,6 +171,17 @@ Markdown posts should follow this pattern:: This is the content of my super blog post. +Your third option is to write raw html (by ending your file in ``.html``):: + + + + + + +

+ This is the content of my super blog post. +

+ Note that, aside from the title, none of this metadata is mandatory: if the date is not specified, Pelican will rely on the file's "mtime" timestamp, and the category can be determined by the directory in which the file resides. For diff --git a/docs/settings.rst b/docs/settings.rst index ad08f020..340b2e92 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -50,9 +50,9 @@ Setting name (default value) What doe here or a single string representing one locale. When providing a list, all the locales will be tried until one works. -`MARKUP` (``('rst', 'md')``) A list of available markup languages you want +`MARKUP` (``('rst', 'md', 'html')``) A list of available markup languages you want to use. For the moment, the only available values - are `rst` and `md`. + are `rst`, `md` and `html`. `MD_EXTENSIONS` (``['codehilite','extra']``) A list of the extensions that the Markdown processor will use. Refer to the extensions chapter in the Python-Markdown documentation for a complete list of diff --git a/pelican/readers.py b/pelican/readers.py index e3ea154d..c9ae882a 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -142,19 +142,30 @@ class MarkdownReader(Reader): class HtmlReader(Reader): file_extensions = ['html', 'htm'] - _re = re.compile('\<\!\-\-\#\s?[A-z0-9_-]*\s?\:s?[A-z0-9\s_-]*\s?\-\-\>') + # re.DOTALL and .*? (minimal match of an arbitrary number of characters) + # allow multi-line metadata to be matched correctly + _re = re.compile('<\!--([^\:]*):(.*?)-->', re.DOTALL) def read(self, filename): - """Parse content and metadata of (x)HTML files""" - with open(filename) as content: - metadata = {'title': 'unnamed'} - for i in self._re.findall(content): - key = i.split(':')[0][5:].strip() - value = i.split(':')[-1][:-3].strip() - name = key.lower() - metadata[name] = self.process_metadata(name, value) + """Parse content and metadata of (x)HTML files. - return content, metadata + Matches for metadata tags in the form + Activated when you add 'html' to your MARKUP settings variable + + """ + content = open(filename) + metadata = {'title': 'unnamed'} + for comment in self._re.findall(content): + key = comment[0].strip().lower() + value = comment[1].strip() + + # remove identation from multi-line metadata + value = re.sub('[ \t]+', ' ', value) + value = re.sub(' ?\n ?', '\n', value) + + metadata[key] = self.process_metadata(key, value) + + return content, metadata _EXTENSIONS = {} diff --git a/pelican/settings.py b/pelican/settings.py index 92c68ddc..82caece7 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -21,7 +21,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'PAGE_EXCLUDES': (), 'THEME': DEFAULT_THEME, 'OUTPUT_PATH': 'output/', - 'MARKUP': ('rst', 'md'), + 'MARKUP': ('rst', 'md', 'html'), 'STATIC_PATHS': ['images', ], 'THEME_STATIC_PATHS': ['static', ], 'FEED_ATOM': 'feeds/all.atom.xml', diff --git a/tests/content/article_with_html_metadata.html b/tests/content/article_with_html_metadata.html new file mode 100644 index 00000000..89ef4789 --- /dev/null +++ b/tests/content/article_with_html_metadata.html @@ -0,0 +1,13 @@ + + + + + + + + +

This is an article in html with metadata

+

It features very interesting insights.

diff --git a/tests/test_generators.py b/tests/test_generators.py index 3a4ea1e3..3c86df92 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -73,7 +73,8 @@ class TestArticlesGenerator(unittest.TestCase): [u'This is an article with category !', 'published', 'yeah', 'article'], [u'This is an article without category !', 'published', 'Default', 'article'], [u'This is an article without category !', 'published', 'TestCategory', 'article'], - [u'This is a super article !', 'published', 'yeah', 'article'] + [u'This is a super article !', 'published', 'yeah', 'article'], + [u'A great html article with metadata', 'published', u'yeah', 'article'] ] self.assertItemsEqual(articles_expected, articles) diff --git a/tests/test_readers.py b/tests/test_readers.py index 299aa378..a9437eac 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -90,3 +90,24 @@ class MdReaderTest(unittest.TestCase): "

This is another markdown test file. Uses the mkd extension.

" self.assertEqual(content, expected) + + +class HtmlReaderTest(unittest.TestCase): + + def test_article_with_metadata(self): + reader = readers.HtmlReader({}) + content, metadata = reader.read(_filename('article_with_html_metadata.html')) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'A great html article with metadata', + 'summary': u'Multi-line metadata should be'\ + u' supported\nas well as inline'\ + u' markup.', + 'date': datetime.datetime(2010, 12, 2, 10, 14), + 'tags': ['foo', 'bar', 'foobar'], + 'custom_field': 'http://notmyidea.org', + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) From c02926e2adc6bad1930b919b37f40a4b9b86eee1 Mon Sep 17 00:00:00 2001 From: guillermooo Date: Sun, 2 Sep 2012 10:59:33 +0200 Subject: [PATCH 0040/1975] fix encoding issues in Linux --- pelican/tools/pelican_quickstart.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 8fe7b69e..388718ec 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -31,23 +31,23 @@ CONF = { } -def decoding_maybe(f): - running_windows = (os.name == 'nt') +def decoding_strings(f): def wrapper(*args, **kwargs): out = f(*args, **kwargs) - if isinstance(out, basestring) and running_windows: + if isinstance(out, basestring): + # todo: make encoding configurable? return out.decode(sys.stdin.encoding) return out return wrapper -def get_template(name): +def get_template(name, as_encoding='utf-8'): template = os.path.join(_TEMPLATES_DIR, "{0}.in".format(name)) if not os.path.isfile(template): raise RuntimeError("Cannot open {0}".format(template)) - with open(template, 'r') as fd: + with codecs.open(template, 'r', as_encoding) as fd: line = fd.readline() while line: yield line @@ -55,7 +55,7 @@ def get_template(name): fd.close() -@decoding_maybe +@decoding_strings def ask(question, answer=str, default=None, l=None): if answer == str: r = '' @@ -209,7 +209,7 @@ Please answer the following questions so this script can generate the files need print('Error: {0}'.format(e)) try: - with open(os.path.join(CONF['basedir'], 'publishconf.py'), 'w') as fd: + with codecs.open(os.path.join(CONF['basedir'], 'publishconf.py'), 'w', 'utf-8') as fd: for line in get_template('publishconf.py'): template = string.Template(line) fd.write(template.safe_substitute(CONF)) @@ -219,7 +219,7 @@ Please answer the following questions so this script can generate the files need if mkfile: try: - with open(os.path.join(CONF['basedir'], 'Makefile'), 'w') as fd: + with codecs.open(os.path.join(CONF['basedir'], 'Makefile'), 'w', 'utf-8') as fd: for line in get_template('Makefile'): template = string.Template(line) fd.write(template.safe_substitute(CONF)) @@ -229,7 +229,7 @@ Please answer the following questions so this script can generate the files need if develop: try: - with open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w') as fd: + with codecs.open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w', 'utf-8') as fd: for line in get_template('develop_server.sh'): template = string.Template(line) fd.write(template.safe_substitute(CONF)) From 229b0e4dcc50daa32ffaf48234f58d1e694ecb7a Mon Sep 17 00:00:00 2001 From: m-r-r Date: Tue, 21 Aug 2012 13:08:21 +0200 Subject: [PATCH 0041/1975] Sitemap plugin & `get_generators` signal This is a combination of 13 commits: 1. New signal for registering custom generators 2. New plugin: pelican.plugins.sitemap 3. pelican.plugins.sitemap: more settings 4. pelican.plugins.sitemap: translations are indexed 5. pelican.plugins.sitemap: added documentation 6. pelican.plugins.sitemap: added XML DTD & W3C dates 7. pelican.plugins.sitemap: removed a bug 8. the `get_generators` can now return a tuple 9. pelican.plugins.sitemap: cleaned the code 10. pelican.plugin.sitemap: settings changes 11. sitemap plugin: improved configuration & documentation 12. sitemap plugin: :set spell 13. sitemap plugin: removed useless whitespaces --- docs/plugins.rst | 79 ++++++++++++++ pelican/__init__.py | 14 ++- pelican/plugins/sitemap.py | 208 +++++++++++++++++++++++++++++++++++++ pelican/signals.py | 1 + 4 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 pelican/plugins/sitemap.py diff --git a/docs/plugins.rst b/docs/plugins.rst index 53858668..99c0429a 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -59,6 +59,9 @@ Signal Arguments Description initialized pelican object article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ +get_generators generators invoked in Pelican.get_generator_classes, + can return a Generator, or several + generator in a tuple or in a list. pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ ========================= ============================ ========================================= @@ -108,3 +111,79 @@ variable, as in the example:: ``github_activity`` is a list of lists. The first element is the title and the second element is the raw HTML from GitHub. + + +Sitemap +------- + +The plugin generates a sitemap of the blog. +It can generates plain text sitemaps or XML sitemaps. + +Configuration +""""""""""""" + +You can use the setting ``SITEMAP`` variable to configure the behavior of the +plugin. + +The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys: + + +- ``format``, which set the output format of the plugin (``xml`` or ``txt``) + +- ``priorities``, which is a dictionary with three keys: + + - ``articles``, the priority for the URLs of the articles and their + translations + + - ``pages``, the priority for the URLs of the static pages + + - ``indexes``, the priority for the URLs of the index pages, such as tags, + author pages, categories indexes, archives, etc... + + All the values of this dictionary must be decimal numbers between ``0`` and ``1``. + +- ``changefreqs``, which is a dictionary with three items: + + - ``articles``, the update frequency of the articles + + - ``pages``, the update frequency of the pages + + - ``indexes``, the update frequency of the index pages + + An valid value is ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``, + ``yearly`` or ``never``. + + +If a key is missing or a value is incorrect, it will be replaced with the +default value. + +The sitemap is saved in ``/sitemap.``. + +.. note:: + ``priorities`` and ``changefreqs`` are informations for search engines. + They are only used in the XML sitemaps. + For more information: + + +Example +""""""" + +Here is an example of configuration (it's also the default settings): + +.. code-block:: python + + PLUGINS=['pelican.plugins.sitemap',] + + SITEMAP = { + 'format': 'xml', + 'priorities': { + 'articles': 0.5, + 'indexes': 0.5, + 'pages': 0.5 + }, + 'changefreqs': { + 'articles': 'monthly', + 'indexes': 'daily', + 'pages': 'monthly' + } + } diff --git a/pelican/__init__.py b/pelican/__init__.py index a69752d8..b9f9bb22 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -8,7 +8,7 @@ import argparse from pelican import signals -from pelican.generators import (ArticlesGenerator, PagesGenerator, +from pelican.generators import (Generator, ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator, LessCSSGenerator) from pelican.log import init from pelican.settings import read_settings, _DEFAULT_CONFIG @@ -185,6 +185,18 @@ class Pelican(object): generators.append(PdfGenerator) if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc generators.append(LessCSSGenerator) + + for pair in signals.get_generators.send(self): + (funct, value) = pair + + if not isinstance(value, (tuple, list)): + value = (value, ) + + for v in value: + if isinstance(v, type): + logger.debug('Found generator: {0}'.format(v)) + generators.append(v) + return generators def get_writer(self): diff --git a/pelican/plugins/sitemap.py b/pelican/plugins/sitemap.py new file mode 100644 index 00000000..6402ba9c --- /dev/null +++ b/pelican/plugins/sitemap.py @@ -0,0 +1,208 @@ +import os.path + +from datetime import datetime +from logging import debug, warning, error, info +from codecs import open + +from pelican import signals, contents + +TXT_HEADER = u"""{0}/index.html +{0}/archives.html +{0}/tags.html +{0}/categories.html +""" + +XML_HEADER = u""" + + + + {0}/index.html + {1} + {2} + {3} + + + + {0}/archives.html + {1} + {2} + {3} + + + + {0}/tags.html + {1} + {2} + {3} + + + + {0}/categories.html + {1} + {2} + {3} + +""" + +XML_URL = u""" + + {0}/{1} + {2} + {3} + {4} + +""" + +XML_FOOTER = u""" + +""" + + +def format_date(date): + if date.tzinfo: + tz = date.strftime('%s') + tz = tz[:-2] + ':' + tz[-2:] + else: + tz = "-00:00" + return date.strftime("%Y-%m-%dT%H:%M:%S") + tz + + + +class SitemapGenerator(object): + + def __init__(self, context, settings, path, theme, output_path, *null): + + self.output_path = output_path + self.context = context + self.now = datetime.now() + self.siteurl = settings.get('SITEURL') + + self.format = 'xml' + + self.changefreqs = { + 'articles': 'monthly', + 'indexes': 'daily', + 'pages': 'monthly' + } + + self.priorities = { + 'articles': 0.5, + 'indexes': 0.5, + 'pages': 0.5 + } + + config = settings.get('SITEMAP', {}) + + if not isinstance(config, dict): + warning("sitemap plugin: the SITEMAP setting must be a dict") + else: + fmt = config.get('format') + pris = config.get('priorities') + chfreqs = config.get('changefreqs') + + if fmt not in ('xml', 'txt'): + warning("sitemap plugin: SITEMAP['format'] must be `txt' or `xml'") + warning("sitemap plugin: Setting SITEMAP['format'] on `xml'") + elif fmt == 'txt': + self.format = fmt + return + + valid_keys = ('articles', 'indexes', 'pages') + valid_chfreqs = ('always', 'hourly', 'daily', 'weekly', 'monthly', + 'yearly', 'never') + + if isinstance(pris, dict): + for k, v in pris.iteritems(): + if k in valid_keys and not isinstance(v, (int, float)): + default = self.priorities[k] + warning("sitemap plugin: priorities must be numbers") + warning("sitemap plugin: setting SITEMAP['priorities']" + "['{0}'] on {1}".format(k, default)) + pris[k] = default + self.priorities.update(pris) + elif pris is not None: + warning("sitemap plugin: SITEMAP['priorities'] must be a dict") + warning("sitemap plugin: using the default values") + + if isinstance(chfreqs, dict): + for k, v in chfreqs.iteritems(): + if k in valid_keys and v not in valid_chfreqs: + default = self.changefreqs[k] + warning("sitemap plugin: invalid changefreq `{0}'".format(v)) + warning("sitemap plugin: setting SITEMAP['changefreqs']" + "['{0}'] on '{1}'".format(k, default)) + chfreqs[k] = default + self.changefreqs.update(chfreqs) + elif chfreqs is not None: + warning("sitemap plugin: SITEMAP['changefreqs'] must be a dict") + warning("sitemap plugin: using the default values") + + + + def write_url(self, page, fd): + + if getattr(page, 'status', 'published') != 'published': + return + + lastmod = format_date(getattr(page, 'date', self.now)) + + if isinstance(page, contents.Article): + pri = self.priorities['articles'] + chfreq = self.changefreqs['articles'] + elif isinstance(page, contents.Page): + pri = self.priorities['pages'] + chfreq = self.changefreqs['pages'] + else: + pri = self.priorities['indexes'] + chfreq = self.changefreqs['indexes'] + + + if self.format == 'xml': + fd.write(XML_URL.format(self.siteurl, page.url, lastmod, chfreq, pri)) + else: + fd.write(self.siteurl + '/' + loc + '\n') + + + def generate_output(self, writer): + path = os.path.join(self.output_path, 'sitemap.{0}'.format(self.format)) + + pages = self.context['pages'] + self.context['articles'] \ + + [ c for (c, a) in self.context['categories']] \ + + [ t for (t, a) in self.context['tags']] \ + + [ a for (a, b) in self.context['authors']] + + for article in self.context['articles']: + pages += article.translations + + + info('writing {0}'.format(path)) + + with open(path, 'w', encoding='utf-8') as fd: + + if self.format == 'xml': + fd.write(XML_HEADER.format( + self.siteurl, + format_date(self.now), + self.changefreqs['indexes'], + self.priorities['indexes'] + ) + ) + else: + fd.write(TXT_HEADER.format(self.siteurl)) + + for page in pages: + self.write_url(page, fd) + + if self.format == 'xml': + fd.write(XML_FOOTER) + + + +def get_generators(generators): + return SitemapGenerator + + +def register(): + signals.get_generators.connect(get_generators) diff --git a/pelican/signals.py b/pelican/signals.py index 4d9ab512..7ee88a0a 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -3,5 +3,6 @@ from blinker import signal initialized = signal('pelican_initialized') article_generate_context = signal('article_generate_context') article_generator_init = signal('article_generator_init') +get_generators = signal('get_generators') pages_generate_context = signal('pages_generate_context') pages_generator_init = signal('pages_generator_init') From 6100773c2476e333f739674910caf48da001abef Mon Sep 17 00:00:00 2001 From: Rachid Belaid Date: Sun, 2 Sep 2012 19:20:42 +0100 Subject: [PATCH 0042/1975] Add a new signal content_object_init It's sent when a new content object is created: Page, Article --- docs/plugins.rst | 33 +++++++++++++++++++++++++++------ pelican/contents.py | 4 +++- pelican/signals.py | 1 + 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 53858668..c65fc79e 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -48,24 +48,45 @@ which you map the signals to your plugin logic. Let's take a simple example:: signals.initialized.connect(test) + List of signals =============== Here is the list of currently implemented signals: -========================= ============================ ========================================= -Signal Arguments Description -========================= ============================ ========================================= +========================= ======================================= ========================================= +Signal Arguments Description +========================= ======================================= ========================================= initialized pelican object article_generate_context article_generator, metadata -article_generator_init article_generator invoked in the ArticlesGenerator.__init__ +article_generator_init article_generator invoked in the ArticlesGenerator.__init__ pages_generate_context pages_generator, metadata -pages_generator_init pages_generator invoked in the PagesGenerator.__init__ -========================= ============================ ========================================= +pages_generator_init pages_generator invoked in the PagesGenerator.__init__ +content_object_init Content class (Page, Article), instance +========================= ======================================= ========================================= The list is currently small, don't hesitate to add signals and make a pull request if you need them! +.. note:: + + The signal ``content_object_init`` can send different type of object as + argument. If you want to register only one type of object then you will + need to specify the sender when you are connecting to the signal. + + :: + + from pelican import signals + from pelican import contents + + def test(sender, instance): + print "%s : %s content initialized !!" % (sender, instance) + + def register(): + signals.content_object_init.connect(test, sender=contents.Article) + + + List of plugins =============== diff --git a/pelican/contents.py b/pelican/contents.py index 851607a5..b5701732 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -11,7 +11,7 @@ from sys import platform, stdin from pelican.settings import _DEFAULT_CONFIG from pelican.utils import slugify, truncate_html_words - +from pelican import signals logger = logging.getLogger(__name__) @@ -106,6 +106,8 @@ class Page(object): if 'summary' in metadata: self._summary = metadata['summary'] + signals.content_object_init.send(self.__class__, instance=self) + def check_properties(self): """test that each mandatory property is set.""" for prop in self.mandatory_properties: diff --git a/pelican/signals.py b/pelican/signals.py index 4d9ab512..17b4b7e6 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -5,3 +5,4 @@ article_generate_context = signal('article_generate_context') article_generator_init = signal('article_generator_init') pages_generate_context = signal('pages_generate_context') pages_generator_init = signal('pages_generator_init') +content_object_init = signal('content_object_init') From dcb50a20b230871a8538ca37f52b602917ce7fbe Mon Sep 17 00:00:00 2001 From: Rachid Belaid Date: Sun, 2 Sep 2012 19:55:31 +0100 Subject: [PATCH 0043/1975] Add test for the new signal --- tests/test_contents.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_contents.py b/tests/test_contents.py index bc028ea8..6b0f93ea 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -5,7 +5,7 @@ from .support import unittest from pelican.contents import Page, Article from pelican.settings import _DEFAULT_CONFIG from pelican.utils import truncate_html_words - +from pelican.signals import content_object_init from jinja2.utils import generate_lorem_ipsum # generate one paragraph, enclosed with

@@ -158,6 +158,17 @@ class TestPage(unittest.TestCase): return page_kwargs + def test_signal(self): + """If a title is given, it should be used to generate the slug.""" + + def receiver_test_function(sender,instance): + pass + + content_object_init.connect(receiver_test_function ,sender=Page) + page = Page(**self.page_kwargs) + self.assertTrue(content_object_init.has_receivers_for(Page)) + + class TestArticle(TestPage): def test_template(self): """ From c462237b9d2f937cec96745b98728f85cbf92b37 Mon Sep 17 00:00:00 2001 From: Rachid Belaid Date: Mon, 3 Sep 2012 00:57:23 +0100 Subject: [PATCH 0044/1975] Add new setting EXTRA_TEMPLATES_PATHS This setting allow to use template which are not in the theme. Should help to build more generic themes around the content. --- docs/settings.rst | 4 ++++ pelican/generators.py | 7 +++++-- pelican/settings.py | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index ad08f020..2f5027b9 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -100,6 +100,10 @@ Setting name (default value) What doe This only applies if your content does not otherwise specify a summary. Setting to None will cause the summary to be a copy of the original content. +`EXTRA_TEMPLATES_PATHS` (``[]``) A list of paths you want Jinja2 to look for the templates. + Can be used to separate templates from the theme. + Example: projects, resume, profile ... + This templates need to use ``DIRECT_TEMPLATES`` setting ===================================================================== ===================================================================== diff --git a/pelican/generators.py b/pelican/generators.py index ae9334da..de10a126 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -36,8 +36,11 @@ class Generator(object): # templates cache self._templates = {} - self._templates_path = os.path.expanduser( - os.path.join(self.theme, 'templates')) + self._templates_path = [] + self._templates_path.append(os.path.expanduser( + os.path.join(self.theme, 'templates'))) + self._templates_path += self.settings.get('EXTRA_TEMPLATES_PATHS', []) + theme_path = os.path.dirname(os.path.abspath(__file__)) diff --git a/pelican/settings.py b/pelican/settings.py index 92c68ddc..c1ebe9b6 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -58,6 +58,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'TAG_CLOUD_STEPS': 4, 'TAG_CLOUD_MAX_ITEMS': 100, 'DIRECT_TEMPLATES': ('index', 'tags', 'categories', 'archives'), + 'EXTRA_TEMPLATES_PATHS' : [], 'PAGINATED_DIRECT_TEMPLATES': ('index', ), 'PELICAN_CLASS': 'pelican.Pelican', 'DEFAULT_DATE_FORMAT': '%a %d %B %Y', From 566530ca188923fdd65a259bf12f38a78527165e Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sun, 2 Sep 2012 15:18:46 -0700 Subject: [PATCH 0045/1975] Add the unit2 tests to tox Remove unnecessary dependencies These dependencies are installed when tox runs setup.py --- tox.ini | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index a7dc9ec6..4a0e148c 100644 --- a/tox.ini +++ b/tox.ini @@ -2,13 +2,11 @@ envlist = py26,py27 [testenv] -commands = nosetests -s tests +commands = + nosetests -s tests + unit2 discover [] deps = nose - Jinja2 - Pygments - docutils - feedgenerator unittest2 mock Markdown From 77a538e588e13edbb3ea701a82abfb3f61478205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20L=C3=83=C2=B3pez?= Date: Tue, 4 Sep 2012 00:29:02 +0200 Subject: [PATCH 0046/1975] always return Unix-like relative paths, even on Windows --- pelican/writers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pelican/writers.py b/pelican/writers.py index 75971ee9..bac06bc5 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -202,6 +202,10 @@ class Writer(object): os.sep.join((get_relative_path(name), "static", relative_path))) + # On Windows, make sure we end up with Unix-like paths. + if os.name == 'nt': + dest_path = dest_path.replace('\\', '/') + return m.group('markup') + m.group('quote') + dest_path \ + m.group('quote') From 41fdfa63b11957c564e42fb128dc1f89873c41a4 Mon Sep 17 00:00:00 2001 From: Trae Blain Date: Sat, 23 Jun 2012 16:39:02 -0500 Subject: [PATCH 0047/1975] Fixed page_name call to adapt to the link structure provided by the Settings file. Also updated the documentation accordingly. Update documentation to cover new page_name behavior Fixed page_name to adapt to the links provided by the Settings file. Includes documentation updates as well. Updated terms to maintain better syntax and consistancy Added docstring to _from_settings() to clarify the get_page_name argument that was added. Explains why/when this argument is used. Revert contents.py back to commit 2f29c51 Re-added docstring to _get_settings method, but this time not deleting things I shouldn't Corrected readability change that was altered during revert. --- docs/settings.rst | 12 ++++++------ docs/themes.rst | 23 ++++++++++++----------- pelican/contents.py | 12 ++++++++++-- pelican/generators.py | 6 +++--- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 65561d5d..5eb97edd 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -152,12 +152,12 @@ Setting name (default value) what does it do? use the default language. `PAGE_LANG_SAVE_AS` ('pages/{slug}-{lang}.html') The location we will save the page which doesn't use the default language. -`AUTHOR_URL` ('author/{name}.html') The URL to use for an author. -`AUTHOR_SAVE_AS` ('author/{name}.html') The location to save an author. -`CATEGORY_URL` ('category/{name}.html') The URL to use for a category. -`CATEGORY_SAVE_AS` ('category/{name}.html') The location to save a category. -`TAG_URL` ('tag/{name}.html') The URL to use for a tag. -`TAG_SAVE_AS` ('tag/{name}.html') The location to save the tag page. +`AUTHOR_URL` ('author/{slug}.html') The URL to use for an author. +`AUTHOR_SAVE_AS` ('author/{slug}.html') The location to save an author. +`CATEGORY_URL` ('category/{slug}.html') The URL to use for a category. +`CATEGORY_SAVE_AS` ('category/{slug}.html') The location to save a category. +`TAG_URL` ('tag/{slug}.html') The URL to use for a tag. +`TAG_SAVE_AS` ('tag/{slug}.html') The location to save the tag page. `_SAVE_AS` The location to save content generated from direct templates. Where is the upper case template name. diff --git a/docs/themes.rst b/docs/themes.rst index e0583882..7b251dc1 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -93,8 +93,8 @@ author.html This template will be processed for each of the existing authors, with output generated at output/author/`author_name`.html. -If pagination is active, subsequent pages will reside at -output/author/`author_name``n`.html. +If pagination is active, subsequent pages will reside as defined by setting +AUTHOR_SAVE_AS (`Default:` output/author/`author_name'n'`.html). =================== =================================================== Variable Description @@ -109,8 +109,8 @@ dates_paginator A paginator object for the article list, ordered by date, ascending. dates_page The current page of articles, ordered by date, ascending. -page_name 'author/`author_name`' -- useful for pagination - links +page_name AUTHOR_URL where everything after `{slug}` is + removed -- useful for pagination links =================== =================================================== category.html @@ -119,8 +119,8 @@ category.html This template will be processed for each of the existing categories, with output generated at output/category/`category_name`.html. -If pagination is active, subsequent pages will reside at -output/category/`category_name``n`.html. +If pagination is active, subsequent pages will reside as defined by setting +CATEGORY_SAVE_AS (`Default:` output/category/`category_name'n'`.html). =================== =================================================== Variable Description @@ -135,8 +135,8 @@ dates_paginator A paginator object for the list of articles, ordered by date, ascending dates_page The current page of articles, ordered by date, ascending -page_name 'category/`category_name`' -- useful for pagination - links +page_name CATEGORY_URL where everything after `{slug}` is + removed -- useful for pagination links =================== =================================================== article.html @@ -171,8 +171,8 @@ tag.html This template will be processed for each tag, with corresponding .html files saved as output/tag/`tag_name`.html. -If pagination is active, subsequent pages will reside at -output/tag/`tag_name``n`.html. +If pagination is active, subsequent pages will reside as defined in setting +TAG_SAVE_AS (`Default:` output/tag/`tag_name'n'`.html). =================== =================================================== Variable Description @@ -187,7 +187,8 @@ dates_paginator A paginator object for the list of articles, ordered by date, ascending dates_page The current page of articles, ordered by date, ascending -page_name 'tag/`tag_name`' -- useful for pagination links +page_name TAG_URL where everything after `{slug}` is removed + -- useful for pagination links =================== =================================================== Inheritance diff --git a/pelican/contents.py b/pelican/contents.py index b8bb0993..ad08d468 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -183,15 +183,23 @@ class URLWrapper(object): def __unicode__(self): return self.name - def _from_settings(self, key): + def _from_settings(self, key, get_page_name=False): + """Returns URL information as defined in settings. + When get_page_name=True returns URL without anything after {slug} + e.g. if in settings: CATEGORY_URL="cat/{slug}.html" this returns "cat/{slug}" + Useful for pagination.""" setting = "%s_%s" % (self.__class__.__name__.upper(), key) value = self.settings[setting] if not isinstance(value, basestring): logger.warning(u'%s is set to %s' % (setting, value)) return value else: - return unicode(value).format(**self.as_dict()) + if get_page_name: + return unicode(value[:value.find('{slug}') + len('{slug}')]).format(**self.as_dict()) + else: + return unicode(value).format(**self.as_dict()) + page_name = property(functools.partial(_from_settings, key='URL', get_page_name=True)) url = property(functools.partial(_from_settings, key='URL')) save_as = property(functools.partial(_from_settings, key='SAVE_AS')) diff --git a/pelican/generators.py b/pelican/generators.py index 1ddc13c2..be88d2b2 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -198,7 +198,7 @@ class ArticlesGenerator(Generator): write(tag.save_as, tag_template, self.context, tag=tag, articles=articles, dates=dates, paginated={'articles': articles, 'dates': dates}, - page_name=u'tag/%s' % tag) + page_name=tag.page_name) def generate_categories(self, write): """Generate category pages.""" @@ -208,7 +208,7 @@ class ArticlesGenerator(Generator): write(cat.save_as, category_template, self.context, category=cat, articles=articles, dates=dates, paginated={'articles': articles, 'dates': dates}, - page_name=u'category/%s' % cat) + page_name=cat.page_name) def generate_authors(self, write): """Generate Author pages.""" @@ -218,7 +218,7 @@ class ArticlesGenerator(Generator): write(aut.save_as, author_template, self.context, author=aut, articles=articles, dates=dates, paginated={'articles': articles, 'dates': dates}, - page_name=u'author/%s' % aut) + page_name=aut.page_name) def generate_drafts(self, write): """Generate drafts pages.""" From 2c85fb0d19906cd4a9f4cc19b67eff10b7a5e206 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Tue, 4 Sep 2012 15:17:59 -0700 Subject: [PATCH 0048/1975] Clean up Dev Requirements and add typogrify & webassets typogrify & webassets are optional packages for usage but should be included for testing by developers and CI dev_requirements also had packages that setup.py covers already. Added comments for redundancy --- dev_requirements.txt | 10 ++++------ tox.ini | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index ec3245d1..acf01773 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,10 +1,8 @@ -Jinja2>=2.4 -Pygments -docutils -feedgenerator +# Tests unittest2 -pytz mock +# Optional Packages Markdown -blinker BeautifulSoup +typogrify +webassets \ No newline at end of file diff --git a/tox.ini b/tox.ini index 4a0e148c..f7d9cf82 100644 --- a/tox.ini +++ b/tox.ini @@ -11,3 +11,5 @@ deps = mock Markdown BeautifulSoup + typogrify + webassets From ff3c12fd711f3dc75b67f910a8c0900510709ea0 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Fri, 7 Sep 2012 08:56:33 +0200 Subject: [PATCH 0049/1975] Added possible uses for the finalized signal to the docs --- docs/plugins.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index a90d077e..36e89f3d 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -58,6 +58,9 @@ Signal Arguments Description ========================= ============================ =========================================================================== initialized pelican object finalized pelican object invoked after all the generators are executed and just before pelican exits + usefull for custom post processing actions, such as: + - minifying js/css assets. + - notify/ping search engines with an updated sitemap. article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ get_generators generators invoked in Pelican.get_generator_classes, From 0c2625e59d0059d502a6761facd8fbb6e9beff76 Mon Sep 17 00:00:00 2001 From: Wladislaw Merezhko Date: Sat, 8 Sep 2012 13:07:51 +0300 Subject: [PATCH 0050/1975] Change name of utils.open function to pelican_open and refactor this change across project. --- pelican/readers.py | 6 +++--- pelican/utils.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index e3ea154d..30038f7a 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -16,7 +16,7 @@ except ImportError: import re from pelican.contents import Category, Tag, Author -from pelican.utils import get_date, open +from pelican.utils import get_date, pelican_open _METADATA_PROCESSORS = { @@ -129,7 +129,7 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - text = open(filename) + text = pelican_open(filename) md = Markdown(extensions=set(self.extensions + ['meta'])) content = md.convert(text) @@ -146,7 +146,7 @@ class HtmlReader(Reader): def read(self, filename): """Parse content and metadata of (x)HTML files""" - with open(filename) as content: + with pelican_open(filename) as content: metadata = {'title': 'unnamed'} for i in self._re.findall(content): key = i.split(':')[0][5:].strip() diff --git a/pelican/utils.py b/pelican/utils.py index ca3015ce..60ecee34 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -6,7 +6,7 @@ import shutil import logging from collections import defaultdict -from codecs import open as _open +from codecs import open from datetime import datetime from itertools import groupby from jinja2 import Markup @@ -14,6 +14,7 @@ from operator import attrgetter logger = logging.getLogger(__name__) + class NoFilesError(Exception): pass @@ -37,9 +38,9 @@ def get_date(string): raise ValueError("'%s' is not a valid date" % string) -def open(filename): +def pelican_open(filename): """Open a file and return it's content""" - return _open(filename, encoding='utf-8').read() + return open(filename, encoding='utf-8').read() def slugify(value): From 8b44fa6a2dedec57ad48f791c3474cc59cd39bff Mon Sep 17 00:00:00 2001 From: Wladislaw Merezhko Date: Sat, 8 Sep 2012 18:24:15 +0300 Subject: [PATCH 0051/1975] Add two new parameters for creating pdf * PDF_STYLE - name of custom style to use when generating pdf * PDF_STYLE_PATH - path where custom style is located --- pelican/generators.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index a1901889..71039517 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -189,7 +189,7 @@ class ArticlesGenerator(Generator): save_as = self.settings.get("%s_SAVE_AS" % template.upper(), '%s.html' % template) if not save_as: - continue + continue write(save_as, self.get_template(template), self.context, blog=True, paginated=paginated, @@ -454,13 +454,20 @@ class PdfGenerator(Generator): """Generate PDFs on the output dir, for all articles and pages coming from rst""" def __init__(self, *args, **kwargs): + super(PdfGenerator, self).__init__(*args, **kwargs) try: from rst2pdf.createpdf import RstToPdf + pdf_style_path = os.path.join(self.settings['PDF_STYLE_PATH']) \ + if 'PDF_STYLE_PATH' in self.settings.keys() \ + else '' + pdf_style = self.settings['PDF_STYLE'] if 'PDF_STYLE' \ + in self.settings.keys() \ + else 'twelvepoint' self.pdfcreator = RstToPdf(breakside=0, - stylesheets=['twelvepoint']) + stylesheets=[pdf_style], + style_path=[pdf_style_path]) except ImportError: raise Exception("unable to find rst2pdf") - super(PdfGenerator, self).__init__(*args, **kwargs) def _create_pdf(self, obj, output_path): if obj.filename.endswith(".rst"): From 1da88a647ada62d07c285c5c8c0fc577d6abc427 Mon Sep 17 00:00:00 2001 From: epatters Date: Sat, 8 Sep 2012 21:39:10 -0700 Subject: [PATCH 0052/1975] BUG: Typogrify not applied to pages. --- pelican/generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index ae9334da..94edb3b2 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -378,7 +378,7 @@ class PagesGenerator(Generator): os.path.join(self.path, self.settings['PAGE_DIR']), exclude=self.settings['PAGE_EXCLUDES']): try: - content, metadata = read_file(f) + content, metadata = read_file(f, settings=self.settings) except Exception, e: logger.warning(u'Could not process %s\n%s' % (f, str(e))) continue From 3054e71f5b137522dfc2ffd5d96762c32daac0e6 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 10 Sep 2012 20:48:13 -0700 Subject: [PATCH 0053/1975] Minor doc changes, including those for webassets --- docs/getting_started.rst | 15 ++++++------ docs/settings.rst | 53 ++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index b7cbe951..985718b5 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -17,7 +17,7 @@ While the above is the simplest method, the recommended approach is to create a virtual environment for Pelican via virtualenv_ and virtualenvwrapper_ before installing Pelican. Assuming you've followed the virtualenvwrapper `installation `_ -and `shell configuration +and `shell configuration `_ steps, you can then open a new terminal session and create a new virtual environment for Pelican:: @@ -26,7 +26,7 @@ environment for Pelican:: Once the virtual environment has been created and activated, Pelican can be be installed via ``pip`` or ``easy_install`` as noted above. Alternatively, if -you have the project source, you can install Pelican using the distutils +you have the project source, you can install Pelican using the distutils method:: $ cd path-to-Pelican-source @@ -209,7 +209,7 @@ Pages If you create a folder named ``pages``, all the files in it will be used to generate static pages. -Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to +Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to the menu. If you want to exclude any pages from being linked to or listed in the menu @@ -219,7 +219,7 @@ things like making error pages that fit the generated theme of your site. Importing an existing blog -------------------------- -It is possible to import your blog from Dotclear, WordPress, and RSS feeds using +It is possible to import your blog from Dotclear, WordPress, and RSS feeds using a simple script. See :ref:`import`. Translations @@ -277,14 +277,13 @@ For RestructuredText, use the code-block directive:: -For Markdown, include the language identifier just above code blocks:: +For Markdown, include the language identifier just above the code block, +indenting both the identifier and code:: :::identifier - - (indent both the identifier and code) -The specified identifier (e.g. ``python``, ``ruby``) should be one that +The specified identifier (e.g. ``python``, ``ruby``) should be one that appears on the `list of available lexers `_. Publishing drafts diff --git a/docs/settings.rst b/docs/settings.rst index ad08f020..0dd7f07b 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -444,26 +444,27 @@ adding the following to your configuration:: Asset management ---------------- -The `WEBASSETS` setting allows to use the `webassets`_ module to manage assets -(css, js). The module must first be installed:: +The `WEBASSETS` setting allows you to use the `webassets`_ module to manage +assets such as CSS and JS files. The module must first be installed:: pip install webassets -`webassets` allows to concatenate your assets and to use almost all of the -hype tools of the moment (see the `documentation`_): +The `webassets` module allows you to perform a number of useful asset management +functions, including: -* css minifier (`cssmin`, `yuicompressor`, ...) -* css compiler (`less`, `sass`, ...) -* js minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) +* CSS minifier (`cssmin`, `yuicompressor`, ...) +* CSS compiler (`less`, `sass`, ...) +* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) -Others filters include gzip compression, integration of images in css with -`datauri` and more. Webassets also append a version identifier to your asset -url to convince browsers to download new versions of your assets when you use -far future expires headers. +Others filters include gzip compression, integration of images in CSS via data +URIs, and more. `webassets` can also append a version identifier to your asset +URL to convince browsers to download new versions of your assets when you use +far-future expires headers. Please refer to the `webassets documentation`_ for +more information. -When using it with Pelican, `webassets` is configured to process assets in the -``OUTPUT_PATH/theme`` directory. You can use it in your templates with a -template tag, for example: +When using with Pelican, `webassets` is configured to process assets in the +``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by +including one or more template tags. For example... .. code-block:: jinja @@ -471,22 +472,22 @@ template tag, for example: {% endassets %} -will produce a minified css file with the version identifier: +... will produce a minified css file with a version identifier: .. code-block:: html -The filters can be combined, for example to use the `sass` compiler and minify -the output:: +These filters can be combined. Here is an example that uses the SASS compiler +and minifies the output: .. code-block:: jinja -{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} - -{% endassets %} + {% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} + + {% endassets %} -Another example for javascript: +Another example for Javascript: .. code-block:: jinja @@ -494,20 +495,20 @@ Another example for javascript: {% endassets %} -will produce a minified and gzipped js file: +The above will produce a minified and gzipped JS file: .. code-block:: html -Pelican's debug mode is propagated to webassets to disable asset packaging, +Pelican's debug mode is propagated to `webassets` to disable asset packaging and instead work with the uncompressed assets. However, this also means that -the `less` and `sass` files are not compiled, this should be fixed in a future -version of webassets (cf. the related `bug report +the LESS and SASS files are not compiled. This should be fixed in a future +version of `webassets` (cf. the related `bug report `_). .. _webassets: https://github.com/miracle2k/webassets -.. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html +.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html Example settings ================ From 20daa2845253bab2cd6ad09b3e9396d65f951b21 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 10 Sep 2012 20:50:45 -0700 Subject: [PATCH 0054/1975] Eliminate extraneous whitespace --- docs/contribute.rst | 4 ++-- docs/faq.rst | 8 ++++---- docs/importer.rst | 2 +- docs/index.rst | 4 ++-- docs/internals.rst | 4 ++-- docs/pelican-themes.rst | 10 +++++----- docs/plugins.rst | 2 +- docs/report.rst | 4 ++-- docs/themes.rst | 10 +++++----- docs/tips.rst | 6 +++--- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index 82419f17..0820d5c3 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -23,7 +23,7 @@ different projects. To create a virtual environment, use the following syntax:: - $ mkvirtualenv pelican + $ mkvirtualenv pelican To clone the Pelican source:: @@ -65,5 +65,5 @@ Try to respect what is described in the `PEP8 specification `_ when providing patches. This can be eased via the `pep8 `_ or `flake8 `_ tools, the latter of which in -particular will give you some useful hints about ways in which the +particular will give you some useful hints about ways in which the code/formatting can be improved. diff --git a/docs/faq.rst b/docs/faq.rst index c5c751e6..e76bea6a 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -26,7 +26,7 @@ suggestions or problems you might have via IRC or the issue tracker. If you want to contribute, please fork `the git repository `_, create a new feature branch, make your changes, and issue a pull request. Someone will review your changes as soon -as possible. Please refer to the :doc:`How to Contribute ` section +as possible. Please refer to the :doc:`How to Contribute ` section for more details. You can also contribute by creating themes and improving the documentation. @@ -43,7 +43,7 @@ I'm creating my own theme. How do I use Pygments for syntax highlighting? Pygments adds some classes to the generated content. These classes are used by themes to style code syntax highlighting via CSS. Specifically, you can -customize the appearance of your syntax highlighting via the ``.codehilite pre`` +customize the appearance of your syntax highlighting via the ``.codehilite pre`` class in your theme's CSS file. To see how various styles can be used to render Django code, for example, you can use the demo `on the project website `_. @@ -105,7 +105,7 @@ I'm getting a warning about feeds generated without SITEURL being set properly In order to properly generate all URLs properly in Pelican you will need to set ``SITEURL`` to the full path of your blog. When using ``make html`` and the default Makefile provided by the `pelican-quickstart` bootstrap script to test -build your site, it's normal to see this warning since ``SITEURL`` is +build your site, it's normal to see this warning since ``SITEURL`` is deliberately left undefined. If configured properly no other ``make`` commands should result in this warning. @@ -124,5 +124,5 @@ setting names). Here is an exact list of the renamed setting names:: Older 2.x themes that referenced the old setting names may not link properly. In order to rectify this, please update your theme for compatibility with 3.0+ -by changing the relevant values in your template files. For an example of +by changing the relevant values in your template files. For an example of complete feed headers and usage please check out the ``simple`` theme. diff --git a/docs/importer.rst b/docs/importer.rst index ccf3ffe2..ba96d9c2 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -31,7 +31,7 @@ BeatifulSoup can be installed like any other Python package:: $ pip install BeautifulSoup -For pandoc, install a package for your operating system from the +For pandoc, install a package for your operating system from the `pandoc site `_. diff --git a/docs/index.rst b/docs/index.rst index 477b4342..3fc1cf9f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,7 @@ Pelican Pelican is a static site generator, written in Python_. -* Write your weblog entries directly with your editor of choice (vim!) +* Write your weblog entries directly with your editor of choice (vim!) in reStructuredText_ or Markdown_ * Includes a simple CLI tool to (re)generate the weblog * Easy to interface with DVCSes and web hooks @@ -79,4 +79,4 @@ A French version of the documentation is available at :doc:`fr/index`. .. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`#pelican on Freenode`: irc://irc.freenode.net/pelican -.. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 \ No newline at end of file +.. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 diff --git a/docs/internals.rst b/docs/internals.rst index 6b6f991f..a6264476 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -52,7 +52,7 @@ Take a look at the Markdown reader:: text = open(filename) md = Markdown(extensions = ['meta', 'codehilite']) content = md.convert(text) - + metadata = {} for name, value in md.Meta.items(): if name in _METADATA_FIELDS: @@ -81,7 +81,7 @@ both; only the existing ones will be called. context is shared between all generators, and will be passed to the templates. For instance, the ``PageGenerator`` ``generate_context`` method finds all the pages, transforms them into objects, and populates the context - with them. Be careful *not* to output anything using this context at this + with them. Be careful *not* to output anything using this context at this stage, as it is likely to change by the effect of other generators. * ``generate_output`` is then called. And guess what is it made for? Oh, diff --git a/docs/pelican-themes.rst b/docs/pelican-themes.rst index a074a0a2..23be8355 100644 --- a/docs/pelican-themes.rst +++ b/docs/pelican-themes.rst @@ -64,7 +64,7 @@ In this example, we can see there are three themes available: ``notmyidea``, ``s Note that you can combine the ``--list`` option with the ``-v`` or ``--verbose`` option to get more verbose output, like this: .. code-block:: console - + $ pelican-themes -v -l /usr/local/lib/python2.6/dist-packages/pelican-2.6.0-py2.6.egg/pelican/themes/notmyidea /usr/local/lib/python2.6/dist-packages/pelican-2.6.0-py2.6.egg/pelican/themes/two-column (symbolic link to `/home/skami/Dev/Python/pelican-themes/two-column') @@ -118,7 +118,7 @@ Creating symbolic links To symbolically link a theme, you can use the ``-s`` or ``--symlink``, which works exactly as the ``--install`` option: .. code-block:: console - + # pelican-themes --symlink ~/Dev/Python/pelican-themes/two-column In this example, the ``two-column`` theme is now symbolically linked to the Pelican themes path, so we can use it, but we can also modify it without having to reinstall it after each modification. @@ -130,11 +130,11 @@ This is useful for theme development: $ sudo pelican-themes -s ~/Dev/Python/pelican-themes/two-column $ pelican ~/Blog/content -o /tmp/out -t two-column $ firefox /tmp/out/index.html - $ vim ~/Dev/Pelican/pelican-themes/two-coumn/static/css/main.css + $ vim ~/Dev/Pelican/pelican-themes/two-coumn/static/css/main.css $ pelican ~/Blog/content -o /tmp/out -t two-column $ cp /tmp/bg.png ~/Dev/Pelican/pelican-themes/two-coumn/static/img/bg.png $ pelican ~/Blog/content -o /tmp/out -t two-column - $ vim ~/Dev/Pelican/pelican-themes/two-coumn/templates/index.html + $ vim ~/Dev/Pelican/pelican-themes/two-coumn/templates/index.html $ pelican ~/Blog/content -o /tmp/out -t two-column @@ -152,7 +152,7 @@ The ``--install``, ``--remove`` and ``--symlink`` option are not mutually exclus --symlink ~/Dev/Python/pelican-themes/two-column \ --verbose -In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr`` +In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr`` diff --git a/docs/plugins.rst b/docs/plugins.rst index 99c0429a..7743c552 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -16,7 +16,7 @@ To load plugins, you have to specify them in your settings file. You have two ways to do so. Either by specifying strings with the path to the callables:: - PLUGINS = ['pelican.plugins.gravatar',] + PLUGINS = ['pelican.plugins.gravatar',] Or by importing them and adding them to the list:: diff --git a/docs/report.rst b/docs/report.rst index f12f3048..f3ddff31 100644 --- a/docs/report.rst +++ b/docs/report.rst @@ -4,7 +4,7 @@ Some history about Pelican .. warning:: This page comes from a report the original author (Alexis Métaireau) wrote - right after writing Pelican, in December 2010. The information may not be + right after writing Pelican, in December 2010. The information may not be up-to-date. Pelican is a simple static blog generator. It parses markup files @@ -113,7 +113,7 @@ concepts. Here is what happens when calling the ``generate_context`` method: * Read the folder “path”, looking for restructured text files, load - each of them, and construct a content object (``Article``) with it. To do so, + each of them, and construct a content object (``Article``) with it. To do so, use ``Reader`` objects. * Update the ``context`` with all those articles. diff --git a/docs/themes.rst b/docs/themes.rst index d3dd4d9e..7598a28c 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -35,7 +35,7 @@ To make your own theme, you must follow the following structure:: * `templates` contains all the templates that will be used to generate the content. I've just put the mandatory templates here; you can define your own if it helps you keep things organized while creating your theme. - + Templates and variables ======================= @@ -44,7 +44,7 @@ This document describes which templates should exist in a theme, and which variables will be passed to each template at generation time. All templates will receive the variables defined in your settings file, if they -are in all-caps. You can access them directly. +are in all-caps. You can access them directly. Common variables ---------------- @@ -55,14 +55,14 @@ All of these settings will be available to all templates. Variable Description ============= =================================================== articles The list of articles, ordered descending by date - All the elements are `Article` objects, so you can + All the elements are `Article` objects, so you can access their attributes (e.g. title, summary, author etc.) dates The same list of articles, but ordered by date, ascending tags A key-value dict containing the tags (the keys) and the list of respective articles (the values) -categories A key-value dict containing the categories (keys) +categories A key-value dict containing the categories (keys) and the list of respective articles (values) pages The list of pages ============= =================================================== @@ -182,7 +182,7 @@ dates Articles related to this tag, but ordered by date, ascending articles_paginator A paginator object for the list of articles articles_page The current page of articles -dates_paginator A paginator object for the list of articles, +dates_paginator A paginator object for the list of articles, ordered by date, ascending dates_page The current page of articles, ordered by date, ascending diff --git a/docs/tips.rst b/docs/tips.rst index 8905103b..abb739b1 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -12,11 +12,11 @@ file generator, we can take advantage of this. User Pages ---------- -GitHub allows you to create user pages in the form of ``username.github.com``. +GitHub allows you to create user pages in the form of ``username.github.com``. Whatever is created in the master branch will be published. For this purpose, just the output generated by Pelican needs to pushed to GitHub. -So given a repository containing your articles, just run Pelican over the posts +So given a repository containing your articles, just run Pelican over the posts and deploy the master branch to GitHub:: $ pelican -s pelican.conf.py ./path/to/posts -o /path/to/output @@ -35,7 +35,7 @@ really easy, which can be installed via:: $ pip install ghp-import -Then, given a repository containing your articles, you would simply run +Then, given a repository containing your articles, you would simply run Pelican and upload the output to GitHub:: $ pelican -s pelican.conf.py . From 161f60e5696a9d51bedd3d774c7fd298e5980746 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 11 Sep 2012 06:50:33 -0700 Subject: [PATCH 0055/1975] Add a list of plugins to the docs. Closes #493. --- docs/plugins.rst | 106 +++++++++++++++++++++++------- pelican/plugins/global_license.py | 7 +- pelican/plugins/gravatar.py | 10 +-- 3 files changed, 93 insertions(+), 30 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 7743c552..0808ce04 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -72,14 +72,22 @@ request if you need them! List of plugins =============== -Not all the list are described here, but a few of them have been extracted from -the Pelican core and provided in ``pelican.plugins``. They are described here: +The following plugins are currently included with Pelican under ``pelican.plugins``: -Tag cloud ---------- +* `GitHub activity`_ +* `Global license`_ +* `Gravatar`_ +* `HTML tags for reStructuredText`_ +* `Related posts`_ +* `Sitemap`_ -Translation ------------ +Ideas for plugins that haven't been written yet: + +* Tag cloud +* Translation + +Plugin descriptions +=================== GitHub activity --------------- @@ -112,23 +120,78 @@ variable, as in the example:: ``github_activity`` is a list of lists. The first element is the title and the second element is the raw HTML from GitHub. +Global license +-------------- + +This plugin allows you to define a LICENSE setting and adds the contents of that +license variable to the article's context, making that variable available to use +from within your theme's templates. + +Gravatar +-------- + +This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and +makes the variable available within the article's context. You can add +AUTHOR_EMAIL to your settings file to define the default author's email +address. Obviously, that email address must be associated with a Gravatar +account. + +Alternatively, you can provide an email address from within article metadata:: + + :email: john.doe@example.com + +If the email address is defined via at least one of the two methods above, +the ``author_gravatar`` variable is added to the article's context. + +HTML tags for reStructuredText +------------------------------ + +This plugin allows you to use HTML tags from within reST documents. Following +is a usage example, which is in this case a contact form:: + + .. html:: + +

+

+ +
+ +
+ +

+ + +Related posts +------------- + +This plugin adds the ``related_posts`` variable to the article's context. +To enable, add the following to your settings file:: + + from pelican.plugins import related_posts + PLUGINS = [related_posts] + +You can then use the ``article.related_posts`` variable in your templates. +For example:: + + {% if article.related_posts %} +
    + {% for related_post in article.related_posts %} +
  • {{ related_post }}
  • + {% endfor %} +
+ {% endif %} Sitemap ------- -The plugin generates a sitemap of the blog. -It can generates plain text sitemaps or XML sitemaps. - -Configuration -""""""""""""" - -You can use the setting ``SITEMAP`` variable to configure the behavior of the +The sitemap plugin generates plain-text or XML sitemaps. You can use the +``SITEMAP`` variable in your settings file to configure the behavior of the plugin. -The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys: +The ``SITEMAP`` variable must be a Python dictionary, it can contain three keys: - -- ``format``, which set the output format of the plugin (``xml`` or ``txt``) +- ``format``, which sets the output format of the plugin (``xml`` or ``txt``) - ``priorities``, which is a dictionary with three keys: @@ -150,9 +213,8 @@ The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys: - ``indexes``, the update frequency of the index pages - An valid value is ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``, - ``yearly`` or ``never``. - + Valid frequency values are ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``, + ``yearly`` and ``never``. If a key is missing or a value is incorrect, it will be replaced with the default value. @@ -164,11 +226,9 @@ The sitemap is saved in ``/sitemap.``. They are only used in the XML sitemaps. For more information: +**Example** -Example -""""""" - -Here is an example of configuration (it's also the default settings): +Here is an example configuration (it's also the default settings): .. code-block:: python diff --git a/pelican/plugins/global_license.py b/pelican/plugins/global_license.py index 463a93b3..9a0f5206 100644 --- a/pelican/plugins/global_license.py +++ b/pelican/plugins/global_license.py @@ -4,13 +4,14 @@ from pelican import signals License plugin for Pelican ========================== -Simply add license variable in article's context, which contain -the license text. +This plugin allows you to define a LICENSE setting and adds the contents of that +license variable to the article's context, making that variable available to use +from within your theme's templates. Settings: --------- -Add LICENSE to your settings file to define default license. +Define LICENSE in your settings file with the contents of your default license. """ diff --git a/pelican/plugins/gravatar.py b/pelican/plugins/gravatar.py index 4ab8ea9c..a4d11456 100644 --- a/pelican/plugins/gravatar.py +++ b/pelican/plugins/gravatar.py @@ -5,20 +5,22 @@ from pelican import signals Gravatar plugin for Pelican =========================== -Simply add author_gravatar variable in article's context, which contains -the gravatar url. +This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and +makes the variable available within the article's context. Settings: --------- -Add AUTHOR_EMAIL to your settings file to define default author email. +Add AUTHOR_EMAIL to your settings file to define the default author's email +address. Obviously, that email address must be associated with a Gravatar +account. Article metadata: ------------------ :email: article's author email -If one of them are defined, the author_gravatar variable is added to +If one of them are defined, the author_gravatar variable is added to the article's context. """ From 728d6076e51b680d3800b7089dc586a78bee7309 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 11 Sep 2012 07:29:34 -0700 Subject: [PATCH 0056/1975] Clarify docs for specifying theme. Closes #475. --- docs/settings.rst | 48 ++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 0dd7f07b..30747ae0 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -373,19 +373,19 @@ Setting name (default value) What does it do? alphabetical order; default lists alphabetically.) ================================================ ===================================================== -Theming -======= +Themes +====== -Theming is addressed in a dedicated section (see :ref:`theming-pelican`). -However, here are the settings that are related to theming. +Creating Pelican themes is addressed in a dedicated section (see :ref:`theming-pelican`). +However, here are the settings that are related to themes. ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`THEME` Theme to use to produce the output. Can be the - complete static path to a theme folder, or - chosen between the list of default themes (see - below) +`THEME` Theme to use to produce the output. Can be a relative + or absolute path to a theme folder, or the name of a + default theme or a theme installed via + ``pelican-themes`` (see below). `THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default value is `static`, but if your theme has other static paths, you can put them here. @@ -393,22 +393,32 @@ Setting name (default value) What does it do? `WEBASSETS` (``False``) Asset management with `webassets` (see below) ================================================ ===================================================== -By default, two themes are available. You can specify them using the `-t` option: + +By default, two themes are available. You can specify them using the `THEME` setting or by passing the +``-t`` option to the ``pelican`` command: * notmyidea -* simple (a synonym for "full text" :) - -You can define your own theme too, and specify its placement in the same -manner. (Be sure to specify the full absolute path to it.) - -Here is :doc:`a guide on how to create your theme ` - -You can find a list of themes at http://github.com/getpelican/pelican-themes. +* simple (a synonym for "plain text" :) +There are a number of other themes available at http://github.com/getpelican/pelican-themes. Pelican comes with :doc:`pelican-themes`, a small script for managing themes. -The `notmyidea` theme can make good use of the following settings. I recommend -using them in your themes as well. +You can define your own theme, either by starting from scratch or by duplicating +and modifying a pre-existing theme. Here is :doc:`a guide on how to create your theme `. + +Following are example ways to specify your preferred theme:: + + # Specify name of a built-in theme + THEME = "notmyidea" + # Specify name of a theme installed via the pelican-themes tool + THEME = "chunk" + # Specify a customized theme, via path relative to the settings file + THEME = "themes/mycustomtheme" + # Specify a customized theme, via absolute path + THEME = "~/projects/mysite/themes/mycustomtheme" + +The built-in `notmyidea` theme can make good use of the following settings. Feel +free to use them in your themes as well. ======================= ======================================================= Setting name What does it do ? From 3af7e2251d36aef0862ce66fa5a4130e18fc2023 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 11 Sep 2012 09:27:26 -0700 Subject: [PATCH 0057/1975] Clarify specifying paths in settings. Closes #477. --- docs/settings.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 30747ae0..2db98259 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -16,6 +16,9 @@ False, None, etc.), dictionaries, or tuples should *not* be enclosed in quotation marks. All other values (i.e., strings) *must* be enclosed in quotation marks. +Unless otherwise specified, settings that refer to paths can be either absolute or relative to the +configuration file. + The settings you define in the configuration file will be passed to the templates, which allows you to use your settings to add site-wide content. @@ -58,10 +61,10 @@ Setting name (default value) What doe Python-Markdown documentation for a complete list of supported extensions. `OUTPUT_PATH` (``'output/'``) Where to output the generated files. -`PATH` (``None``) Path to look at for input files. -`PAGE_DIR` (``'pages'``) Directory to look at for pages. +`PATH` (``None``) Path to content directory to be processed by Pelican. +`PAGE_DIR` (``'pages'``) Directory to look at for pages, relative to `PATH`. `PAGE_EXCLUDES` (``()``) A list of directories to exclude when looking for pages. -`ARTICLE_DIR` (``''``) Directory to look at for articles. +`ARTICLE_DIR` (``''``) Directory to look at for articles, relative to `PATH`. `ARTICLE_EXCLUDES`: (``('pages',)``) A list of directories to exclude when looking for articles. `PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions of your documents. You will need to install From 56e2c67f7f3907af7752bf363bb459588e646ff1 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 14 Sep 2012 10:06:42 -0700 Subject: [PATCH 0058/1975] Add Typogrify to docs as optional dependency --- docs/getting_started.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 985718b5..85a1b559 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -69,6 +69,7 @@ Optionally: * pygments, for syntax highlighting * Markdown, for supporting Markdown as an input format +* Typogrify, for typographical enhancements Kickstart a blog ================ From 0a1a868b378d16800719be4b9663a78021815f26 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Fri, 7 Sep 2012 08:46:38 +0200 Subject: [PATCH 0059/1975] Added sourcefile generator that generates .text files --- docs/plugins.rst | 10 +++------- docs/settings.rst | 3 +++ pelican/__init__.py | 6 +++--- pelican/generators.py | 10 ++++++++++ pelican/settings.py | 1 + pelican/signals.py | 1 - 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 654b18f7..0808ce04 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -53,14 +53,10 @@ List of signals Here is the list of currently implemented signals: -========================= ============================ =========================================================================== +========================= ============================ ========================================= Signal Arguments Description -========================= ============================ =========================================================================== +========================= ============================ ========================================= initialized pelican object -finalized pelican object invoked after all the generators are executed and just before pelican exits - usefull for custom post processing actions, such as: - - minifying js/css assets. - - notify/ping search engines with an updated sitemap. article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ get_generators generators invoked in Pelican.get_generator_classes, @@ -68,7 +64,7 @@ get_generators generators invoked in Pelican.ge generator in a tuple or in a list. pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ -========================= ============================ =========================================================================== +========================= ============================ ========================================= The list is currently small, don't hesitate to add signals and make a pull request if you need them! diff --git a/docs/settings.rst b/docs/settings.rst index 2db98259..a0411e0b 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -69,6 +69,9 @@ Setting name (default value) What doe `PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions of your documents. You will need to install `rst2pdf`. +`OUTPUT_SOURCES` (``False``) Set to True if you want to copy the articles and pages in their + original format (e.g. Markdown or ReStructeredText) to the + specified OUTPUT_PATH. `RELATIVE_URLS` (``True``) Defines whether Pelican should use document-relative URLs or not. If set to ``False``, Pelican will use the SITEURL setting to construct absolute URLs. diff --git a/pelican/__init__.py b/pelican/__init__.py index 0af52c44..620f8406 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -9,7 +9,7 @@ import argparse from pelican import signals from pelican.generators import (Generator, ArticlesGenerator, PagesGenerator, - StaticGenerator, PdfGenerator, LessCSSGenerator) + StaticGenerator, PdfGenerator, LessCSSGenerator, SourceFileGenerator) from pelican.log import init from pelican.settings import read_settings, _DEFAULT_CONFIG from pelican.utils import clean_output_dir, files_changed, file_changed, NoFilesError @@ -179,14 +179,14 @@ class Pelican(object): if hasattr(p, 'generate_output'): p.generate_output(writer) - signals.finalized.send(self) - def get_generator_classes(self): generators = [StaticGenerator, ArticlesGenerator, PagesGenerator] if self.settings['PDF_GENERATOR']: generators.append(PdfGenerator) if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc generators.append(LessCSSGenerator) + if self.settings['OUTPUT_SOURCES']: + generators.append(SourceFileGenerator) for pair in signals.get_generators.send(self): (funct, value) = pair diff --git a/pelican/generators.py b/pelican/generators.py index 94edb3b2..b28e5c6d 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -491,6 +491,16 @@ class PdfGenerator(Generator): for page in self.context['pages']: self._create_pdf(page, pdf_path) +class SourceFileGenerator(Generator): + def _create_source(self, obj, output_path): + filename = os.path.splitext(obj.save_as)[0] + dest = os.path.join(output_path, filename + '.text') + copy('', obj.filename, dest) + + def generate_output(self, writer=None): + logger.info(u' Generating source files...') + for object in chain(self.context['articles'], self.context['pages']): + self._create_source(object, self.output_path) class LessCSSGenerator(Generator): """Compile less css files.""" diff --git a/pelican/settings.py b/pelican/settings.py index 92c68ddc..df105673 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -32,6 +32,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'SITENAME': 'A Pelican Blog', 'DISPLAY_PAGES_ON_MENU': True, 'PDF_GENERATOR': False, + 'OUTPUT_SOURCES': False, 'DEFAULT_CATEGORY': 'misc', 'DEFAULT_DATE': 'fs', 'WITH_FUTURE_DATES': True, diff --git a/pelican/signals.py b/pelican/signals.py index 408d84c9..7ee88a0a 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -1,7 +1,6 @@ from blinker import signal initialized = signal('pelican_initialized') -finalized = signal('pelican_finalized') article_generate_context = signal('article_generate_context') article_generator_init = signal('article_generator_init') get_generators = signal('get_generators') From 6466bb4384155189c765022496586a24ddb31742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20HUBSCHER?= Date: Mon, 17 Sep 2012 14:47:05 +0200 Subject: [PATCH 0060/1975] fix-pelican-rsync_upload-makefile --- pelican/tools/templates/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 4c5a4fcb..8e5c80f9 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -61,7 +61,7 @@ ssh_upload: publish scp -P $$(SSH_PORT) -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) rsync_upload: publish - rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) + rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR) $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) dropbox_upload: publish cp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR) From b1099477f958e1e2049c5a7d906349ed2ec394c7 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Mon, 17 Sep 2012 22:36:35 -0400 Subject: [PATCH 0061/1975] Fixed escaping in files generated from quickstart Variables are properly escaped before they are replaced in the templates. --- pelican/tools/pelican_quickstart.py | 14 +++++++++++--- pelican/tools/templates/pelicanconf.py.in | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index c8064bf1..3ec8d55c 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -167,7 +167,7 @@ Please answer the following questions so this script can generate the files need if ask('Do you want to upload your website using FTP?', answer=bool, default=False): CONF['ftp_host'] = ask('What is the hostname of your FTP server?', str, CONF['ftp_host']) CONF['ftp_user'] = ask('What is your username on that server?', str, CONF['ftp_user']) - CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) + CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) if ask('Do you want to upload your website using SSH?', answer=bool, default=False): CONF['ssh_host'] = ask('What is the hostname of your SSH server?', str, CONF['ssh_host']) CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) @@ -188,9 +188,12 @@ Please answer the following questions so this script can generate the files need try: with open(os.path.join(CONF['basedir'], 'pelicanconf.py'), 'w') as fd: + conf_python = dict() + for key, value in CONF.iteritems(): + conf_python[key] = repr(value) for line in get_template('pelicanconf.py'): template = string.Template(line) - fd.write(template.safe_substitute(CONF)) + fd.write(template.safe_substitute(conf_python)) fd.close() except OSError, e: print('Error: {0}'.format(e)) @@ -215,11 +218,16 @@ Please answer the following questions so this script can generate the files need print('Error: {0}'.format(e)) if develop: + conf_shell = dict() + for key, value in CONF.iteritems(): + if isinstance(value, basestring) and ' ' in value: + value = '"' + value.replace('"', '\\"') + '"' + conf_shell[key] = value try: with open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w') as fd: for line in get_template('develop_server.sh'): template = string.Template(line) - fd.write(template.safe_substitute(CONF)) + fd.write(template.safe_substitute(conf_shell)) fd.close() os.chmod((os.path.join(CONF['basedir'], 'develop_server.sh')), 0755) except OSError, e: diff --git a/pelican/tools/templates/pelicanconf.py.in b/pelican/tools/templates/pelicanconf.py.in index 07e286cd..d59a7989 100644 --- a/pelican/tools/templates/pelicanconf.py.in +++ b/pelican/tools/templates/pelicanconf.py.in @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -AUTHOR = u"$author" -SITENAME = u"$sitename" +AUTHOR = $author +SITENAME = $sitename SITEURL = '' TIMEZONE = 'Europe/Paris' -DEFAULT_LANG = '$lang' +DEFAULT_LANG = $lang # Blogroll LINKS = (('Pelican', 'http://docs.notmyidea.org/alexis/pelican/'), From e096fb66fb13cfb5c5869fbd13c761255605f41a Mon Sep 17 00:00:00 2001 From: Chris Streeter Date: Wed, 19 Sep 2012 10:24:51 -0700 Subject: [PATCH 0062/1975] Correctly use the right variable for webassets According to [the webasset docs](http://webassets.readthedocs.org/en/latest/integration/jinja2.html#using-the-tag) the variable should be `ASSET_URL` instead of `ASSETS_URL`. --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 2db98259..4d865a7f 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -505,7 +505,7 @@ Another example for Javascript: .. code-block:: jinja {% assets filters="uglifyjs,gzip", output="js/packed.js", "js/jquery.js", "js/base.js", "js/widgets.js" %} - + {% endassets %} The above will produce a minified and gzipped JS file: From 36e86a585412d4a00f1f6e3b88bc9a86c2a86b42 Mon Sep 17 00:00:00 2001 From: Chris Streeter Date: Sun, 23 Sep 2012 13:55:22 -0700 Subject: [PATCH 0063/1975] Apply the string formatting to {TAG,CATEGORY}_FEED urls. --- pelican/themes/simple/templates/base.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/themes/simple/templates/base.html b/pelican/themes/simple/templates/base.html index 1f55a40f..c1d9cb78 100644 --- a/pelican/themes/simple/templates/base.html +++ b/pelican/themes/simple/templates/base.html @@ -11,16 +11,16 @@ {% endif %} {% if CATEGORY_FEED_ATOM %} - + {% endif %} {% if CATEGORY_FEED_RSS %} - + {% endif %} {% if TAG_FEED_ATOM %} - + {% endif %} {% if TAG_FEED_RSS %} - + {% endif %} {% endblock head %} From cf3697199a39a8088f8fbb894d4018c5995f3842 Mon Sep 17 00:00:00 2001 From: Perry Roper Date: Wed, 26 Sep 2012 19:58:15 +0100 Subject: [PATCH 0064/1975] Output author details in pelican_import --- pelican/tools/pelican_import.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index b6437c92..8b9d4adf 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -184,6 +184,8 @@ def build_header(title, date, author, categories, tags): header = '%s\n%s\n' % (title, '#' * len(title)) if date: header += ':date: %s\n' % date + if author: + header += ':author %s\n' % author if categories: header += ':category: %s\n' % ', '.join(categories) if tags: @@ -196,6 +198,8 @@ def build_markdown_header(title, date, author, categories, tags): header = 'Title: %s\n' % title if date: header += 'Date: %s\n' % date + if author: + header += 'Author: %s\n' % author if categories: header += 'Category: %s\n' % ', '.join(categories) if tags: From 6afc9f7902168eb5f511095f860905e7d859c781 Mon Sep 17 00:00:00 2001 From: Perry Roper Date: Wed, 26 Sep 2012 19:59:47 +0100 Subject: [PATCH 0065/1975] Add missing colon --- pelican/tools/pelican_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 8b9d4adf..a5caa301 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -185,7 +185,7 @@ def build_header(title, date, author, categories, tags): if date: header += ':date: %s\n' % date if author: - header += ':author %s\n' % author + header += ':author: %s\n' % author if categories: header += ':category: %s\n' % ', '.join(categories) if tags: From 4f5253bcb39e0ba6feddbd091cfa48883628e5ae Mon Sep 17 00:00:00 2001 From: stephane Date: Thu, 27 Sep 2012 19:49:42 +0200 Subject: [PATCH 0066/1975] Add MARKDOWN_EXTENTIONS configuration parameter to enable Markdown extentions of your choice. Ex: MARKDOWN_EXTENTIONS = [ 'toc', ] enable TOC markup to generate Table of Contents. --- pelican/readers.py | 6 +++--- pelican/settings.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 30038f7a..38e7834f 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -18,7 +18,6 @@ import re from pelican.contents import Category, Tag, Author from pelican.utils import get_date, pelican_open - _METADATA_PROCESSORS = { 'tags': lambda x, y: [Tag(tag, y) for tag in unicode(x).split(',')], 'date': lambda x, y: get_date(x), @@ -125,12 +124,13 @@ class RstReader(Reader): class MarkdownReader(Reader): enabled = bool(Markdown) file_extensions = ['md', 'markdown', 'mkd'] - extensions = ['codehilite', 'extra'] + extensions = ['codehilite', 'extra' ] def read(self, filename): """Parse content and metadata of markdown files""" + markdown_extentions = self.settings.get('MARKDOWN_EXTENTIONS', []) text = pelican_open(filename) - md = Markdown(extensions=set(self.extensions + ['meta'])) + md = Markdown(extensions=set(self.extensions + markdown_extentions + ['meta'])) content = md.convert(text) metadata = {} diff --git a/pelican/settings.py b/pelican/settings.py index 92c68ddc..f2511844 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -75,6 +75,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'SUMMARY_MAX_LENGTH': 50, 'WEBASSETS': False, 'PLUGINS': [], + 'MARKDOWN_EXTENTIONS': [], } From a7dd21ffafb399b88183e6e71fd022d9f947f439 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Fri, 28 Sep 2012 14:59:05 +0200 Subject: [PATCH 0067/1975] Added a new setting OUTPUT_SOURCES_EXTENSION Using this configurable setting users can control what extension will be appended to filenames by the SourcesGenerator. The default is to use the ``.text`` extension. --- docs/settings.rst | 3 +++ pelican/generators.py | 5 ++++- pelican/settings.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index a0411e0b..9997f474 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -72,6 +72,9 @@ Setting name (default value) What doe `OUTPUT_SOURCES` (``False``) Set to True if you want to copy the articles and pages in their original format (e.g. Markdown or ReStructeredText) to the specified OUTPUT_PATH. +`OUTPUT_SOURCES_EXTENSION` (``.text``) Controls the extension that will be used by the SourcesGenerator. + Defaults to .text. If the first character is not a `.` the + dot character will be prepended to the extension. `RELATIVE_URLS` (``True``) Defines whether Pelican should use document-relative URLs or not. If set to ``False``, Pelican will use the SITEURL setting to construct absolute URLs. diff --git a/pelican/generators.py b/pelican/generators.py index b28e5c6d..e9646825 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -492,9 +492,12 @@ class PdfGenerator(Generator): self._create_pdf(page, pdf_path) class SourceFileGenerator(Generator): + def generate_context(self): + self.output_extension = self.settings['OUTPUT_SOURCES_EXTENSION'] + def _create_source(self, obj, output_path): filename = os.path.splitext(obj.save_as)[0] - dest = os.path.join(output_path, filename + '.text') + dest = os.path.join(output_path, filename + self.output_extension) copy('', obj.filename, dest) def generate_output(self, writer=None): diff --git a/pelican/settings.py b/pelican/settings.py index df105673..dce1d8ac 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -33,6 +33,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'DISPLAY_PAGES_ON_MENU': True, 'PDF_GENERATOR': False, 'OUTPUT_SOURCES': False, + 'OUTPUT_SOURCES_EXTENSION': '.text', 'DEFAULT_CATEGORY': 'misc', 'DEFAULT_DATE': 'fs', 'WITH_FUTURE_DATES': True, @@ -175,4 +176,16 @@ def configure_settings(settings, default_settings=None, filename=None): logger.warn("You must install the webassets module to use WEBASSETS.") settings['WEBASSETS'] = False + if 'OUTPUT_SOURCES_EXTENSION' in settings: + try: + if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str): + raise ValueError + elif '.' is not settings['OUTPUT_SOURCES_EXTENSION'][0]: + settings['OUTPUT_SOURCES_EXTENSION'] = '.' + settings['OUTPUT_SOURCES_EXTENSION'] + except(ValueError, IndexError): + logger.warn("Detected misconfiguration with OUTPUT_SOURCES_EXTENSION." + " falling back to the default extension " + + _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']) + settings['OUTPUT_SOURCES_EXTENSION'] = _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION'] + return settings From 55783fc3a1d6793c4674ce7d5e2e913f4d371f73 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Fri, 28 Sep 2012 08:53:59 -0700 Subject: [PATCH 0068/1975] Add sleep to no files exception to avoid CPU load --- pelican/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pelican/__init__.py b/pelican/__init__.py index 0af52c44..6281675b 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -309,6 +309,7 @@ def main(): if files_found_error == True: logger.warning("No valid files found in content. Nothing to generate.") files_found_error = False + time.sleep(1) # sleep to avoid cpu load except Exception, e: logger.warning( "Caught exception \"{}\". Reloading.".format(e) From 226aa2d8f31125e0320e1c78c3f96ff52899b3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Fri, 28 Sep 2012 22:54:01 +0200 Subject: [PATCH 0069/1975] Update docs and tests for MARKDOWN_EXTENTIONS --- tests/content/article_with_markdown_markup_extentions.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/content/article_with_markdown_markup_extentions.md diff --git a/tests/content/article_with_markdown_markup_extentions.md b/tests/content/article_with_markdown_markup_extentions.md new file mode 100644 index 00000000..201cc5e9 --- /dev/null +++ b/tests/content/article_with_markdown_markup_extentions.md @@ -0,0 +1,8 @@ +Title: Test Markdown extentions + +[TOC] + +## Level1 + +### Level2 + From 45c836fdf54c38763fffd65d485b35981b0e9f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Fri, 28 Sep 2012 23:09:57 +0200 Subject: [PATCH 0070/1975] Update docs and tests for MARKDOWN_EXTENTIONS --- docs/fr/configuration.rst | 6 ++---- docs/settings.rst | 2 +- pelican/readers.py | 10 +++++++--- pelican/settings.py | 2 +- tests/test_readers.py | 19 +++++++++++++++++++ 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 151eff3a..35965ed6 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -155,7 +155,5 @@ SITEURL : STATIC_PATHS : Les chemins statiques que vous voulez avoir accès sur le chemin de sortie "statique" ; - - - - +MARKDOWN_EXTENTIONS : + Liste des extentions Markdown que vous souhaitez utiliser ; diff --git a/docs/settings.rst b/docs/settings.rst index 4d865a7f..384c1a19 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -103,7 +103,7 @@ Setting name (default value) What doe This only applies if your content does not otherwise specify a summary. Setting to None will cause the summary to be a copy of the original content. - +`MARKDOWN_EXTENSIONS` (``['toc',]``) A list of any Markdown extensions you want to use. ===================================================================== ===================================================================== .. [#] Default is the system locale. diff --git a/pelican/readers.py b/pelican/readers.py index 38e7834f..1c2ac666 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -101,7 +101,7 @@ class RstReader(Reader): def _get_publisher(self, filename): extra_params = {'initial_header_level': '2'} pub = docutils.core.Publisher( - destination_class=docutils.io.StringOutput) + destination_class=docutils.io.StringOutput) pub.set_components('standalone', 'restructuredtext', 'html') pub.writer.translator_class = PelicanHTMLTranslator pub.process_programmatic_settings(None, extra_params, None) @@ -124,13 +124,17 @@ class RstReader(Reader): class MarkdownReader(Reader): enabled = bool(Markdown) file_extensions = ['md', 'markdown', 'mkd'] - extensions = ['codehilite', 'extra' ] + extensions = ['codehilite', 'extra'] def read(self, filename): """Parse content and metadata of markdown files""" markdown_extentions = self.settings.get('MARKDOWN_EXTENTIONS', []) + if isinstance(markdown_extentions, (str, unicode)): + markdown_extentions = [m.strip() for m in + markdown_extentions.split(',')] text = pelican_open(filename) - md = Markdown(extensions=set(self.extensions + markdown_extentions + ['meta'])) + md = Markdown(extensions=set( + self.extensions + markdown_extentions + ['meta'])) content = md.convert(text) metadata = {} diff --git a/pelican/settings.py b/pelican/settings.py index f2511844..ad0ff8fc 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -75,7 +75,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'SUMMARY_MAX_LENGTH': 50, 'WEBASSETS': False, 'PLUGINS': [], - 'MARKDOWN_EXTENTIONS': [], + 'MARKDOWN_EXTENTIONS': [ 'toc', ], } diff --git a/tests/test_readers.py b/tests/test_readers.py index 299aa378..d831252d 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -90,3 +90,22 @@ class MdReaderTest(unittest.TestCase): "

This is another markdown test file. Uses the mkd extension.

" self.assertEqual(content, expected) + + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") + def test_article_with_markdown_markup_extension(self): + # test to ensure the markdown markup extension is being processed as expected + reader = readers.MarkdownReader({}) + reader.settings.update(dict(MARKDOWN_EXTENTIONS=['toc'])) + content, metadata = reader.read(_filename('article_with_markdown_markup_extentions.md')) + expected = '
\n'\ + '\n'\ + '
\n'\ + '

Level1

\n'\ + '

Level2

' + + self.assertEqual(content, expected) From 1beff31bd87026725e0b6d8585c1fb95b3b2944d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Fri, 28 Sep 2012 23:29:10 +0200 Subject: [PATCH 0071/1975] FIX test_generate_context() to include new file content/article_with_markdown_markup_extentions.md --- tests/test_generators.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_generators.py b/tests/test_generators.py index 3a4ea1e3..caad4725 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -69,6 +69,7 @@ class TestArticlesGenerator(unittest.TestCase): [u'Article title', 'published', 'Default', 'article'], [u'Article with template', 'published', 'Default', 'custom'], [u'Test md File', 'published', 'test', 'article'], + [u'Test Markdown extentions', 'published', u'Default', 'article'], [u'This is a super article !', 'published', 'Yeah', 'article'], [u'This is an article with category !', 'published', 'yeah', 'article'], [u'This is an article without category !', 'published', 'Default', 'article'], From 0bb323f63cb429eef64b5381c9312b37b3864e08 Mon Sep 17 00:00:00 2001 From: Thanos Lefteris Date: Mon, 1 Oct 2012 17:54:20 +0300 Subject: [PATCH 0072/1975] Monospace default values of settings --- docs/settings.rst | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 4d865a7f..68cc4734 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -147,37 +147,37 @@ Also, you can use other file metadata attributes as well: Example usage: -* ARTICLE_URL = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/' -* ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html' +* ARTICLE_URL = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'`` +* ARTICLE_SAVE_AS = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'`` This would save your articles in something like '/posts/2011/Aug/07/sample-post/index.html', and the URL to this would be '/posts/2011/Aug/07/sample-post/'. -================================================ ===================================================== -Setting name (default value) what does it do? -================================================ ===================================================== -`ARTICLE_URL` ('{slug}.html') The URL to refer to an ARTICLE. -`ARTICLE_SAVE_AS` ('{slug}.html') The place where we will save an article. -`ARTICLE_LANG_URL` ('{slug}-{lang}.html') The URL to refer to an ARTICLE which doesn't use the - default language. -`ARTICLE_LANG_SAVE_AS` ('{slug}-{lang}.html' The place where we will save an article which - doesn't use the default language. -`PAGE_URL` ('pages/{slug}.html') The URL we will use to link to a page. -`PAGE_SAVE_AS` ('pages/{slug}.html') The location we will save the page. -`PAGE_LANG_URL` ('pages/{slug}-{lang}.html') The URL we will use to link to a page which doesn't - use the default language. -`PAGE_LANG_SAVE_AS` ('pages/{slug}-{lang}.html') The location we will save the page which doesn't - use the default language. -`AUTHOR_URL` ('author/{name}.html') The URL to use for an author. -`AUTHOR_SAVE_AS` ('author/{name}.html') The location to save an author. -`CATEGORY_URL` ('category/{name}.html') The URL to use for a category. -`CATEGORY_SAVE_AS` ('category/{name}.html') The location to save a category. -`TAG_URL` ('tag/{name}.html') The URL to use for a tag. -`TAG_SAVE_AS` ('tag/{name}.html') The location to save the tag page. -`_SAVE_AS` The location to save content generated from direct - templates. Where is the - upper case template name. -================================================ ===================================================== +==================================================== ===================================================== +Setting name (default value) What does it do? +==================================================== ===================================================== +`ARTICLE_URL` (``'{slug}.html'``) The URL to refer to an ARTICLE. +`ARTICLE_SAVE_AS` (``'{slug}.html'``) The place where we will save an article. +`ARTICLE_LANG_URL` (``'{slug}-{lang}.html'``) The URL to refer to an ARTICLE which doesn't use the + default language. +`ARTICLE_LANG_SAVE_AS` (``'{slug}-{lang}.html'``) The place where we will save an article which + doesn't use the default language. +`PAGE_URL` (``'pages/{slug}.html'``) The URL we will use to link to a page. +`PAGE_SAVE_AS` (``'pages/{slug}.html'``) The location we will save the page. +`PAGE_LANG_URL` (``'pages/{slug}-{lang}.html'``) The URL we will use to link to a page which doesn't + use the default language. +`PAGE_LANG_SAVE_AS` (``'pages/{slug}-{lang}.html'``) The location we will save the page which doesn't + use the default language. +`AUTHOR_URL` (``'author/{name}.html'``) The URL to use for an author. +`AUTHOR_SAVE_AS` (``'author/{name}.html'``) The location to save an author. +`CATEGORY_URL` (``'category/{name}.html'``) The URL to use for a category. +`CATEGORY_SAVE_AS` (``'category/{name}.html'``) The location to save a category. +`TAG_URL` (``'tag/{name}.html'``) The URL to use for a tag. +`TAG_SAVE_AS` (``'tag/{name}.html'``) The location to save the tag page. +`_SAVE_AS` The location to save content generated from direct + templates. Where is the + upper case template name. +==================================================== ===================================================== .. note:: @@ -316,10 +316,10 @@ You can use the following settings to configure the pagination. ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`DEFAULT_ORPHANS` (0) The minimum number of articles allowed on the +`DEFAULT_ORPHANS` (``0``) The minimum number of articles allowed on the last page. Use this when you don't want to have a last page with very few articles. -`DEFAULT_PAGINATION` (False) The maximum number of articles to include on a +`DEFAULT_PAGINATION` (``False``) The maximum number of articles to include on a page, not including orphans. False to disable pagination. ================================================ ===================================================== @@ -333,9 +333,9 @@ following settings. ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`TAG_CLOUD_STEPS` (4) Count of different font sizes in the tag +`TAG_CLOUD_STEPS` (``4``) Count of different font sizes in the tag cloud. -`TAG_CLOUD_MAX_ITEMS` (100) Maximum number of tags in the cloud. +`TAG_CLOUD_MAX_ITEMS` (``100``) Maximum number of tags in the cloud. ================================================ ===================================================== The default theme does not support tag clouds, but it is pretty easy to add:: From 15875b8bd1ed2f143925121fc8e06595ff0f78b1 Mon Sep 17 00:00:00 2001 From: "Brian St. Pierre" Date: Mon, 1 Oct 2012 19:46:02 -0400 Subject: [PATCH 0073/1975] Fix DELETE_OUTPUT_DIRECTORY crash when no output dir --- pelican/utils.py | 11 +++++++++++ tests/test_utils.py | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pelican/utils.py b/pelican/utils.py index 60ecee34..7e9ab4cb 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -97,6 +97,17 @@ def copy(path, source, destination, destination_path=None, overwrite=False): def clean_output_dir(path): """Remove all the files from the output directory""" + if not os.path.exists(path): + logger.debug("Directory already removed: %s" % path) + return + + if not os.path.isdir(path): + try: + os.remove(path) + except Exception, e: + logger.error("Unable to delete file %s; %e" % path, e) + return + # remove all the existing content from the output folder for filename in os.listdir(path): file = os.path.join(path, filename) diff --git a/tests/test_utils.py b/tests/test_utils.py index 148e322a..58118d4f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -112,3 +112,16 @@ class TestUtils(unittest.TestCase): self.assertTrue(os.path.isdir(test_directory)) self.assertListEqual([], os.listdir(test_directory)) shutil.rmtree(test_directory) + + def test_clean_output_dir_not_there(self): + test_directory = os.path.join(os.path.dirname(__file__), 'does_not_exist') + utils.clean_output_dir(test_directory) + self.assertTrue(not os.path.exists(test_directory)) + + def test_clean_output_dir_is_file(self): + test_directory = os.path.join(os.path.dirname(__file__), 'this_is_a_file') + f = open(test_directory, 'w') + f.write('') + f.close() + utils.clean_output_dir(test_directory) + self.assertTrue(not os.path.exists(test_directory)) From 01293dedaa0c676bd98efed202d486f60c7cbb0d Mon Sep 17 00:00:00 2001 From: "Brian St. Pierre" Date: Mon, 1 Oct 2012 20:32:18 -0400 Subject: [PATCH 0074/1975] Fix #530: FILES_TO_COPY error when dest dir missing If the destination directory specified by FILES_TO_COPY does not exist, site generation crashes with a CRITICAL error. This creates the destination if it does not exist. --- pelican/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pelican/utils.py b/pelican/utils.py index 60ecee34..a95b9c7d 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -90,6 +90,12 @@ def copy(path, source, destination, destination_path=None, overwrite=False): logger.info('replacement of %s with %s' % (source_, destination_)) elif os.path.isfile(source_): + try: + dest_dir = os.path.dirname(destination_) + if not os.path.exists(dest_dir): + os.makedirs(dest_dir) + except OSError, e: + logger.error("copying: %s -> %s: %r" % (source_, dest_dir, e)) shutil.copy(source_, destination_) logger.info('copying %s to %s' % (source_, destination_)) From c53a06a5d5183ce54bd94262b3af30611a59ee86 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Wed, 3 Oct 2012 22:06:45 +0200 Subject: [PATCH 0075/1975] Simplified configuration option to be more flexible As @ametaireau suggested: instead of having logic that prepends the OUTPUT_SOURCES_EXTENSION with a '.' we allow the user more flexibility to control the extension that can be used. --- docs/settings.rst | 4 ++-- pelican/settings.py | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 9997f474..e9bf54ff 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -73,8 +73,8 @@ Setting name (default value) What doe original format (e.g. Markdown or ReStructeredText) to the specified OUTPUT_PATH. `OUTPUT_SOURCES_EXTENSION` (``.text``) Controls the extension that will be used by the SourcesGenerator. - Defaults to .text. If the first character is not a `.` the - dot character will be prepended to the extension. + Defaults to ``.text``. If not a valid string the default value + will be used. `RELATIVE_URLS` (``True``) Defines whether Pelican should use document-relative URLs or not. If set to ``False``, Pelican will use the SITEURL setting to construct absolute URLs. diff --git a/pelican/settings.py b/pelican/settings.py index dce1d8ac..cd76aa22 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -177,15 +177,10 @@ def configure_settings(settings, default_settings=None, filename=None): settings['WEBASSETS'] = False if 'OUTPUT_SOURCES_EXTENSION' in settings: - try: - if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str): - raise ValueError - elif '.' is not settings['OUTPUT_SOURCES_EXTENSION'][0]: - settings['OUTPUT_SOURCES_EXTENSION'] = '.' + settings['OUTPUT_SOURCES_EXTENSION'] - except(ValueError, IndexError): + if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str): + settings['OUTPUT_SOURCES_EXTENSION'] = _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION'] logger.warn("Detected misconfiguration with OUTPUT_SOURCES_EXTENSION." " falling back to the default extension " + _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']) - settings['OUTPUT_SOURCES_EXTENSION'] = _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION'] return settings From d9d58b0510801327e634e988108f3682ffa20905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Wed, 3 Oct 2012 22:28:00 +0200 Subject: [PATCH 0076/1975] FIX: "extentions" -> "extensions" --- ...p_extentions.md => article_with_markdown_markup_extensions.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/content/{article_with_markdown_markup_extentions.md => article_with_markdown_markup_extensions.md} (100%) diff --git a/tests/content/article_with_markdown_markup_extentions.md b/tests/content/article_with_markdown_markup_extensions.md similarity index 100% rename from tests/content/article_with_markdown_markup_extentions.md rename to tests/content/article_with_markdown_markup_extensions.md From ee46becaf9e7c4c585d9f8b3fd5f112bf9ef11df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Wed, 3 Oct 2012 22:29:59 +0200 Subject: [PATCH 0077/1975] FIX: Standardizing "extentions" to "extensions" --- pelican/readers.py | 10 +++++----- pelican/settings.py | 2 +- tests/test_generators.py | 2 +- tests/test_readers.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 1c2ac666..55d5ceaa 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -128,13 +128,13 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - markdown_extentions = self.settings.get('MARKDOWN_EXTENTIONS', []) - if isinstance(markdown_extentions, (str, unicode)): - markdown_extentions = [m.strip() for m in - markdown_extentions.split(',')] + markdown_extensions = self.settings.get('MARKDOWN_EXTENsIONS', []) + if isinstance(markdown_extensions, (str, unicode)): + markdown_extensions = [m.strip() for m in + markdown_extensions.split(',')] text = pelican_open(filename) md = Markdown(extensions=set( - self.extensions + markdown_extentions + ['meta'])) + self.extensions + markdown_extensions + ['meta'])) content = md.convert(text) metadata = {} diff --git a/pelican/settings.py b/pelican/settings.py index ad0ff8fc..c454c27b 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -75,7 +75,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'SUMMARY_MAX_LENGTH': 50, 'WEBASSETS': False, 'PLUGINS': [], - 'MARKDOWN_EXTENTIONS': [ 'toc', ], + 'MARKDOWN_EXTENSIONS': ['toc', ], } diff --git a/tests/test_generators.py b/tests/test_generators.py index caad4725..374172d8 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -69,7 +69,7 @@ class TestArticlesGenerator(unittest.TestCase): [u'Article title', 'published', 'Default', 'article'], [u'Article with template', 'published', 'Default', 'custom'], [u'Test md File', 'published', 'test', 'article'], - [u'Test Markdown extentions', 'published', u'Default', 'article'], + [u'Test Markdown extensions', 'published', u'Default', 'article'], [u'This is a super article !', 'published', 'Yeah', 'article'], [u'This is an article with category !', 'published', 'yeah', 'article'], [u'This is an article without category !', 'published', 'Default', 'article'], diff --git a/tests/test_readers.py b/tests/test_readers.py index d831252d..1b3a879c 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -95,8 +95,8 @@ class MdReaderTest(unittest.TestCase): def test_article_with_markdown_markup_extension(self): # test to ensure the markdown markup extension is being processed as expected reader = readers.MarkdownReader({}) - reader.settings.update(dict(MARKDOWN_EXTENTIONS=['toc'])) - content, metadata = reader.read(_filename('article_with_markdown_markup_extentions.md')) + reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc'])) + content, metadata = reader.read(_filename('article_with_markdown_markup_extensions.md')) expected = '
\n'\ '
    \n'\ '
  • Level1
      \n'\ From e0674aad874bcbe64a2a4e0504d84f3363e71b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Wed, 3 Oct 2012 22:37:18 +0200 Subject: [PATCH 0078/1975] FIX: Standardizing "extentions" to "extensions" --- docs/fr/configuration.rst | 2 +- tests/content/article_with_markdown_markup_extensions.md | 2 +- tests/test_readers.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 35965ed6..abfc7ef5 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -155,5 +155,5 @@ SITEURL : STATIC_PATHS : Les chemins statiques que vous voulez avoir accès sur le chemin de sortie "statique" ; -MARKDOWN_EXTENTIONS : +MARKDOWN_EXTENSIONS : Liste des extentions Markdown que vous souhaitez utiliser ; diff --git a/tests/content/article_with_markdown_markup_extensions.md b/tests/content/article_with_markdown_markup_extensions.md index 201cc5e9..6cf56403 100644 --- a/tests/content/article_with_markdown_markup_extensions.md +++ b/tests/content/article_with_markdown_markup_extensions.md @@ -1,4 +1,4 @@ -Title: Test Markdown extentions +Title: Test Markdown extensions [TOC] diff --git a/tests/test_readers.py b/tests/test_readers.py index 1b3a879c..38b7197a 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -70,7 +70,7 @@ class RstReaderTest(unittest.TestCase): class MdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.Markdown, "markdown isn't installed") - def test_article_with_md_extention(self): + def test_article_with_md_extension(self): # test to ensure the md extension is being processed by the correct reader reader = readers.MarkdownReader({}) content, metadata = reader.read(_filename('article_with_md_extension.md')) From 5e895317f6ba250f2fd80d6e77a67c42035d4706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bunel?= Date: Wed, 3 Oct 2012 22:42:07 +0200 Subject: [PATCH 0079/1975] FIX: Standardizing "extentions" to "extensions" --- pelican/readers.py | 2 +- tests/test_readers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index 55d5ceaa..c53ff5b1 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -128,7 +128,7 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - markdown_extensions = self.settings.get('MARKDOWN_EXTENsIONS', []) + markdown_extensions = self.settings.get('MARKDOWN_EXTENSIONS', []) if isinstance(markdown_extensions, (str, unicode)): markdown_extensions = [m.strip() for m in markdown_extensions.split(',')] diff --git a/tests/test_readers.py b/tests/test_readers.py index 38b7197a..406027c1 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -95,7 +95,7 @@ class MdReaderTest(unittest.TestCase): def test_article_with_markdown_markup_extension(self): # test to ensure the markdown markup extension is being processed as expected reader = readers.MarkdownReader({}) - reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc'])) + reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc', ])) content, metadata = reader.read(_filename('article_with_markdown_markup_extensions.md')) expected = '
      \n'\ '
        \n'\ From b1f65f6c9f702011df4a8719d016b943282fbac4 Mon Sep 17 00:00:00 2001 From: "Brian St. Pierre" Date: Sat, 6 Oct 2012 22:34:49 -0400 Subject: [PATCH 0080/1975] Fix #535: pagination on files without an extension --- pelican/writers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pelican/writers.py b/pelican/writers.py index 75971ee9..65f0b338 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -148,9 +148,9 @@ class Writer(object): paginators[key] = Paginator(object_list, len(object_list)) # generated pages, and write + name_root, ext = os.path.splitext(name) for page_num in range(paginators.values()[0].num_pages): paginated_localcontext = localcontext.copy() - paginated_name = name for key in paginators.iterkeys(): paginator = paginators[key] page = paginator.page(page_num + 1) @@ -158,9 +158,10 @@ class Writer(object): {'%s_paginator' % key: paginator, '%s_page' % key: page}) if page_num > 0: - ext = '.' + paginated_name.rsplit('.')[-1] - paginated_name = paginated_name.replace(ext, - '%s%s' % (page_num + 1, ext)) + paginated_name = '%s%s%s' % ( + name_root, page_num + 1, ext) + else: + paginated_name = name _write_file(template, paginated_localcontext, self.output_path, paginated_name) From 3606debb1574051505ab25e56ee311f43dd18f0b Mon Sep 17 00:00:00 2001 From: "Brian St. Pierre" Date: Sun, 7 Oct 2012 20:31:20 -0400 Subject: [PATCH 0081/1975] Fix #537: sitemap.xml contains pages that don't exist --- pelican/plugins/sitemap.py | 57 +++++++++++++------------------------- 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/pelican/plugins/sitemap.py b/pelican/plugins/sitemap.py index 6402ba9c..07747760 100644 --- a/pelican/plugins/sitemap.py +++ b/pelican/plugins/sitemap.py @@ -1,3 +1,4 @@ +import collections import os.path from datetime import datetime @@ -16,34 +17,6 @@ XML_HEADER = u""" - - - {0}/index.html - {1} - {2} - {3} - - - - {0}/archives.html - {1} - {2} - {3} - - - - {0}/tags.html - {1} - {2} - {3} - - - - {0}/categories.html - {1} - {2} - {3} - """ XML_URL = u""" @@ -146,6 +119,10 @@ class SitemapGenerator(object): if getattr(page, 'status', 'published') != 'published': return + page_path = os.path.join(self.output_path, page.url) + if not os.path.exists(page_path): + return + lastmod = format_date(getattr(page, 'date', self.now)) if isinstance(page, contents.Article): @@ -176,22 +153,29 @@ class SitemapGenerator(object): for article in self.context['articles']: pages += article.translations - info('writing {0}'.format(path)) with open(path, 'w', encoding='utf-8') as fd: if self.format == 'xml': - fd.write(XML_HEADER.format( - self.siteurl, - format_date(self.now), - self.changefreqs['indexes'], - self.priorities['indexes'] - ) - ) + fd.write(XML_HEADER) else: fd.write(TXT_HEADER.format(self.siteurl)) + FakePage = collections.namedtuple('FakePage', + ['status', + 'date', + 'url']) + + for standard_page_url in ['index.html', + 'archives.html', + 'tags.html', + 'categories.html']: + fake = FakePage(status='published', + date=self.now, + url=standard_page_url) + self.write_url(fake, fd) + for page in pages: self.write_url(page, fd) @@ -199,7 +183,6 @@ class SitemapGenerator(object): fd.write(XML_FOOTER) - def get_generators(generators): return SitemapGenerator From b9c0f07f57488a8f07ea14f3cee2e6a30f13e6a5 Mon Sep 17 00:00:00 2001 From: Wladislaw Merezhko Date: Sat, 18 Aug 2012 20:32:43 +0300 Subject: [PATCH 0082/1975] Fixing pdf generation issue --- pelican/generators.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index de10a126..6fe1ad57 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -6,6 +6,7 @@ import logging import datetime import subprocess +from codecs import open from collections import defaultdict from functools import partial from itertools import chain @@ -16,7 +17,7 @@ from jinja2.exceptions import TemplateNotFound from pelican.contents import Article, Page, Category, is_valid_content from pelican.readers import read_file -from pelican.utils import copy, process_translations, open +from pelican.utils import copy, process_translations from pelican import signals @@ -272,7 +273,7 @@ class ArticlesGenerator(Generator): if 'category' not in metadata: if os.path.dirname(f) == article_path: # if the article is not in a subdirectory - category = self.settings['DEFAULT_CATEGORY'] + category = self.settings['DEFAULT_CATEGORY'] else: category = os.path.basename(os.path.dirname(f))\ .decode('utf-8') @@ -355,7 +356,7 @@ class ArticlesGenerator(Generator): self.authors = list(self.authors.items()) self.authors.sort(key=lambda item: item[0].name) - + self._update_context(('articles', 'dates', 'tags', 'categories', 'tag_cloud', 'authors', 'related_posts')) @@ -373,7 +374,7 @@ class PagesGenerator(Generator): self.hidden_translations = [] super(PagesGenerator, self).__init__(*args, **kwargs) signals.pages_generator_init.send(self) - + def generate_context(self): all_pages = [] hidden_pages = [] @@ -470,7 +471,7 @@ class PdfGenerator(Generator): output_pdf = os.path.join(output_path, filename) # print "Generating pdf for", obj.filename, " in ", output_pdf with open(obj.filename) as f: - self.pdfcreator.createPdf(text=f, output=output_pdf) + self.pdfcreator.createPdf(text=f.read(), output=output_pdf) logger.info(u' [ok] writing %s' % output_pdf) def generate_context(self): From 519d664a40c1a0adaa1208b93cecf9d82c2ec1e3 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Wed, 22 Aug 2012 23:05:07 +0200 Subject: [PATCH 0083/1975] Added a new signal `finalized` that is dispatched when pelican finishes. This signal can then be used for post processing. --- docs/plugins.rst | 1 + pelican/__init__.py | 2 ++ pelican/signals.py | 1 + 3 files changed, 4 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index 53858668..bce17ddb 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -57,6 +57,7 @@ Here is the list of currently implemented signals: Signal Arguments Description ========================= ============================ ========================================= initialized pelican object +finalized pelican object article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ pages_generate_context pages_generator, metadata diff --git a/pelican/__init__.py b/pelican/__init__.py index a69752d8..056612a8 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -179,6 +179,8 @@ class Pelican(object): if hasattr(p, 'generate_output'): p.generate_output(writer) + signals.finalized.send(self) + def get_generator_classes(self): generators = [StaticGenerator, ArticlesGenerator, PagesGenerator] if self.settings['PDF_GENERATOR']: diff --git a/pelican/signals.py b/pelican/signals.py index 4d9ab512..ddd59621 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -1,6 +1,7 @@ from blinker import signal initialized = signal('pelican_initialized') +finalized = signal('pelican_finalized') article_generate_context = signal('article_generate_context') article_generator_init = signal('article_generator_init') pages_generate_context = signal('pages_generate_context') From 5e45aaab784999aa6af0b314201d4a65902e1d40 Mon Sep 17 00:00:00 2001 From: Dirk Makowski Date: Tue, 28 Aug 2012 00:38:17 +0200 Subject: [PATCH 0084/1975] Patch to allow relative ASSET_URL Previously, webassets' ASSET_URL always was absolute. This patch allows a relative ASSET_URL, depending on Pelican's RELATIVE_URLS setting. Hint for templates: ------------------- Current version of webassets seem to remove any relative paths at the beginning of the URL. So, if RELATIVE_URLS is on, ASSET_URL will start with 'theme/', regardless if we set assets_url here to './theme/' or to 'theme/'. XXX However, this breaks the ASSET_URL if user navigates to a sub-URL, e.g. if he clicks on a category. To workaround this issue, I use instead of Maybe this hint is worth to be included in the documentation. I have it also written as comments in the source. --- pelican/generators.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 6fe1ad57..ed2bbe96 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -433,7 +433,23 @@ class StaticGenerator(Generator): # Define the assets environment that will be passed to the # generators. The StaticGenerator must then be run first to have # the assets in the output_path before generating the templates. - assets_url = self.settings['SITEURL'] + '/theme/' + + # Let ASSET_URL honor Pelican's RELATIVE_URLS setting. + # Hint for templates: + # Current version of webassets seem to remove any relative + # paths at the beginning of the URL. So, if RELATIVE_URLS + # is on, ASSET_URL will start with 'theme/', regardless if we + # set assets_url here to './theme/' or to 'theme/'. + # XXX However, this breaks the ASSET_URL if user navigates to + # a sub-URL, e.g. if he clicks on a category. To workaround this + # issue, I use + # + # instead of + # + if self.settings.get('RELATIVE_URLS'): + assets_url = './theme/' + else: + assets_url = self.settings['SITEURL'] + '/theme/' assets_src = os.path.join(self.output_path, 'theme') self.assets_env = AssetsEnvironment(assets_src, assets_url) From 966065767ae08bdd738985822dfdb45794a1c985 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Fri, 31 Aug 2012 22:17:19 +0200 Subject: [PATCH 0085/1975] Added description for the finalized signal in the docs --- docs/plugins.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index bce17ddb..f95cb684 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -53,16 +53,16 @@ List of signals Here is the list of currently implemented signals: -========================= ============================ ========================================= +========================= ============================ =========================================================================== Signal Arguments Description -========================= ============================ ========================================= +========================= ============================ =========================================================================== initialized pelican object -finalized pelican object +finalized pelican object invoked after all the generators are executed and just before pelican exits article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ -========================= ============================ ========================================= +========================= ============================ =========================================================================== The list is currently small, don't hesitate to add signals and make a pull request if you need them! From 0073c64e217ede34c411f90f601f5c03f3bab3c6 Mon Sep 17 00:00:00 2001 From: m-r-r Date: Tue, 21 Aug 2012 13:08:21 +0200 Subject: [PATCH 0086/1975] Sitemap plugin & `get_generators` signal This is a combination of 13 commits: 1. New signal for registering custom generators 2. New plugin: pelican.plugins.sitemap 3. pelican.plugins.sitemap: more settings 4. pelican.plugins.sitemap: translations are indexed 5. pelican.plugins.sitemap: added documentation 6. pelican.plugins.sitemap: added XML DTD & W3C dates 7. pelican.plugins.sitemap: removed a bug 8. the `get_generators` can now return a tuple 9. pelican.plugins.sitemap: cleaned the code 10. pelican.plugin.sitemap: settings changes 11. sitemap plugin: improved configuration & documentation 12. sitemap plugin: :set spell 13. sitemap plugin: removed useless whitespaces --- docs/plugins.rst | 79 ++++++++++++++ pelican/__init__.py | 14 ++- pelican/plugins/sitemap.py | 208 +++++++++++++++++++++++++++++++++++++ pelican/signals.py | 1 + 4 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 pelican/plugins/sitemap.py diff --git a/docs/plugins.rst b/docs/plugins.rst index f95cb684..a90d077e 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -60,6 +60,9 @@ initialized pelican object finalized pelican object invoked after all the generators are executed and just before pelican exits article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ +get_generators generators invoked in Pelican.get_generator_classes, + can return a Generator, or several + generator in a tuple or in a list. pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ ========================= ============================ =========================================================================== @@ -109,3 +112,79 @@ variable, as in the example:: ``github_activity`` is a list of lists. The first element is the title and the second element is the raw HTML from GitHub. + + +Sitemap +------- + +The plugin generates a sitemap of the blog. +It can generates plain text sitemaps or XML sitemaps. + +Configuration +""""""""""""" + +You can use the setting ``SITEMAP`` variable to configure the behavior of the +plugin. + +The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys: + + +- ``format``, which set the output format of the plugin (``xml`` or ``txt``) + +- ``priorities``, which is a dictionary with three keys: + + - ``articles``, the priority for the URLs of the articles and their + translations + + - ``pages``, the priority for the URLs of the static pages + + - ``indexes``, the priority for the URLs of the index pages, such as tags, + author pages, categories indexes, archives, etc... + + All the values of this dictionary must be decimal numbers between ``0`` and ``1``. + +- ``changefreqs``, which is a dictionary with three items: + + - ``articles``, the update frequency of the articles + + - ``pages``, the update frequency of the pages + + - ``indexes``, the update frequency of the index pages + + An valid value is ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``, + ``yearly`` or ``never``. + + +If a key is missing or a value is incorrect, it will be replaced with the +default value. + +The sitemap is saved in ``/sitemap.``. + +.. note:: + ``priorities`` and ``changefreqs`` are informations for search engines. + They are only used in the XML sitemaps. + For more information: + + +Example +""""""" + +Here is an example of configuration (it's also the default settings): + +.. code-block:: python + + PLUGINS=['pelican.plugins.sitemap',] + + SITEMAP = { + 'format': 'xml', + 'priorities': { + 'articles': 0.5, + 'indexes': 0.5, + 'pages': 0.5 + }, + 'changefreqs': { + 'articles': 'monthly', + 'indexes': 'daily', + 'pages': 'monthly' + } + } diff --git a/pelican/__init__.py b/pelican/__init__.py index 056612a8..0af52c44 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -8,7 +8,7 @@ import argparse from pelican import signals -from pelican.generators import (ArticlesGenerator, PagesGenerator, +from pelican.generators import (Generator, ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator, LessCSSGenerator) from pelican.log import init from pelican.settings import read_settings, _DEFAULT_CONFIG @@ -187,6 +187,18 @@ class Pelican(object): generators.append(PdfGenerator) if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc generators.append(LessCSSGenerator) + + for pair in signals.get_generators.send(self): + (funct, value) = pair + + if not isinstance(value, (tuple, list)): + value = (value, ) + + for v in value: + if isinstance(v, type): + logger.debug('Found generator: {0}'.format(v)) + generators.append(v) + return generators def get_writer(self): diff --git a/pelican/plugins/sitemap.py b/pelican/plugins/sitemap.py new file mode 100644 index 00000000..6402ba9c --- /dev/null +++ b/pelican/plugins/sitemap.py @@ -0,0 +1,208 @@ +import os.path + +from datetime import datetime +from logging import debug, warning, error, info +from codecs import open + +from pelican import signals, contents + +TXT_HEADER = u"""{0}/index.html +{0}/archives.html +{0}/tags.html +{0}/categories.html +""" + +XML_HEADER = u""" + + + + {0}/index.html + {1} + {2} + {3} + + + + {0}/archives.html + {1} + {2} + {3} + + + + {0}/tags.html + {1} + {2} + {3} + + + + {0}/categories.html + {1} + {2} + {3} + +""" + +XML_URL = u""" + + {0}/{1} + {2} + {3} + {4} + +""" + +XML_FOOTER = u""" + +""" + + +def format_date(date): + if date.tzinfo: + tz = date.strftime('%s') + tz = tz[:-2] + ':' + tz[-2:] + else: + tz = "-00:00" + return date.strftime("%Y-%m-%dT%H:%M:%S") + tz + + + +class SitemapGenerator(object): + + def __init__(self, context, settings, path, theme, output_path, *null): + + self.output_path = output_path + self.context = context + self.now = datetime.now() + self.siteurl = settings.get('SITEURL') + + self.format = 'xml' + + self.changefreqs = { + 'articles': 'monthly', + 'indexes': 'daily', + 'pages': 'monthly' + } + + self.priorities = { + 'articles': 0.5, + 'indexes': 0.5, + 'pages': 0.5 + } + + config = settings.get('SITEMAP', {}) + + if not isinstance(config, dict): + warning("sitemap plugin: the SITEMAP setting must be a dict") + else: + fmt = config.get('format') + pris = config.get('priorities') + chfreqs = config.get('changefreqs') + + if fmt not in ('xml', 'txt'): + warning("sitemap plugin: SITEMAP['format'] must be `txt' or `xml'") + warning("sitemap plugin: Setting SITEMAP['format'] on `xml'") + elif fmt == 'txt': + self.format = fmt + return + + valid_keys = ('articles', 'indexes', 'pages') + valid_chfreqs = ('always', 'hourly', 'daily', 'weekly', 'monthly', + 'yearly', 'never') + + if isinstance(pris, dict): + for k, v in pris.iteritems(): + if k in valid_keys and not isinstance(v, (int, float)): + default = self.priorities[k] + warning("sitemap plugin: priorities must be numbers") + warning("sitemap plugin: setting SITEMAP['priorities']" + "['{0}'] on {1}".format(k, default)) + pris[k] = default + self.priorities.update(pris) + elif pris is not None: + warning("sitemap plugin: SITEMAP['priorities'] must be a dict") + warning("sitemap plugin: using the default values") + + if isinstance(chfreqs, dict): + for k, v in chfreqs.iteritems(): + if k in valid_keys and v not in valid_chfreqs: + default = self.changefreqs[k] + warning("sitemap plugin: invalid changefreq `{0}'".format(v)) + warning("sitemap plugin: setting SITEMAP['changefreqs']" + "['{0}'] on '{1}'".format(k, default)) + chfreqs[k] = default + self.changefreqs.update(chfreqs) + elif chfreqs is not None: + warning("sitemap plugin: SITEMAP['changefreqs'] must be a dict") + warning("sitemap plugin: using the default values") + + + + def write_url(self, page, fd): + + if getattr(page, 'status', 'published') != 'published': + return + + lastmod = format_date(getattr(page, 'date', self.now)) + + if isinstance(page, contents.Article): + pri = self.priorities['articles'] + chfreq = self.changefreqs['articles'] + elif isinstance(page, contents.Page): + pri = self.priorities['pages'] + chfreq = self.changefreqs['pages'] + else: + pri = self.priorities['indexes'] + chfreq = self.changefreqs['indexes'] + + + if self.format == 'xml': + fd.write(XML_URL.format(self.siteurl, page.url, lastmod, chfreq, pri)) + else: + fd.write(self.siteurl + '/' + loc + '\n') + + + def generate_output(self, writer): + path = os.path.join(self.output_path, 'sitemap.{0}'.format(self.format)) + + pages = self.context['pages'] + self.context['articles'] \ + + [ c for (c, a) in self.context['categories']] \ + + [ t for (t, a) in self.context['tags']] \ + + [ a for (a, b) in self.context['authors']] + + for article in self.context['articles']: + pages += article.translations + + + info('writing {0}'.format(path)) + + with open(path, 'w', encoding='utf-8') as fd: + + if self.format == 'xml': + fd.write(XML_HEADER.format( + self.siteurl, + format_date(self.now), + self.changefreqs['indexes'], + self.priorities['indexes'] + ) + ) + else: + fd.write(TXT_HEADER.format(self.siteurl)) + + for page in pages: + self.write_url(page, fd) + + if self.format == 'xml': + fd.write(XML_FOOTER) + + + +def get_generators(generators): + return SitemapGenerator + + +def register(): + signals.get_generators.connect(get_generators) diff --git a/pelican/signals.py b/pelican/signals.py index ddd59621..408d84c9 100644 --- a/pelican/signals.py +++ b/pelican/signals.py @@ -4,5 +4,6 @@ initialized = signal('pelican_initialized') finalized = signal('pelican_finalized') article_generate_context = signal('article_generate_context') article_generator_init = signal('article_generator_init') +get_generators = signal('get_generators') pages_generate_context = signal('pages_generate_context') pages_generator_init = signal('pages_generator_init') From d0e5c3c1518c2d1a1649580c69454d6ef719a055 Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Sun, 2 Sep 2012 15:18:46 -0700 Subject: [PATCH 0087/1975] Add the unit2 tests to tox Remove unnecessary dependencies These dependencies are installed when tox runs setup.py --- tox.ini | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index a7dc9ec6..4a0e148c 100644 --- a/tox.ini +++ b/tox.ini @@ -2,13 +2,11 @@ envlist = py26,py27 [testenv] -commands = nosetests -s tests +commands = + nosetests -s tests + unit2 discover [] deps = nose - Jinja2 - Pygments - docutils - feedgenerator unittest2 mock Markdown From 914653f140dabc12b56d098115cfa324974db3cb Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Tue, 4 Sep 2012 15:17:59 -0700 Subject: [PATCH 0088/1975] Clean up Dev Requirements and add typogrify & webassets typogrify & webassets are optional packages for usage but should be included for testing by developers and CI dev_requirements also had packages that setup.py covers already. Added comments for redundancy --- dev_requirements.txt | 10 ++++------ tox.ini | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index ec3245d1..acf01773 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,10 +1,8 @@ -Jinja2>=2.4 -Pygments -docutils -feedgenerator +# Tests unittest2 -pytz mock +# Optional Packages Markdown -blinker BeautifulSoup +typogrify +webassets \ No newline at end of file diff --git a/tox.ini b/tox.ini index 4a0e148c..f7d9cf82 100644 --- a/tox.ini +++ b/tox.ini @@ -11,3 +11,5 @@ deps = mock Markdown BeautifulSoup + typogrify + webassets From 31afafda0f2338a4f51220a2272e370845a55c39 Mon Sep 17 00:00:00 2001 From: Nico Di Rocco Date: Fri, 7 Sep 2012 08:56:33 +0200 Subject: [PATCH 0089/1975] Added possible uses for the finalized signal to the docs --- docs/plugins.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index a90d077e..36e89f3d 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -58,6 +58,9 @@ Signal Arguments Description ========================= ============================ =========================================================================== initialized pelican object finalized pelican object invoked after all the generators are executed and just before pelican exits + usefull for custom post processing actions, such as: + - minifying js/css assets. + - notify/ping search engines with an updated sitemap. article_generate_context article_generator, metadata article_generator_init article_generator invoked in the ArticlesGenerator.__init__ get_generators generators invoked in Pelican.get_generator_classes, From 7ffa9e21d8c83fe541394d711bcf585b9ca6b07a Mon Sep 17 00:00:00 2001 From: Wladislaw Merezhko Date: Sat, 8 Sep 2012 13:07:51 +0300 Subject: [PATCH 0090/1975] Change name of utils.open function to pelican_open and refactor this change across project. --- pelican/readers.py | 6 +++--- pelican/utils.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index e3ea154d..30038f7a 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -16,7 +16,7 @@ except ImportError: import re from pelican.contents import Category, Tag, Author -from pelican.utils import get_date, open +from pelican.utils import get_date, pelican_open _METADATA_PROCESSORS = { @@ -129,7 +129,7 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - text = open(filename) + text = pelican_open(filename) md = Markdown(extensions=set(self.extensions + ['meta'])) content = md.convert(text) @@ -146,7 +146,7 @@ class HtmlReader(Reader): def read(self, filename): """Parse content and metadata of (x)HTML files""" - with open(filename) as content: + with pelican_open(filename) as content: metadata = {'title': 'unnamed'} for i in self._re.findall(content): key = i.split(':')[0][5:].strip() diff --git a/pelican/utils.py b/pelican/utils.py index ca3015ce..60ecee34 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -6,7 +6,7 @@ import shutil import logging from collections import defaultdict -from codecs import open as _open +from codecs import open from datetime import datetime from itertools import groupby from jinja2 import Markup @@ -14,6 +14,7 @@ from operator import attrgetter logger = logging.getLogger(__name__) + class NoFilesError(Exception): pass @@ -37,9 +38,9 @@ def get_date(string): raise ValueError("'%s' is not a valid date" % string) -def open(filename): +def pelican_open(filename): """Open a file and return it's content""" - return _open(filename, encoding='utf-8').read() + return open(filename, encoding='utf-8').read() def slugify(value): From 3a6196ccd191ed0f0a8170afdcd25cd043345710 Mon Sep 17 00:00:00 2001 From: Wladislaw Merezhko Date: Sat, 8 Sep 2012 18:24:15 +0300 Subject: [PATCH 0091/1975] Add two new parameters for creating pdf * PDF_STYLE - name of custom style to use when generating pdf * PDF_STYLE_PATH - path where custom style is located --- pelican/generators.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ed2bbe96..3f95322f 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -192,7 +192,7 @@ class ArticlesGenerator(Generator): save_as = self.settings.get("%s_SAVE_AS" % template.upper(), '%s.html' % template) if not save_as: - continue + continue write(save_as, self.get_template(template), self.context, blog=True, paginated=paginated, @@ -473,13 +473,20 @@ class PdfGenerator(Generator): """Generate PDFs on the output dir, for all articles and pages coming from rst""" def __init__(self, *args, **kwargs): + super(PdfGenerator, self).__init__(*args, **kwargs) try: from rst2pdf.createpdf import RstToPdf + pdf_style_path = os.path.join(self.settings['PDF_STYLE_PATH']) \ + if 'PDF_STYLE_PATH' in self.settings.keys() \ + else '' + pdf_style = self.settings['PDF_STYLE'] if 'PDF_STYLE' \ + in self.settings.keys() \ + else 'twelvepoint' self.pdfcreator = RstToPdf(breakside=0, - stylesheets=['twelvepoint']) + stylesheets=[pdf_style], + style_path=[pdf_style_path]) except ImportError: raise Exception("unable to find rst2pdf") - super(PdfGenerator, self).__init__(*args, **kwargs) def _create_pdf(self, obj, output_path): if obj.filename.endswith(".rst"): From ac67587b79913f497b116d1aadab60e04012ce78 Mon Sep 17 00:00:00 2001 From: epatters Date: Sat, 8 Sep 2012 21:39:10 -0700 Subject: [PATCH 0092/1975] BUG: Typogrify not applied to pages. --- pelican/generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 3f95322f..f4366f53 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -382,7 +382,7 @@ class PagesGenerator(Generator): os.path.join(self.path, self.settings['PAGE_DIR']), exclude=self.settings['PAGE_EXCLUDES']): try: - content, metadata = read_file(f) + content, metadata = read_file(f, settings=self.settings) except Exception, e: logger.warning(u'Could not process %s\n%s' % (f, str(e))) continue From 007cd9b8fdaa9bc6238f4998586c47eea2c74a7b Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 10 Sep 2012 20:48:13 -0700 Subject: [PATCH 0093/1975] Minor doc changes, including those for webassets --- docs/getting_started.rst | 15 ++++++------ docs/settings.rst | 53 ++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index b7cbe951..985718b5 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -17,7 +17,7 @@ While the above is the simplest method, the recommended approach is to create a virtual environment for Pelican via virtualenv_ and virtualenvwrapper_ before installing Pelican. Assuming you've followed the virtualenvwrapper `installation `_ -and `shell configuration +and `shell configuration `_ steps, you can then open a new terminal session and create a new virtual environment for Pelican:: @@ -26,7 +26,7 @@ environment for Pelican:: Once the virtual environment has been created and activated, Pelican can be be installed via ``pip`` or ``easy_install`` as noted above. Alternatively, if -you have the project source, you can install Pelican using the distutils +you have the project source, you can install Pelican using the distutils method:: $ cd path-to-Pelican-source @@ -209,7 +209,7 @@ Pages If you create a folder named ``pages``, all the files in it will be used to generate static pages. -Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to +Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to the menu. If you want to exclude any pages from being linked to or listed in the menu @@ -219,7 +219,7 @@ things like making error pages that fit the generated theme of your site. Importing an existing blog -------------------------- -It is possible to import your blog from Dotclear, WordPress, and RSS feeds using +It is possible to import your blog from Dotclear, WordPress, and RSS feeds using a simple script. See :ref:`import`. Translations @@ -277,14 +277,13 @@ For RestructuredText, use the code-block directive:: -For Markdown, include the language identifier just above code blocks:: +For Markdown, include the language identifier just above the code block, +indenting both the identifier and code:: :::identifier - - (indent both the identifier and code) -The specified identifier (e.g. ``python``, ``ruby``) should be one that +The specified identifier (e.g. ``python``, ``ruby``) should be one that appears on the `list of available lexers `_. Publishing drafts diff --git a/docs/settings.rst b/docs/settings.rst index 2f5027b9..bd22f872 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -448,26 +448,27 @@ adding the following to your configuration:: Asset management ---------------- -The `WEBASSETS` setting allows to use the `webassets`_ module to manage assets -(css, js). The module must first be installed:: +The `WEBASSETS` setting allows you to use the `webassets`_ module to manage +assets such as CSS and JS files. The module must first be installed:: pip install webassets -`webassets` allows to concatenate your assets and to use almost all of the -hype tools of the moment (see the `documentation`_): +The `webassets` module allows you to perform a number of useful asset management +functions, including: -* css minifier (`cssmin`, `yuicompressor`, ...) -* css compiler (`less`, `sass`, ...) -* js minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) +* CSS minifier (`cssmin`, `yuicompressor`, ...) +* CSS compiler (`less`, `sass`, ...) +* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) -Others filters include gzip compression, integration of images in css with -`datauri` and more. Webassets also append a version identifier to your asset -url to convince browsers to download new versions of your assets when you use -far future expires headers. +Others filters include gzip compression, integration of images in CSS via data +URIs, and more. `webassets` can also append a version identifier to your asset +URL to convince browsers to download new versions of your assets when you use +far-future expires headers. Please refer to the `webassets documentation`_ for +more information. -When using it with Pelican, `webassets` is configured to process assets in the -``OUTPUT_PATH/theme`` directory. You can use it in your templates with a -template tag, for example: +When using with Pelican, `webassets` is configured to process assets in the +``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by +including one or more template tags. For example... .. code-block:: jinja @@ -475,22 +476,22 @@ template tag, for example: {% endassets %} -will produce a minified css file with the version identifier: +... will produce a minified css file with a version identifier: .. code-block:: html -The filters can be combined, for example to use the `sass` compiler and minify -the output:: +These filters can be combined. Here is an example that uses the SASS compiler +and minifies the output: .. code-block:: jinja -{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} - -{% endassets %} + {% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} + + {% endassets %} -Another example for javascript: +Another example for Javascript: .. code-block:: jinja @@ -498,20 +499,20 @@ Another example for javascript: {% endassets %} -will produce a minified and gzipped js file: +The above will produce a minified and gzipped JS file: .. code-block:: html -Pelican's debug mode is propagated to webassets to disable asset packaging, +Pelican's debug mode is propagated to `webassets` to disable asset packaging and instead work with the uncompressed assets. However, this also means that -the `less` and `sass` files are not compiled, this should be fixed in a future -version of webassets (cf. the related `bug report +the LESS and SASS files are not compiled. This should be fixed in a future +version of `webassets` (cf. the related `bug report `_). .. _webassets: https://github.com/miracle2k/webassets -.. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html +.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html Example settings ================ From 9dcf4e5438f0a8ff31b1720b124d367ad7380dc0 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 10 Sep 2012 20:50:45 -0700 Subject: [PATCH 0094/1975] Eliminate extraneous whitespace --- docs/contribute.rst | 4 ++-- docs/faq.rst | 8 ++++---- docs/importer.rst | 2 +- docs/index.rst | 4 ++-- docs/internals.rst | 4 ++-- docs/pelican-themes.rst | 10 +++++----- docs/plugins.rst | 2 +- docs/report.rst | 4 ++-- docs/themes.rst | 10 +++++----- docs/tips.rst | 6 +++--- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index 82419f17..0820d5c3 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -23,7 +23,7 @@ different projects. To create a virtual environment, use the following syntax:: - $ mkvirtualenv pelican + $ mkvirtualenv pelican To clone the Pelican source:: @@ -65,5 +65,5 @@ Try to respect what is described in the `PEP8 specification `_ when providing patches. This can be eased via the `pep8 `_ or `flake8 `_ tools, the latter of which in -particular will give you some useful hints about ways in which the +particular will give you some useful hints about ways in which the code/formatting can be improved. diff --git a/docs/faq.rst b/docs/faq.rst index c5c751e6..e76bea6a 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -26,7 +26,7 @@ suggestions or problems you might have via IRC or the issue tracker. If you want to contribute, please fork `the git repository `_, create a new feature branch, make your changes, and issue a pull request. Someone will review your changes as soon -as possible. Please refer to the :doc:`How to Contribute ` section +as possible. Please refer to the :doc:`How to Contribute ` section for more details. You can also contribute by creating themes and improving the documentation. @@ -43,7 +43,7 @@ I'm creating my own theme. How do I use Pygments for syntax highlighting? Pygments adds some classes to the generated content. These classes are used by themes to style code syntax highlighting via CSS. Specifically, you can -customize the appearance of your syntax highlighting via the ``.codehilite pre`` +customize the appearance of your syntax highlighting via the ``.codehilite pre`` class in your theme's CSS file. To see how various styles can be used to render Django code, for example, you can use the demo `on the project website `_. @@ -105,7 +105,7 @@ I'm getting a warning about feeds generated without SITEURL being set properly In order to properly generate all URLs properly in Pelican you will need to set ``SITEURL`` to the full path of your blog. When using ``make html`` and the default Makefile provided by the `pelican-quickstart` bootstrap script to test -build your site, it's normal to see this warning since ``SITEURL`` is +build your site, it's normal to see this warning since ``SITEURL`` is deliberately left undefined. If configured properly no other ``make`` commands should result in this warning. @@ -124,5 +124,5 @@ setting names). Here is an exact list of the renamed setting names:: Older 2.x themes that referenced the old setting names may not link properly. In order to rectify this, please update your theme for compatibility with 3.0+ -by changing the relevant values in your template files. For an example of +by changing the relevant values in your template files. For an example of complete feed headers and usage please check out the ``simple`` theme. diff --git a/docs/importer.rst b/docs/importer.rst index ccf3ffe2..ba96d9c2 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -31,7 +31,7 @@ BeatifulSoup can be installed like any other Python package:: $ pip install BeautifulSoup -For pandoc, install a package for your operating system from the +For pandoc, install a package for your operating system from the `pandoc site `_. diff --git a/docs/index.rst b/docs/index.rst index 477b4342..3fc1cf9f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,7 @@ Pelican Pelican is a static site generator, written in Python_. -* Write your weblog entries directly with your editor of choice (vim!) +* Write your weblog entries directly with your editor of choice (vim!) in reStructuredText_ or Markdown_ * Includes a simple CLI tool to (re)generate the weblog * Easy to interface with DVCSes and web hooks @@ -79,4 +79,4 @@ A French version of the documentation is available at :doc:`fr/index`. .. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`#pelican on Freenode`: irc://irc.freenode.net/pelican -.. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 \ No newline at end of file +.. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 diff --git a/docs/internals.rst b/docs/internals.rst index 6b6f991f..a6264476 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -52,7 +52,7 @@ Take a look at the Markdown reader:: text = open(filename) md = Markdown(extensions = ['meta', 'codehilite']) content = md.convert(text) - + metadata = {} for name, value in md.Meta.items(): if name in _METADATA_FIELDS: @@ -81,7 +81,7 @@ both; only the existing ones will be called. context is shared between all generators, and will be passed to the templates. For instance, the ``PageGenerator`` ``generate_context`` method finds all the pages, transforms them into objects, and populates the context - with them. Be careful *not* to output anything using this context at this + with them. Be careful *not* to output anything using this context at this stage, as it is likely to change by the effect of other generators. * ``generate_output`` is then called. And guess what is it made for? Oh, diff --git a/docs/pelican-themes.rst b/docs/pelican-themes.rst index a074a0a2..23be8355 100644 --- a/docs/pelican-themes.rst +++ b/docs/pelican-themes.rst @@ -64,7 +64,7 @@ In this example, we can see there are three themes available: ``notmyidea``, ``s Note that you can combine the ``--list`` option with the ``-v`` or ``--verbose`` option to get more verbose output, like this: .. code-block:: console - + $ pelican-themes -v -l /usr/local/lib/python2.6/dist-packages/pelican-2.6.0-py2.6.egg/pelican/themes/notmyidea /usr/local/lib/python2.6/dist-packages/pelican-2.6.0-py2.6.egg/pelican/themes/two-column (symbolic link to `/home/skami/Dev/Python/pelican-themes/two-column') @@ -118,7 +118,7 @@ Creating symbolic links To symbolically link a theme, you can use the ``-s`` or ``--symlink``, which works exactly as the ``--install`` option: .. code-block:: console - + # pelican-themes --symlink ~/Dev/Python/pelican-themes/two-column In this example, the ``two-column`` theme is now symbolically linked to the Pelican themes path, so we can use it, but we can also modify it without having to reinstall it after each modification. @@ -130,11 +130,11 @@ This is useful for theme development: $ sudo pelican-themes -s ~/Dev/Python/pelican-themes/two-column $ pelican ~/Blog/content -o /tmp/out -t two-column $ firefox /tmp/out/index.html - $ vim ~/Dev/Pelican/pelican-themes/two-coumn/static/css/main.css + $ vim ~/Dev/Pelican/pelican-themes/two-coumn/static/css/main.css $ pelican ~/Blog/content -o /tmp/out -t two-column $ cp /tmp/bg.png ~/Dev/Pelican/pelican-themes/two-coumn/static/img/bg.png $ pelican ~/Blog/content -o /tmp/out -t two-column - $ vim ~/Dev/Pelican/pelican-themes/two-coumn/templates/index.html + $ vim ~/Dev/Pelican/pelican-themes/two-coumn/templates/index.html $ pelican ~/Blog/content -o /tmp/out -t two-column @@ -152,7 +152,7 @@ The ``--install``, ``--remove`` and ``--symlink`` option are not mutually exclus --symlink ~/Dev/Python/pelican-themes/two-column \ --verbose -In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr`` +In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr`` diff --git a/docs/plugins.rst b/docs/plugins.rst index 36e89f3d..dfc66dbd 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -16,7 +16,7 @@ To load plugins, you have to specify them in your settings file. You have two ways to do so. Either by specifying strings with the path to the callables:: - PLUGINS = ['pelican.plugins.gravatar',] + PLUGINS = ['pelican.plugins.gravatar',] Or by importing them and adding them to the list:: diff --git a/docs/report.rst b/docs/report.rst index f12f3048..f3ddff31 100644 --- a/docs/report.rst +++ b/docs/report.rst @@ -4,7 +4,7 @@ Some history about Pelican .. warning:: This page comes from a report the original author (Alexis Métaireau) wrote - right after writing Pelican, in December 2010. The information may not be + right after writing Pelican, in December 2010. The information may not be up-to-date. Pelican is a simple static blog generator. It parses markup files @@ -113,7 +113,7 @@ concepts. Here is what happens when calling the ``generate_context`` method: * Read the folder “path”, looking for restructured text files, load - each of them, and construct a content object (``Article``) with it. To do so, + each of them, and construct a content object (``Article``) with it. To do so, use ``Reader`` objects. * Update the ``context`` with all those articles. diff --git a/docs/themes.rst b/docs/themes.rst index d3dd4d9e..7598a28c 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -35,7 +35,7 @@ To make your own theme, you must follow the following structure:: * `templates` contains all the templates that will be used to generate the content. I've just put the mandatory templates here; you can define your own if it helps you keep things organized while creating your theme. - + Templates and variables ======================= @@ -44,7 +44,7 @@ This document describes which templates should exist in a theme, and which variables will be passed to each template at generation time. All templates will receive the variables defined in your settings file, if they -are in all-caps. You can access them directly. +are in all-caps. You can access them directly. Common variables ---------------- @@ -55,14 +55,14 @@ All of these settings will be available to all templates. Variable Description ============= =================================================== articles The list of articles, ordered descending by date - All the elements are `Article` objects, so you can + All the elements are `Article` objects, so you can access their attributes (e.g. title, summary, author etc.) dates The same list of articles, but ordered by date, ascending tags A key-value dict containing the tags (the keys) and the list of respective articles (the values) -categories A key-value dict containing the categories (keys) +categories A key-value dict containing the categories (keys) and the list of respective articles (values) pages The list of pages ============= =================================================== @@ -182,7 +182,7 @@ dates Articles related to this tag, but ordered by date, ascending articles_paginator A paginator object for the list of articles articles_page The current page of articles -dates_paginator A paginator object for the list of articles, +dates_paginator A paginator object for the list of articles, ordered by date, ascending dates_page The current page of articles, ordered by date, ascending diff --git a/docs/tips.rst b/docs/tips.rst index 8905103b..abb739b1 100644 --- a/docs/tips.rst +++ b/docs/tips.rst @@ -12,11 +12,11 @@ file generator, we can take advantage of this. User Pages ---------- -GitHub allows you to create user pages in the form of ``username.github.com``. +GitHub allows you to create user pages in the form of ``username.github.com``. Whatever is created in the master branch will be published. For this purpose, just the output generated by Pelican needs to pushed to GitHub. -So given a repository containing your articles, just run Pelican over the posts +So given a repository containing your articles, just run Pelican over the posts and deploy the master branch to GitHub:: $ pelican -s pelican.conf.py ./path/to/posts -o /path/to/output @@ -35,7 +35,7 @@ really easy, which can be installed via:: $ pip install ghp-import -Then, given a repository containing your articles, you would simply run +Then, given a repository containing your articles, you would simply run Pelican and upload the output to GitHub:: $ pelican -s pelican.conf.py . From c659695c5d9173023ce3e6753b91e96b840aa16c Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 11 Sep 2012 06:50:33 -0700 Subject: [PATCH 0095/1975] Add a list of plugins to the docs. Closes #493. --- docs/plugins.rst | 106 +++++++++++++++++++++++------- pelican/plugins/global_license.py | 7 +- pelican/plugins/gravatar.py | 10 +-- 3 files changed, 93 insertions(+), 30 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index dfc66dbd..654b18f7 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -76,14 +76,22 @@ request if you need them! List of plugins =============== -Not all the list are described here, but a few of them have been extracted from -the Pelican core and provided in ``pelican.plugins``. They are described here: +The following plugins are currently included with Pelican under ``pelican.plugins``: -Tag cloud ---------- +* `GitHub activity`_ +* `Global license`_ +* `Gravatar`_ +* `HTML tags for reStructuredText`_ +* `Related posts`_ +* `Sitemap`_ -Translation ------------ +Ideas for plugins that haven't been written yet: + +* Tag cloud +* Translation + +Plugin descriptions +=================== GitHub activity --------------- @@ -116,23 +124,78 @@ variable, as in the example:: ``github_activity`` is a list of lists. The first element is the title and the second element is the raw HTML from GitHub. +Global license +-------------- + +This plugin allows you to define a LICENSE setting and adds the contents of that +license variable to the article's context, making that variable available to use +from within your theme's templates. + +Gravatar +-------- + +This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and +makes the variable available within the article's context. You can add +AUTHOR_EMAIL to your settings file to define the default author's email +address. Obviously, that email address must be associated with a Gravatar +account. + +Alternatively, you can provide an email address from within article metadata:: + + :email: john.doe@example.com + +If the email address is defined via at least one of the two methods above, +the ``author_gravatar`` variable is added to the article's context. + +HTML tags for reStructuredText +------------------------------ + +This plugin allows you to use HTML tags from within reST documents. Following +is a usage example, which is in this case a contact form:: + + .. html:: + +
        +

        + +
        + +
        + +

        +
        + +Related posts +------------- + +This plugin adds the ``related_posts`` variable to the article's context. +To enable, add the following to your settings file:: + + from pelican.plugins import related_posts + PLUGINS = [related_posts] + +You can then use the ``article.related_posts`` variable in your templates. +For example:: + + {% if article.related_posts %} +
          + {% for related_post in article.related_posts %} +
        • {{ related_post }}
        • + {% endfor %} +
        + {% endif %} Sitemap ------- -The plugin generates a sitemap of the blog. -It can generates plain text sitemaps or XML sitemaps. - -Configuration -""""""""""""" - -You can use the setting ``SITEMAP`` variable to configure the behavior of the +The sitemap plugin generates plain-text or XML sitemaps. You can use the +``SITEMAP`` variable in your settings file to configure the behavior of the plugin. -The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys: +The ``SITEMAP`` variable must be a Python dictionary, it can contain three keys: - -- ``format``, which set the output format of the plugin (``xml`` or ``txt``) +- ``format``, which sets the output format of the plugin (``xml`` or ``txt``) - ``priorities``, which is a dictionary with three keys: @@ -154,9 +217,8 @@ The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys: - ``indexes``, the update frequency of the index pages - An valid value is ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``, - ``yearly`` or ``never``. - + Valid frequency values are ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``, + ``yearly`` and ``never``. If a key is missing or a value is incorrect, it will be replaced with the default value. @@ -168,11 +230,9 @@ The sitemap is saved in ``/sitemap.``. They are only used in the XML sitemaps. For more information: +**Example** -Example -""""""" - -Here is an example of configuration (it's also the default settings): +Here is an example configuration (it's also the default settings): .. code-block:: python diff --git a/pelican/plugins/global_license.py b/pelican/plugins/global_license.py index 463a93b3..9a0f5206 100644 --- a/pelican/plugins/global_license.py +++ b/pelican/plugins/global_license.py @@ -4,13 +4,14 @@ from pelican import signals License plugin for Pelican ========================== -Simply add license variable in article's context, which contain -the license text. +This plugin allows you to define a LICENSE setting and adds the contents of that +license variable to the article's context, making that variable available to use +from within your theme's templates. Settings: --------- -Add LICENSE to your settings file to define default license. +Define LICENSE in your settings file with the contents of your default license. """ diff --git a/pelican/plugins/gravatar.py b/pelican/plugins/gravatar.py index 4ab8ea9c..a4d11456 100644 --- a/pelican/plugins/gravatar.py +++ b/pelican/plugins/gravatar.py @@ -5,20 +5,22 @@ from pelican import signals Gravatar plugin for Pelican =========================== -Simply add author_gravatar variable in article's context, which contains -the gravatar url. +This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and +makes the variable available within the article's context. Settings: --------- -Add AUTHOR_EMAIL to your settings file to define default author email. +Add AUTHOR_EMAIL to your settings file to define the default author's email +address. Obviously, that email address must be associated with a Gravatar +account. Article metadata: ------------------ :email: article's author email -If one of them are defined, the author_gravatar variable is added to +If one of them are defined, the author_gravatar variable is added to the article's context. """ From f7a28dc6611a5c8ef2f2c03566e48bec4ae4a035 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 11 Sep 2012 07:29:34 -0700 Subject: [PATCH 0096/1975] Clarify docs for specifying theme. Closes #475. --- docs/settings.rst | 48 ++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index bd22f872..6da1fb14 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -377,19 +377,19 @@ Setting name (default value) What does it do? alphabetical order; default lists alphabetically.) ================================================ ===================================================== -Theming -======= +Themes +====== -Theming is addressed in a dedicated section (see :ref:`theming-pelican`). -However, here are the settings that are related to theming. +Creating Pelican themes is addressed in a dedicated section (see :ref:`theming-pelican`). +However, here are the settings that are related to themes. ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`THEME` Theme to use to produce the output. Can be the - complete static path to a theme folder, or - chosen between the list of default themes (see - below) +`THEME` Theme to use to produce the output. Can be a relative + or absolute path to a theme folder, or the name of a + default theme or a theme installed via + ``pelican-themes`` (see below). `THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default value is `static`, but if your theme has other static paths, you can put them here. @@ -397,22 +397,32 @@ Setting name (default value) What does it do? `WEBASSETS` (``False``) Asset management with `webassets` (see below) ================================================ ===================================================== -By default, two themes are available. You can specify them using the `-t` option: + +By default, two themes are available. You can specify them using the `THEME` setting or by passing the +``-t`` option to the ``pelican`` command: * notmyidea -* simple (a synonym for "full text" :) - -You can define your own theme too, and specify its placement in the same -manner. (Be sure to specify the full absolute path to it.) - -Here is :doc:`a guide on how to create your theme ` - -You can find a list of themes at http://github.com/getpelican/pelican-themes. +* simple (a synonym for "plain text" :) +There are a number of other themes available at http://github.com/getpelican/pelican-themes. Pelican comes with :doc:`pelican-themes`, a small script for managing themes. -The `notmyidea` theme can make good use of the following settings. I recommend -using them in your themes as well. +You can define your own theme, either by starting from scratch or by duplicating +and modifying a pre-existing theme. Here is :doc:`a guide on how to create your theme `. + +Following are example ways to specify your preferred theme:: + + # Specify name of a built-in theme + THEME = "notmyidea" + # Specify name of a theme installed via the pelican-themes tool + THEME = "chunk" + # Specify a customized theme, via path relative to the settings file + THEME = "themes/mycustomtheme" + # Specify a customized theme, via absolute path + THEME = "~/projects/mysite/themes/mycustomtheme" + +The built-in `notmyidea` theme can make good use of the following settings. Feel +free to use them in your themes as well. ======================= ======================================================= Setting name What does it do ? From c08ab18bffd5f5349095381096b48bf62b29eefc Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 11 Sep 2012 09:27:26 -0700 Subject: [PATCH 0097/1975] Clarify specifying paths in settings. Closes #477. --- docs/settings.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 6da1fb14..9b3295a6 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -16,6 +16,9 @@ False, None, etc.), dictionaries, or tuples should *not* be enclosed in quotation marks. All other values (i.e., strings) *must* be enclosed in quotation marks. +Unless otherwise specified, settings that refer to paths can be either absolute or relative to the +configuration file. + The settings you define in the configuration file will be passed to the templates, which allows you to use your settings to add site-wide content. @@ -58,10 +61,10 @@ Setting name (default value) What doe Python-Markdown documentation for a complete list of supported extensions. `OUTPUT_PATH` (``'output/'``) Where to output the generated files. -`PATH` (``None``) Path to look at for input files. -`PAGE_DIR` (``'pages'``) Directory to look at for pages. +`PATH` (``None``) Path to content directory to be processed by Pelican. +`PAGE_DIR` (``'pages'``) Directory to look at for pages, relative to `PATH`. `PAGE_EXCLUDES` (``()``) A list of directories to exclude when looking for pages. -`ARTICLE_DIR` (``''``) Directory to look at for articles. +`ARTICLE_DIR` (``''``) Directory to look at for articles, relative to `PATH`. `ARTICLE_EXCLUDES`: (``('pages',)``) A list of directories to exclude when looking for articles. `PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions of your documents. You will need to install From cd85151f97bef9d50f2f92e3cfc05657ea037ddb Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 14 Sep 2012 10:06:42 -0700 Subject: [PATCH 0098/1975] Add Typogrify to docs as optional dependency --- docs/getting_started.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 985718b5..85a1b559 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -69,6 +69,7 @@ Optionally: * pygments, for syntax highlighting * Markdown, for supporting Markdown as an input format +* Typogrify, for typographical enhancements Kickstart a blog ================ From 61fe02f4116c78579b92338909086b408056fdce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20HUBSCHER?= Date: Mon, 17 Sep 2012 14:47:05 +0200 Subject: [PATCH 0099/1975] fix-pelican-rsync_upload-makefile --- pelican/tools/templates/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 4c5a4fcb..8e5c80f9 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -61,7 +61,7 @@ ssh_upload: publish scp -P $$(SSH_PORT) -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) rsync_upload: publish - rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) + rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR) $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) dropbox_upload: publish cp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR) From 7d1c362635275012007398cfa1fa174247fa5b50 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Mon, 17 Sep 2012 22:36:35 -0400 Subject: [PATCH 0100/1975] Fixed escaping in files generated from quickstart Variables are properly escaped before they are replaced in the templates. --- pelican/tools/pelican_quickstart.py | 14 +++++++++++--- pelican/tools/templates/pelicanconf.py.in | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index c8064bf1..3ec8d55c 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -167,7 +167,7 @@ Please answer the following questions so this script can generate the files need if ask('Do you want to upload your website using FTP?', answer=bool, default=False): CONF['ftp_host'] = ask('What is the hostname of your FTP server?', str, CONF['ftp_host']) CONF['ftp_user'] = ask('What is your username on that server?', str, CONF['ftp_user']) - CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) + CONF['ftp_target_dir'] = ask('Where do you want to put your web site on that server?', str, CONF['ftp_target_dir']) if ask('Do you want to upload your website using SSH?', answer=bool, default=False): CONF['ssh_host'] = ask('What is the hostname of your SSH server?', str, CONF['ssh_host']) CONF['ssh_port'] = ask('What is the port of your SSH server?', int, CONF['ssh_port']) @@ -188,9 +188,12 @@ Please answer the following questions so this script can generate the files need try: with open(os.path.join(CONF['basedir'], 'pelicanconf.py'), 'w') as fd: + conf_python = dict() + for key, value in CONF.iteritems(): + conf_python[key] = repr(value) for line in get_template('pelicanconf.py'): template = string.Template(line) - fd.write(template.safe_substitute(CONF)) + fd.write(template.safe_substitute(conf_python)) fd.close() except OSError, e: print('Error: {0}'.format(e)) @@ -215,11 +218,16 @@ Please answer the following questions so this script can generate the files need print('Error: {0}'.format(e)) if develop: + conf_shell = dict() + for key, value in CONF.iteritems(): + if isinstance(value, basestring) and ' ' in value: + value = '"' + value.replace('"', '\\"') + '"' + conf_shell[key] = value try: with open(os.path.join(CONF['basedir'], 'develop_server.sh'), 'w') as fd: for line in get_template('develop_server.sh'): template = string.Template(line) - fd.write(template.safe_substitute(CONF)) + fd.write(template.safe_substitute(conf_shell)) fd.close() os.chmod((os.path.join(CONF['basedir'], 'develop_server.sh')), 0755) except OSError, e: diff --git a/pelican/tools/templates/pelicanconf.py.in b/pelican/tools/templates/pelicanconf.py.in index 07e286cd..d59a7989 100644 --- a/pelican/tools/templates/pelicanconf.py.in +++ b/pelican/tools/templates/pelicanconf.py.in @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -AUTHOR = u"$author" -SITENAME = u"$sitename" +AUTHOR = $author +SITENAME = $sitename SITEURL = '' TIMEZONE = 'Europe/Paris' -DEFAULT_LANG = '$lang' +DEFAULT_LANG = $lang # Blogroll LINKS = (('Pelican', 'http://docs.notmyidea.org/alexis/pelican/'), From da1efcd8478c2b98f744c3844a8fd3ce3422fb1d Mon Sep 17 00:00:00 2001 From: Chris Streeter Date: Wed, 19 Sep 2012 10:24:51 -0700 Subject: [PATCH 0101/1975] Correctly use the right variable for webassets According to [the webasset docs](http://webassets.readthedocs.org/en/latest/integration/jinja2.html#using-the-tag) the variable should be `ASSET_URL` instead of `ASSETS_URL`. --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 9b3295a6..3bb9c173 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -509,7 +509,7 @@ Another example for Javascript: .. code-block:: jinja {% assets filters="uglifyjs,gzip", output="js/packed.js", "js/jquery.js", "js/base.js", "js/widgets.js" %} - + {% endassets %} The above will produce a minified and gzipped JS file: From d718bc2eba7b0e4d3a81531175cf4d7f40f972d6 Mon Sep 17 00:00:00 2001 From: Chris Streeter Date: Sun, 23 Sep 2012 13:55:22 -0700 Subject: [PATCH 0102/1975] Apply the string formatting to {TAG,CATEGORY}_FEED urls. --- pelican/themes/simple/templates/base.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/themes/simple/templates/base.html b/pelican/themes/simple/templates/base.html index 1f55a40f..c1d9cb78 100644 --- a/pelican/themes/simple/templates/base.html +++ b/pelican/themes/simple/templates/base.html @@ -11,16 +11,16 @@ {% endif %} {% if CATEGORY_FEED_ATOM %} - + {% endif %} {% if CATEGORY_FEED_RSS %} - + {% endif %} {% if TAG_FEED_ATOM %} - + {% endif %} {% if TAG_FEED_RSS %} - + {% endif %} {% endblock head %} From ffc8ec7a5bee49c8b71bfc3e1cd1f2c3254ac1ac Mon Sep 17 00:00:00 2001 From: tBunnyMan Date: Fri, 28 Sep 2012 08:53:59 -0700 Subject: [PATCH 0103/1975] Add sleep to no files exception to avoid CPU load --- pelican/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pelican/__init__.py b/pelican/__init__.py index 0af52c44..6281675b 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -309,6 +309,7 @@ def main(): if files_found_error == True: logger.warning("No valid files found in content. Nothing to generate.") files_found_error = False + time.sleep(1) # sleep to avoid cpu load except Exception, e: logger.warning( "Caught exception \"{}\". Reloading.".format(e) From ee36f53cb248903f6fb0a88cc607f163ff539c69 Mon Sep 17 00:00:00 2001 From: Thanos Lefteris Date: Mon, 1 Oct 2012 17:54:20 +0300 Subject: [PATCH 0104/1975] Monospace default values of settings --- docs/settings.rst | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 3bb9c173..d721ede1 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -151,37 +151,37 @@ Also, you can use other file metadata attributes as well: Example usage: -* ARTICLE_URL = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/' -* ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html' +* ARTICLE_URL = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'`` +* ARTICLE_SAVE_AS = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'`` This would save your articles in something like '/posts/2011/Aug/07/sample-post/index.html', and the URL to this would be '/posts/2011/Aug/07/sample-post/'. -================================================ ===================================================== -Setting name (default value) what does it do? -================================================ ===================================================== -`ARTICLE_URL` ('{slug}.html') The URL to refer to an ARTICLE. -`ARTICLE_SAVE_AS` ('{slug}.html') The place where we will save an article. -`ARTICLE_LANG_URL` ('{slug}-{lang}.html') The URL to refer to an ARTICLE which doesn't use the - default language. -`ARTICLE_LANG_SAVE_AS` ('{slug}-{lang}.html' The place where we will save an article which - doesn't use the default language. -`PAGE_URL` ('pages/{slug}.html') The URL we will use to link to a page. -`PAGE_SAVE_AS` ('pages/{slug}.html') The location we will save the page. -`PAGE_LANG_URL` ('pages/{slug}-{lang}.html') The URL we will use to link to a page which doesn't - use the default language. -`PAGE_LANG_SAVE_AS` ('pages/{slug}-{lang}.html') The location we will save the page which doesn't - use the default language. -`AUTHOR_URL` ('author/{name}.html') The URL to use for an author. -`AUTHOR_SAVE_AS` ('author/{name}.html') The location to save an author. -`CATEGORY_URL` ('category/{name}.html') The URL to use for a category. -`CATEGORY_SAVE_AS` ('category/{name}.html') The location to save a category. -`TAG_URL` ('tag/{name}.html') The URL to use for a tag. -`TAG_SAVE_AS` ('tag/{name}.html') The location to save the tag page. -`_SAVE_AS` The location to save content generated from direct - templates. Where is the - upper case template name. -================================================ ===================================================== +==================================================== ===================================================== +Setting name (default value) What does it do? +==================================================== ===================================================== +`ARTICLE_URL` (``'{slug}.html'``) The URL to refer to an ARTICLE. +`ARTICLE_SAVE_AS` (``'{slug}.html'``) The place where we will save an article. +`ARTICLE_LANG_URL` (``'{slug}-{lang}.html'``) The URL to refer to an ARTICLE which doesn't use the + default language. +`ARTICLE_LANG_SAVE_AS` (``'{slug}-{lang}.html'``) The place where we will save an article which + doesn't use the default language. +`PAGE_URL` (``'pages/{slug}.html'``) The URL we will use to link to a page. +`PAGE_SAVE_AS` (``'pages/{slug}.html'``) The location we will save the page. +`PAGE_LANG_URL` (``'pages/{slug}-{lang}.html'``) The URL we will use to link to a page which doesn't + use the default language. +`PAGE_LANG_SAVE_AS` (``'pages/{slug}-{lang}.html'``) The location we will save the page which doesn't + use the default language. +`AUTHOR_URL` (``'author/{name}.html'``) The URL to use for an author. +`AUTHOR_SAVE_AS` (``'author/{name}.html'``) The location to save an author. +`CATEGORY_URL` (``'category/{name}.html'``) The URL to use for a category. +`CATEGORY_SAVE_AS` (``'category/{name}.html'``) The location to save a category. +`TAG_URL` (``'tag/{name}.html'``) The URL to use for a tag. +`TAG_SAVE_AS` (``'tag/{name}.html'``) The location to save the tag page. +`_SAVE_AS` The location to save content generated from direct + templates. Where is the + upper case template name. +==================================================== ===================================================== .. note:: @@ -320,10 +320,10 @@ You can use the following settings to configure the pagination. ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`DEFAULT_ORPHANS` (0) The minimum number of articles allowed on the +`DEFAULT_ORPHANS` (``0``) The minimum number of articles allowed on the last page. Use this when you don't want to have a last page with very few articles. -`DEFAULT_PAGINATION` (False) The maximum number of articles to include on a +`DEFAULT_PAGINATION` (``False``) The maximum number of articles to include on a page, not including orphans. False to disable pagination. ================================================ ===================================================== @@ -337,9 +337,9 @@ following settings. ================================================ ===================================================== Setting name (default value) What does it do? ================================================ ===================================================== -`TAG_CLOUD_STEPS` (4) Count of different font sizes in the tag +`TAG_CLOUD_STEPS` (``4``) Count of different font sizes in the tag cloud. -`TAG_CLOUD_MAX_ITEMS` (100) Maximum number of tags in the cloud. +`TAG_CLOUD_MAX_ITEMS` (``100``) Maximum number of tags in the cloud. ================================================ ===================================================== The default theme does not support tag clouds, but it is pretty easy to add:: From 7892c33ec959dac68f7708be7f130f97a812f1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 12 Oct 2012 22:20:47 +0200 Subject: [PATCH 0105/1975] Fix the settings about DATE_FORMAT*S*. Fix 540 --- docs/settings.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index d721ede1..03f1e4fa 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -204,14 +204,14 @@ Have a look at `the wikipedia page`_ to get a list of valid timezone values. Date format and locale ---------------------- -If no DATE_FORMAT is set, fall back to DEFAULT_DATE_FORMAT. If you need to +If no DATE_FORMATS is set, fall back to DEFAULT_DATE_FORMAT. If you need to maintain multiple languages with different date formats, you can set this dict using language name (``lang`` in your posts) as key. Regarding available format codes, see `strftime document of python`_ : .. parsed-literal:: - DATE_FORMAT = { + DATE_FORMATS = { 'en': '%a, %d %b %Y', 'jp': '%Y-%m-%d(%a)', } @@ -230,13 +230,13 @@ above: .. parsed-literal:: # On Unix/Linux - DATE_FORMAT = { + DATE_FORMATS = { 'en': ('en_US','%a, %d %b %Y'), 'jp': ('ja_JP','%Y-%m-%d(%a)'), } # On Windows - DATE_FORMAT = { + DATE_FORMATS = { 'en': ('usa','%a, %d %b %Y'), 'jp': ('jpn','%Y-%m-%d(%a)'), } From 9add2151c37a499efb8655dc87f0685112b2a2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 12 Oct 2012 22:37:58 +0200 Subject: [PATCH 0106/1975] Don't force the number of categories to be equal to 1. Fixes #521 --- pelican/tools/pelican_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index b6437c92..c2d259f2 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -216,7 +216,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals filename = os.path.basename(filename) # option to put files in directories with categories names - if dircat and (len(categories) == 1): + if dircat and (len(categories) > 0): catname = slugify(categories[0]) out_filename = os.path.join(output_path, catname, filename+ext) if not os.path.isdir(os.path.join(output_path, catname)): From cce962f3f00adb602849b93e88a32a2ba48aa37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 12 Oct 2012 22:56:45 +0200 Subject: [PATCH 0107/1975] Change the background color of the code-blocks on the default theme. Fix #511 --- pelican/themes/notmyidea/static/css/main.css | 2 +- pelican/themes/notmyidea/static/css/pygment.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index b4ba7888..3d94200b 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -97,7 +97,7 @@ dl {margin: 0 0 1.5em 0;} dt {font-weight: bold;} dd {margin-left: 1.5em;} -pre{background-color: #000; padding: 10px; color: #fff; margin: 10px; overflow: auto;} +pre{background-color: rgb(238, 238, 238); padding: 10px; margin: 10px; overflow: auto;} /* Quotes */ blockquote { diff --git a/pelican/themes/notmyidea/static/css/pygment.css b/pelican/themes/notmyidea/static/css/pygment.css index 594b0fa3..fdd056f6 100644 --- a/pelican/themes/notmyidea/static/css/pygment.css +++ b/pelican/themes/notmyidea/static/css/pygment.css @@ -1,5 +1,5 @@ .hll { -background-color:#FFFFCC; +background-color:#eee; } .c { color:#408090; From 34218ee132e59e5ae77535500a209085f8b28a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 12 Oct 2012 23:28:18 +0200 Subject: [PATCH 0108/1975] fix the tests --- .../output/basic/drafts/a-draft-article.html | 4 ++-- tests/output/basic/feeds/all-fr.atom.xml | 2 +- tests/output/basic/oh-yeah-fr.html | 4 ++-- tests/output/basic/tag/bar.html | 16 +++++++-------- tests/output/basic/tag/baz.html | 16 +++++++-------- tests/output/basic/tag/foo.html | 16 +++++++-------- tests/output/basic/theme/css/main.css | 5 +++-- tests/output/basic/theme/css/pygment.css | 2 +- tests/output/custom/tag/bar.html | 20 +++++++++---------- tests/output/custom/tag/baz.html | 20 +++++++++---------- tests/output/custom/tag/foo.html | 20 +++++++++---------- tests/output/custom/theme/css/main.css | 5 +++-- tests/output/custom/theme/css/pygment.css | 2 +- 13 files changed, 67 insertions(+), 65 deletions(-) diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html index 24c1c3bc..7da9c416 100644 --- a/tests/output/basic/drafts/a-draft-article.html +++ b/tests/output/basic/drafts/a-draft-article.html @@ -55,8 +55,8 @@
        - - Thu 26 July 2012 + + Mon 17 September 2012 diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index 39220a4f..979e21ef 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog/2012-07-26T22:04:43ZTrop bien !2012-07-26T22:04:43ZDummy Authortag:,2012-07-26:oh-yeah-fr.html<p>Et voila du contenu en français</p> +A Pelican Blog/2012-09-17T15:02:39ZTrop bien !2012-09-17T15:02:39ZDummy Authortag:,2012-09-17:oh-yeah-fr.html<p>Et voila du contenu en français</p> Deuxième article2012-02-29T00:00:00ZDummy Authortag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html index cfcb7f1a..335428ef 100644 --- a/tests/output/basic/oh-yeah-fr.html +++ b/tests/output/basic/oh-yeah-fr.html @@ -55,8 +55,8 @@
        - - Thu 26 July 2012 + + Mon 17 September 2012 diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index f58ba6bd..77462fe6 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -51,7 +51,7 @@

        Ceci est un article, en français.

        @@ -92,8 +92,8 @@ Translations:
      • -

        Ceci est un article, en français.

        +

        This is some article, in english

        - read more + read more
        diff --git a/tests/output/basic/tag/baz.html b/tests/output/basic/tag/baz.html index a5f9d9cc..4ebe1f1d 100644 --- a/tests/output/basic/tag/baz.html +++ b/tests/output/basic/tag/baz.html @@ -51,7 +51,7 @@
      + +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]]> + + 175 + 2012-02-16 15:52:55 + 0000-00-00 00:00:00 + open + open + html-entity-test + publish + 0 + 0 + post + + 0 + + + _edit_last + + + diff --git a/tests/test_importer.py b/tests/test_importer.py index d4ff8205..959a556a 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -47,3 +47,13 @@ class TestWordpressXmlImporter(unittest.TestCase): rst_files = (r(f) for f in silent_f2p(posts, 'rst', temp, strip_raw=True)) self.assertFalse(any(' entities in the title. You can't miss them.") + self.assertTrue('&' not in title) From 868ef2079ce0acc481426865fec00fadd6812a63 Mon Sep 17 00:00:00 2001 From: David Beitey Date: Sat, 3 Nov 2012 22:07:55 +1000 Subject: [PATCH 0137/1975] Add GitHub social icon support in default theme Conflicts: docs/changelog.rst --- docs/changelog.rst | 1 + pelican/themes/notmyidea/static/css/main.css | 3 ++- .../notmyidea/static/images/icons/github.png | Bin 0 -> 360 bytes 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 pelican/themes/notmyidea/static/images/icons/github.png diff --git a/docs/changelog.rst b/docs/changelog.rst index 6cea6d93..dd49e080 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,7 @@ Release history ================ * Improve handling of links to intra-site resources +* Add GitHub social icon support in default theme 3.0 (2012-08-08) ================== diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index 3d94200b..8f514524 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -309,7 +309,8 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');} - .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} + .social a[href*='github.com'] {background-image: url('../images/icons/github.png');} + .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} /* About diff --git a/pelican/themes/notmyidea/static/images/icons/github.png b/pelican/themes/notmyidea/static/images/icons/github.png new file mode 100644 index 0000000000000000000000000000000000000000..2746e5637f8e249273ce8d9fd7ab12f05422dbae GIT binary patch literal 360 zcmV-u0hj)XP)l5W2!gGZVCxUC6Cn^tWo2vY zpRlzO1R-E+8xRCR2-w*e>;fXBkcbkS5zhFM2reA&xSg53-MP15daPkJ`vLm?7zen= z7_V95oE^*})^Ld-j<8YW)^j!trdB1;K^J==RJF7lOsDGF&sfG;uH3~PdijoV63o+N zJNIa3e;#nvIuE8D4ya?4zE<%uLtu=}U`MDgq7jSUBDOTgrIld&Xe>@7AMrj%;MaR7 zTY%<_Hcku6N8yr5w*qJ;aa<5Duu~Lmh4aJ4r&x52E8G?WHwCuRMj>@meLIikTcB68 z+YJ_!L)^y;9 Date: Sat, 3 Nov 2012 22:21:02 +1000 Subject: [PATCH 0138/1975] GitHub icon also works for git.io addresses in social --- pelican/themes/notmyidea/static/css/main.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index 8f514524..c859925d 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -309,7 +309,8 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');} - .social a[href*='github.com'] {background-image: url('../images/icons/github.png');} + .social a[href*='github.com'], + .social a[href*='git.io'] {background-image: url('../images/icons/github.png');} .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} /* From 705ab7b0f8a0c780de14c7ee8e37ac559f7923f4 Mon Sep 17 00:00:00 2001 From: David Beitey Date: Sat, 3 Nov 2012 22:27:33 +1000 Subject: [PATCH 0139/1975] Improve linkedin icon --- docs/changelog.rst | 1 + .../notmyidea/static/images/icons/linkedin.png | Bin 376 -> 2159 bytes 2 files changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 6cea6d93..5d0c6ac2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,7 @@ Release history ================ * Improve handling of links to intra-site resources +* Improved appearance of LinkedIn icon in default theme 3.0 (2012-08-08) ================== diff --git a/pelican/themes/notmyidea/static/images/icons/linkedin.png b/pelican/themes/notmyidea/static/images/icons/linkedin.png index feb04962bfe2fd712cb5003c8c20b43af4c18201..ee0ec7738d57b46cd634311d8df7a7d3e3ddf65e 100644 GIT binary patch literal 2159 zcmd^A`CAiL6n(*1R2I>?fY3UGS`{IgKmsHZ7YGPyECsAmtu-VgL`Wtk14#fiK~O3O1GjVFeIX4E*^F#FeMj_NC*8wr}|nYZgy6a_uli52A^l@ z%wrX2T{9bjs0zfF-+MT?=Ibj!SUz{pdH1ZQY{Tuey53bqSLb9kxuogUhJLqQjZsA% zleX47sv6R2dSqocvJB>s!|lA1E=73{ZC^9zh;eh}t<>snD8n#6ul3oBq3ib_5fW<% ziCX()UDmli#(`E&{>6z&T7cC8w6dvhAgRJc&u;d~zR=M7+q$nhvg-RBl6BLSbulNq zw&`vS3_jm*vdd+Mo|e-Lug7p0nRiKctEuGdCUv#z-F+Wp_BrRkkjb;QKll*;bS zm8RWwy@0QYINlMEf5|P=ATKw4dc4CnNeAL9qK+ADl4@m|E_ioi`So8W$g1`>m{rxi z;?p&>FmH-ih>*POTtq*ZH+uWqR{O^|7w(i@f)v}2_=K|)Q?p-V2RdWU2!DZ|iy z_mQ6Y>1d^)Z;bHLq7_P%Mt2tp1n~QPrtN%i|n9GYpFen;{5r|l%0c|}A z67X51Rdf!_5eFi%f{-K$5|Okbl9v?6WAI4}7eM}Urd%i%A{ZBv3*$vnrkq9M^3iC7 ziO(&|6cY3bg2k~&i!C=GOU^)4fQ%aiKM z^!8%HF!Xwm@N5$P24*-r_;oHkVv%AoOw6QEWHK39=1oQ=F%&9;!LVp}d3oXpPpLwL zapj&OsoRJG82)MUX|28;vGlED~Pn-z^BmZ)8PM@~d{pJXA=LbHx-Y8Md@E z0_1T18!8mOK})f4Tfq>7X!a=lPZyz5jjZULdgW$z% zdY~VjiZ4P^r~g1VDwsO zqw2lp@<*?QJ}Q@j7eldZ>_0YoWC?eVW%|apc<{#fhzNJP1h+L|_~p=x=g*!FKKb+U zAHP3(_+a3-Uw`@eryqZ~fA8*{{_k&_`+9HnbenG8=<2+F?dp{dJ~J9lhPPurHNQf}R{IVCwsA(tg4U{c8@F)9+q$88kE#%w_NylC$F z&)0pncFm_zt5uz1nJ1uXyhOopGY51r=ig}+i{ zPmg)-bLY(daMlNIBv)wW`|r6p&v0^_K5gohcPCGBm}qZjYcpZ|IO})D6318(0C0Uu z#Ls2G!}2M#{4c?{VGxs`Sg8sdOR!p}TblP^WnonEoZB58fvQyEglQfjXVeip-96{X zPmFQ1^;n&=;-24lo3?Kv^Yfa&U!#3=ZLp2S@au0>8JJ+VBE^W)R%h<3}`GF1FdY&d#nccKX zU2IRuw2g9YYjpNbNgs4De6h^QeHYZDzFr*hZq%uQ<4%oFh(tE~eMdF2G}JlDI@TX* z>arWpNH>S5rxKKQ*A9lInCBINJkN1PVf2<1p+`nTkb=Ll|V+i8_ob75Lg6USoY|PboYE~(5Xj5*n^*gF8 LodPdg1m^z*g5@fm literal 376 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1IgWd_Fj7M_G{R}1CBkLw_JJn z>DQmab*CL>?Ok)>!PFzy{Acg}|Np;3*ZSPGC!W6l5w&pt&tHEg9=P)1$FJ6%7tcO? zWxgW&B*^ZPAirP+hi5m^K%69RcNc~ZR#^`qhqJ&VvY3H^TNs2H8D`Cq01C2~c>21s z-{R(FQ&rw_X(1C(sL|8KF+}2W>G_L%hZJ~NFD#lIs%=oPMZxdy|Meo%9>~ox&zv>K zB$L~r*j87(8A5T-G@yGywqOA)@^N From 9fdd378687507774d4ea6a6aaac8ab2253bc573b Mon Sep 17 00:00:00 2001 From: David Beitey Date: Sun, 4 Nov 2012 12:25:02 +1000 Subject: [PATCH 0140/1975] Add Google+ social icon --- docs/changelog.rst | 2 +- pelican/themes/notmyidea/static/css/main.css | 1 + .../notmyidea/static/images/icons/google-plus.png | Bin 0 -> 527 bytes 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 pelican/themes/notmyidea/static/images/icons/google-plus.png diff --git a/docs/changelog.rst b/docs/changelog.rst index 12d6d278..346a7176 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,7 +6,7 @@ Release history * Improve handling of links to intra-site resources * Improved appearance of LinkedIn icon in default theme -* Add GitHub social icon support in default theme +* Add GitHub and Google+ social icons support in default theme 3.0 (2012-08-08) ================== diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index c859925d..29cce82c 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -312,6 +312,7 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} .social a[href*='github.com'], .social a[href*='git.io'] {background-image: url('../images/icons/github.png');} .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} + .social a[href*='plus.google.com'] {background-image: url('../images/icons/google-plus.png');} /* About diff --git a/pelican/themes/notmyidea/static/images/icons/google-plus.png b/pelican/themes/notmyidea/static/images/icons/google-plus.png new file mode 100644 index 0000000000000000000000000000000000000000..849849b8149b3f451c06069ee31d3ccc422b5b9d GIT binary patch literal 527 zcmV+q0`UEbP)upIAVz}dFal_O6CT?`r$qdZe|RxF1`7_spN)-$>qSnr+Xd&<$fJ%zV2pn8HP?e=mP~$IqCyN zF1ea8{QrOcp`Xzu7o&?nk`Wo_Ihvx6oRvX8V=lcH8|%4MYopS2TFfk z6nV z5H$=ZOypN-%Oa!Ag=>ER18#9RnmB~ZuuoTRt+vb>6cqXJ>;E@hj;MlAH2|AClb&N> RYp4JK002ovPDHLkV1iYl{2>4U literal 0 HcmV?d00001 From 121bc0ad5e1b6f6556f0d70f93b3c03d8bcee1de Mon Sep 17 00:00:00 2001 From: David Beitey Date: Sun, 4 Nov 2012 12:49:05 +1000 Subject: [PATCH 0141/1975] Optimize social icons --- docs/changelog.rst | 1 + .../static/images/icons/delicious.png | Bin 963 -> 958 bytes .../notmyidea/static/images/icons/facebook.png | Bin 300 -> 202 bytes .../notmyidea/static/images/icons/github.png | Bin 360 -> 346 bytes .../static/images/icons/gitorious.png | Bin 3675 -> 227 bytes .../notmyidea/static/images/icons/gittip.png | Bin 671 -> 487 bytes .../static/images/icons/google-plus.png | Bin 527 -> 527 bytes .../notmyidea/static/images/icons/lastfm.png | Bin 980 -> 975 bytes .../notmyidea/static/images/icons/linkedin.png | Bin 2159 -> 896 bytes .../notmyidea/static/images/icons/rss.png | Bin 896 -> 879 bytes .../notmyidea/static/images/icons/twitter.png | Bin 835 -> 830 bytes 11 files changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 346a7176..9407d4ac 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ Release history * Improve handling of links to intra-site resources * Improved appearance of LinkedIn icon in default theme * Add GitHub and Google+ social icons support in default theme +* Optimize social icons 3.0 (2012-08-08) ================== diff --git a/pelican/themes/notmyidea/static/images/icons/delicious.png b/pelican/themes/notmyidea/static/images/icons/delicious.png index c6ce246a4602f8f74e75ea8cfe9f5a00daceeb33..3dccdd848ec99fba9950e8195d4e73867ada2738 100644 GIT binary patch delta 825 zcmV-91IGNr2fhc8l7AOTL_t(I5e31$ZyR+Sz~RsR?&phr@k{KwZtJ8rq)AI+DoYGR zC_<Oerq^Ob`+NMdMNmJK})5LG*d-L6W zc^(6xSS(h?<8dRCv6pJK*-N!ry|lD=zU=6Cvvz*9eR|Y8ZGZP?(}Q5zu4Ye;Yw6U< z%$bdQs2_ec*4Ey;wYBn;5kze=d5?*!aR(Wra;~tbOQk6n6iE^S28IC;10{@PkM=_sWfibg}N~Hk+008J5K8N8Pi863TKFA4#Hh*A4LHxOMyT9w>A|jE91R@fPNF*X6Uw!$hG@H#gbvAe5wL~g-eup^rQ51og zp);b<%zv>^j{y^y03niqp-c{sG_BT_qiPrDe~O}j;qVY7MvR0=e89tT48Q~+iXe(0 z5da7Szq_*X#=c5t?5!{y68J805+M>0_z_^U^LUHy(Gvhb05FsS1cCng`k$w&UZ0x| z0uQY|E3Pp}ktUY9r? z14j_0@d5$B_Z=+DVmR~|IWB$}mM>H*v$|ft{9t3_8G-9yY7Y#LsVRkJX3(iJpMCzF zEX-G(o!tYKB)aGO!M}TZ8^dBTeR$)>Cv9!p_HOg)(${Nmzm=^2eRt!qyLG(s`nCRG zm@*E1KbX?WJ$-q;+RNr<%sY4f7_?eHhX4RqE;sleG7W{b+8`d-UX>0Lw_Sg01_C6gQ*jEVV3R?>>)IFTt-owgqb9j7)Y+P_(Yqg0SFKiMFKz~ z0T7c(3$0d27zs!15W*(uoXg13IK8w{K9ir-#p0L)iZ~7c1H%A_fFee`P4j_+GV@s3 zeN@hYNJu6XuAgM>Z}pDO<&u2>rBW}f(As+j{V8H)V1ExhkV6P8z=FJZQ)jk*(+39! z_g7b!7rI@Kjg2Qfe6WUX2W&q4m9>AbkbdcF>N7oxr3%(~flSKebasN)?kzQL-rD7r zOZ6X4m**v)zbsG|$Ot3_kjmLb+1wTp2}Q&gk?16geEG#E(r7f^)S2wL*J3H-dM%>J zLs0-C`hWI-dLzqBEdmn22ndiE43%JSU$eTpZma6~=^w+;r{CWLi4Y?u6c2E*ZQ}%n zFg$iFCol26_QJv&J1Uj7)`Osr?>R(qh=`Bxg@DE8qjlQ*k548&CJm(kL7=<5{Kt{1 z)uzUM-$iSUNQ8)g(punocZ59{0-$vYtxc3+0)Ga*Znt>#>NQL6>^u&#**t!5h^fGJ z+eFb2*oQEM>mN6Jo{edm^!qLY+rbNh(z!}`QrBu1@2{*p#dmBH+6BX9Y)oM$(&%J~ zPe1!sW~M9l=GLx?W8LvQ|DWycm42a++Pi-J147KiQBh-@2#%>6#Rd*OBd_>2Qm$Xwckl|rT_o{07*qo IM6N<$f};f1{07*qoM6N<$f&|Zqx&QzG delta 312 zcmV-80muH@0_XyeIe!{SL_t(I%cavXOG7~r1mI7tQVD`pKnMtet(9Qw53my<5J+WZ zYwMq|wGsp&U~3x?1VISc*%<5sBBYRr5}Ogu_>u@N9PhZDnZ4b)w_tj#VKw^!`u-RP zxW^c;S>v1?%p%rsi6M@#QRLQhHVmd#CD1_^dm&V{v>QyP>VMkLSjJhd+{GPw`HpcC z%+q8$_h@H-9&pt<52hUssAH7AR`D@IV2sURN2o8N5sTg;wlv43m0fQ0@|NsA$KGRG9003f1L_t&-(|ye`5`Z8K0Ko$# z3IP-G|9`cS8ED+{nj_01Be_koAnlp75qc?o2`=J4p}Suqmq2^}LK)BUG$EY#9zOeh z21r&_4>(k-B_NrZDX5wKgt~2Y2}1&6nnZ{!;tLK&3GEfRNsIsh002ovPDHLkV1iD^ BTdx2B literal 3675 zcmeH}_cs;(AIIM!du1jmd)(}q&As*>mwP2~txFP0S<$suA0ydaQQ0fx>V~qnD`Z|H zDsM1YRfBtf8PhSR$Jg1$Z#Z(m^oWl9R>38%Fr zV-o!|&8oo5l;~FpNdreqVXu59TS#ArPaCJS)~oig4I?ydw2WCs3f4*(#&YPD3tysp zyLy&ZrFA0dh5gU|Zg3a4e&2NdXtJ$6v<*278zrMgbh332;&r zrUQOx5VdKotgD z`hA5QR(*4vZDlM6DVAhkU}Z6+_|xb0_{drY{|m>{Rte_f~M(8MshYu zaDF=@zFp0G=Tzfw8oWz^vUSY}hTV7;tYWO}x%9@qin2NJ zz-^>1h>9&zzl~0rDhSGtx}s}@G(%cU8$HTuwl1u5UTNv!XK>?b2$mG^VXBOK5UJE9S~ooN=pm#z z=Y+30S+kBG1X@TR1#Igi$iJ}=^&f}&} zMOJneveKy1y3%l~Rk>!n6kF1&-|TP{$*kLJB6d^E5S>amk6pK&v7IlaFXb}VR6D4V zuJ9@5Eo#;a`gpf=C#T@UElh!#U+F?f>-wL|;W8)i6W>3j2ZoGD>IOz(Y9b@yqDHq; zfS(4ROfT`LHO#3~2Ud*AL}f31fDf#vM_57*)#U_^`9#`UW=N*s1@ zEq7yYs5%rQ?QS?V7*u1cMJAi8n@ca0;w>^PDhnpjoo{~P`f=q=Ja5*fsfjf>UtBl} z?aGaA>aOYB$!N_8e;@wOi6#wG{0ws?-wnQq`)}`YsM)J6(+pxFMPwjlUngmyn!j8Z{`LttFk$+cV$Sx@r=55a6^FI(C4~Z^-Z1 zE+f|NDDQah#LvALQhXs%;Gl5-Q)eISi}l*5Hp7cdS)awK2uqk{B)V~3NXAVj9Z@~? zrl~lnf`t0Pt@TUm-isBj6%CaI`2`2(A(ghKzNSITPQL=@*hSc5A+kF;lspPbF(MRb z%EUZV3jN3FG23wZT?PpcLnt>+NZ3Es@H zRuSJOKhdDRqLMo!7{y}aV-a!MDgFt_OQUkxN|4l`e}Mv0JK8DJOhW`M1S>s zI9TNoTYuVpH@QjXN+wOePeWSOc?T(a9JJ&c{D$}xgr*+tf$;n|oH(GGRatOtczdW} zfS9K8{KpIOHd_bV(ob7dVMnDLWeueY=wK#j~DvftZIEe3rW#u*^ zyC$MlG}PQD@>csmRC^k8}B#pF?a6S+w#gTy!(jfnCHgV1*rl@=B$eBui4CZnPz6+GA-J_-9GrGPn5|X z7AH1G<6!t#A2r^!c$D@NhSjyS)ZyLH9p12(Uy9!+h>k6!6RrLa zL^}#Q^9j!hk0axw29kD7V#UT`){(DMwS{lMb}!`^iFJrNNaR*b0PHDka(5lxuS+ch{+zj-+Oi=YCHqIJMsjZi4BjC{ypbHe2EKN zcOxv`X7T&+o;7f3OrM;*uHK?fxVif-aJQbg#*TQ0$g5Rz_T3EJ)Hux;x9n|x-kev1 zzv+YD32ki*^CWHX7N`*B_gh1La*-z|3RE@cTlYf!NZq7^MXvdXdtxVq!RDDDv7PD` z%NFN-oo(G2*nIqiw&UsC^pCm6x7&gW_eSRoNz}2?Bd6&HsVuPbsky0xaZGVr1=qDy zRhPBzoopPJ!baRjL<_i2U!D%uaC6B-98PRa5k_-Hi?VmKGd}u0Dn8k4+v2Gu_H^`I z`OqJ%Aa`ru{%E^BXfBBF$E!sa%hgBxkHyJezv~WcKb0P3@ML6=sVH;yj@=Zbh-ZD1 z-_6Lz9Dq;}05H)2{3f6I1^^Fa0oZf_KrIIVZoj9_-39ZfDh7YjeuipAOblqHnRd;pX1guKpVP^?KjrDZl!Lxy>?erb8ta^(jygszj+vLaYB8AoV>@2=0&gbI-vZ)aP<#t2rh=>% z4uBFcLlywp|AF`)lt#v2F_0Q$J;*j+Ou*EHfuU+HqPPTPDok^%yZQe}XCt6Z)(A~N zcBHfM{}?w@xFIl?fc=bY!HpjbZD7OVJuUzD)PENK|M2eZ|NFOZ{Lct+ zMRt)212k~{fo$2ZY~Ftm`1kK0n4Zi?_eO#`O~^wbDXNGM6!8_gwN kRAy|1D^$uYJUPBNklU>nq-!*wY* zC4;*|6YMHgDyXOh9jsz9Dcv*)g5V+u32`wNycWSfXg96&Pc%sJPsJj(q|NJ)yLbsY z`3(p6eb4hgcfWg1@K!3}kT1EUlTM$io)M8@AnF}2scJ<;GJm8%(5kUR3z*0a|DdbCT%J)bh`HezbnMuVYyTyDN+~Cl&G~Hznz$(+AA^3FB9?L}LfIfBP2G<%bw!ICx}`(bE@M z{rZ{f=TEY+{(sAt$E>NMW)=<^fUQ?r}wsXW56LcT0&f`n_;MP5C7>IHPrSLNgK0)H=Or`z@ou;ky^b{A9EE>W*< zpsHOAn;FBaOK-k!D!Jidayc;Y>7GYGxnGBxue+IChM|)V`ar=`j`~3MC07%M z|NqZF^fS8TVssIRJYwIy1j>GXU1E8{UJs6dLU1-v!-3nb2Irih=+=L-`#|Zhiy}{X zTK>ldfEu1WO3*uPuXoB0gwD0>0$DLL_=vSO905gOY#oOGfB%15pLN1U=NK4Wm~r9% zuS<7>p2gj z|Ns7fcvN5l=Hf&Q2TWAA8Y*uw)IGcL#s8oG|NprApwtO0f*moOZ=3pP|AA*4mpxds z?D5G5|3E?a{$*F_7JbEysAvP2Wca$b=a8HFI$inoAf$Dud+Sd3Um!hqlXccZ1)&I{ zhT(*X{3>l(WVE?(?GIqUEe=N$haiT1x^io^W!9je$cJD5zv*&ZgDwt20Gm6Lp2R#O QHvj+t07*qoM6N<$g1pf14FCWD delta 474 zcmV<00VV#A1djxeDgjfGD;a;)097*F^02#8Kk4J~li%L`{SOBpuDq)BzUFQQM5i4L zfWl`S4T0>dZe|RxF1`7_spN)-$>qSnr+Xd&<$fJ%zV2pn8HP?e=mP~$IqCyNF1ea8 z{QrOcp`Xzu7o&?nk`Wo_Ihvx6oRvX8V=lcH8|%4MYn&J-3Lm4T@-oB z(-O$Q1V9Z>9wq3Vw%0pl2SVpsc7d#z8GOWA8;*b?Ft!fE|G)pgt(zvX9zmGkpC9)FZ)pWfViR&9IGN)wLuS!w`P z?6uH1V5td23@3u)Zq9#O@?zKC&+mZZ-(S?*?KM;1gM@aOszDG$km0bo`VJG-9VWp~ z-u(af|HGpK6EGJiVmM%;y46s5i=pn>jW7QH{Qv*Q-3O&kU=i$y;e6ZFNBa*v+qmq( znq`kqKKKU;$oDV1LbvEEZbU^Jz+8r}dwUMKsjt(OUk^fBhq_L;e*Xp1b2nKBEP_A~ zH4GkL_t(I5e30dY!p=-!13>U^LF-sk?xk2w$KnZDpdlBD2Jw1Np_ZC(a~^^ahDtECA8NxevjB}{B#LnDPOMcfyN(rj=^z~3 z2O_Yt2K5OzdI(zU@cdrbH3rM8$TM|ltYGKw6ZLx)Bb}hk;TK`3g#G3RbhCvTq%b-H z?;eBtPH47Z`v~duFZ8bbMlqiy+3b;&eXS#G%&u|L*?$F+pKqWt2HRdIz4#;U<{WZ( ziryFJaSs}pQzyy2bDX&Gh-jsS6Jp)^{nkJLy<Hd0y}`_qa!RHICj0UZAyYm(;_00EH@>X`%6+0`S0z|WaY#sA|m28 z0ud3hQ7r$wc}nK9lk)GYCzrgBcRu}**NtlZ@2`^FxrZ*7P@OK_Gv^4WuhCyvMCbG9 zu@QRTU1jz38G=75s}(L|(1{~ks}OsRK^S6; zhghpkeqyxIyZ!Khmqh4X7HcgOGnjG#Rq*k&#$^QYJS5TB)*8AufZA5n#P}uCEoDDX zoW9jPQAVP8n?&(2j;iX1Rc%xbXN~H#%WAB8&##Sqsc>`EPd}XbAE?ij UbKRwmQaM~w07vUoteIwd2imk z_wS;{)!F=V@=K0d`SQ~4RAc>Jzg&7z7xM*eJf}P}Z4yc($$#T`Y6V3DkqB#7NqIdo z{u)VACv7enztKE9;QI%OV_01WtpRxqKLwrv*nxB494G~G0uD%GoN~8KCQcq@qym1L z|A%pcI1A39lmY;eP2_SY08;A5;cmdLC*^NEqUptw^g(dJQY^ z!T~t2ck}A<>Za((L1?VOvwL9Y2rR82PgS9|jGenj*zJ^zw1Ogso`-<~_N(vE^#-b+ z!0-^feH5x=P;bEYA(E+|=v@AVd^SzI(IGDST8G$(oqwYwGxNkhUPq-2wz)=f;d|VT zS>(_pozKqU?$^1O zwke!?hkrN<2+o|_OuFX@0^5iB!^14>KYFdUZBl}ZQz9Y~FV!WO{X-HF`RC0~Wcm0< zA|m3}0}&CiVI+UOep2Sr6Y}@VCl9h2vuF{=f zKxeb)ks&(YTw&$ZX@cKwqRS<6yG9q(ou^-&E`NryPkS1>(jwYuW8(-fmqk^|*u{F}A1Yf>O?w*+yx0CTqhbhrm|xBzvz1a!FqcDf06xd(T; z33s;)cDV|7y9#-^3VFK@c)AREx(#`{5P7-@d%OyJybgN24|=>3db|^QyApf54}859 zd%O~SycB-F6oS7Mg1{Mpz#M|W8-~Ilg~A_(!XJpjA&SHzio+v{!z7EtC5yx+i^M05 z#Vn4-Esn-Ak;gHT$1;-0GLy(NlgLGp$T^kDI+e;fmdQGn$vT$GJeSHnm&-hv%0ZaR zL72=xnae?$%tn~XLYmA%o6JO<%t)NhPo2(7pw3U9&{Ck$Q=!sTqR>>M(N?3RCuhwv{ z*>JGebFkNQvDtL7*>thmasnF-F(C4es=&jS~wAARd)#bKVFwb$yn*z3L7 z?7rLWzuWJ^-|oob@6YA&(B<*a=JM9)^VjM0*y{D#>-FC4_2%;U|Ns9Oj;1#N0004W zQchCpR786}b)xDJsVI4<4?fY3UGS`{IgKmsHZ7YGPyECsAmtu-VgL`Wtk14#fiK~O3O1GjVFeIX4E*^F#FeMj_NC*8wr}|nYZgy6a_uli52A^l@ z%wrX2T{9bjs0zfF-+MT?=Ibj!SUz{pdH1ZQY{Tuey53bqSLb9kxuogUhJLqQjZsA% zleX47sv6R2dSqocvJB>s!|lA1E=73{ZC^9zh;eh}t<>snD8n#6ul3oBq3ib_5fW<% ziCX()UDmli#(`E&{>6z&T7cC8w6dvhAgRJc&u;d~zR=M7+q$nhvg-RBl6BLSbulNq zw&`vS3_jm*vdd+Mo|e-Lug7p0nRiKctEuGdCUv#z-F+Wp_BrRkkjb;QKll*;bS zm8RWwy@0QYINlMEf5|P=ATKw4dc4CnNeAL9qK+ADl4@m|E_ioi`So8W$g1`>m{rxi z;?p&>FmH-ih>*POTtq*ZH+uWqR{O^|7w(i@f)v}2_=K|)Q?p-V2RdWU2!DZ|iy z_mQ6Y>1d^)Z;bHLq7_P%Mt2tp1n~QPrtN%i|n9GYpFen;{5r|l%0c|}A z67X51Rdf!_5eFi%f{-K$5|Okbl9v?6WAI4}7eM}Urd%i%A{ZBv3*$vnrkq9M^3iC7 ziO(&|6cY3bg2k~&i!C=GOU^)4fQ%aiKM z^!8%HF!Xwm@N5$P24*-r_;oHkVv%AoOw6QEWHK39=1oQ=F%&9;!LVp}d3oXpPpLwL zapj&OsoRJG82)MUX|28;vGlED~Pn-z^BmZ)8PM@~d{pJXA=LbHx-Y8Md@E z0_1T18!8mOK})f4Tfq>7X!a=lPZyz5jjZULdgW$z% zdY~VjiZ4P^r~g1VDwsO zqw2lp@<*?QJ}Q@j7eldZ>_0YoWC?eVW%|apc<{#fhzNJP1h+L|_~p=x=g*!FKKb+U zAHP3(_+a3-Uw`@eryqZ~fA8*{{_k&_`+9HnbenG8=<2+F?dp{dJ~J9lhPPurHNQf}R{IVCwsA(tg4U{c8@F)9+q$88kE#%w_NylC$F z&)0pncFm_zt5uz1nJ1uXyhOopGY51r=ig}+i{ zPmg)-bLY(daMlNIBv)wW`|r6p&v0^_K5gohcPCGBm}qZjYcpZ|IO})D6318(0C0Uu z#Ls2G!}2M#{4c?{VGxs`Sg8sdOR!p}TblP^WnonEoZB58fvQyEglQfjXVeip-96{X zPmFQ1^;n&=;-24lo3?Kv^Yfa&U!#3=ZLp2S@au0>8JJ+VBE^W)R%h<3}`GF1FdY&d#nccKX zU2IRuw2g9YYjpNbNgs4De6h^QeHYZDzFr*hZq%uQ<4%oFh(tE~eMdF2G}JlDI@TX* z>arWpNH>S5rxKKQ*A9lInCBINJkN1PVf2<1p+`nTkb=Ll|V+i8_ob75Lg6USoY|PboYE~(5Xj5*n^*gF8 LodPdg1m^z*g5@fm diff --git a/pelican/themes/notmyidea/static/images/icons/rss.png b/pelican/themes/notmyidea/static/images/icons/rss.png index 7d4e85d981cbecb04b76dab5a234dc4690bd15ab..7862c65afeb66ba9cc7e9576a3a62b850b2e184d 100644 GIT binary patch delta 745 zcmV(%-GyYSq$rgqMYKkaS-FvbSn$Jl_*=W(eMC&poDl`J)JE%~!DK`*EMrc$FSLQO^8wa$m zGC9wK$0%|-i+>cWv@WxDg^@ApiX=q=$&o7xCAqD^v z#6g|deBW*3JH|&y~+ElCyQ-AY3ev(6%g(JTUw-+U69u>2XEnzC(V_9^w`BzdLGqpGA|C0Rn+wz0^j z?cy_E@qbEgm}IP;SMGdOw~NjdX(KgEX5{O{I!aTrI2>doH`Iu=Pf60i3vdvDqoYn>itk1VAcp^W5xI@5cu zZ9A~AKLF(C-r5t&Td&v6>o10~v()W06-6~$6!EUQv9*lprj>4|c_*3L8?xDbpUod$ bI0gR$D~Vu?3V6ai00000NkvXXu0mjfF-~l$ delta 762 zcmVF%oP zx>fhy6N_AJx&I-|9nl*0}t+<%LSXEBX}Vzi2I7Kv^W z;wr62&dFo%tO|ghKfXlx;caS7kSQn}gc5uKM1Y0#DrD;r)gVhjK_5J^7=@ocI3Tk8 z5%t}mEf}srF@$UllIxKE3FB2D1~Ut#1p-(_e0o;|y@!7FBwTm}-B?BeC4#3vgZmD_ zpqx-eL6l&@h5DLNDl25yCylorLPp;rpYBJ`bkM<-$$zy&XJKv+*c=oPA>^RdcGocO z^|4z>a{(Sb35%DIBflaWUCfz>QFjZBp}hMA+!o*!5JCWhI3vLdv-@E4JLJM)^p8{M zwgoua!=+>7`_};|cRh#oK;+RvNi2+$zuQKub16jv51d?zwBNAdUx{4b}$ zji|JrAb&I(ka=9Dcn7&Rv4LpBpbOJG(WkzEmoiEdL+?Cp{$NG=mqBT6$zwgnoL zD1unaA_jAf0BAr$f;BUY^O)xHyVy#H`VN6Xm!#iE(@oTXAczN*+DQD*r{~SZW8IMD zh;NZ=gk(KxxgkivbhhKSa{HdFQ5%gFKObr@3Z$_>;3yYcI!BQ-Z@vtk;_|^ zz1*Sk!tr26WmpXvvlgk9v@&P8apqm--o=q_*;oJOuB}wPzkg>OM4=Sf#+U(5Bx-{p zAVDV)UEr|6I9l4TVN>*AT!V)~z?jI`0uF&gcN!OS!6FwnMRbC?j>J0fbfcZnIh6;| zEAd*2JnG<+zu?;$?8m^cI4`=ww0G9U$$}nu(!;9JaU!bTGUvP*5cp{dKc2$19rz66 z!z$2VG(?WFGk;Ye0l9$TIc3Rr%sC$-0`9M1djS7sm6dMx^NjG z5K~vAPQndZKn52A+?~OvYd9(Jtb+;g!y&vqGHw@WidYqPgULIWu`J@Gh_eg{NEse3 z;du+e#HqxIg8|zHjRUAnlS^h8jI9{BG64bGL3}rZ z+e`R+yYoLZrHhp#%l(i50000W delta 701 zcmV;u0z&=12EzuBl7E~@L_t(IjV+Q(Yh6_wN7sMveeN?&Oay6a8y~5lSn5EjLp!l! zK|hT%{R~bz>rh0{VWlAAKoG$W3bptEZD{(qO}y`O&pCVle-7gM0Bf?A-8#;nw$9a2 zkf<-QDif9GBUL^JcPd3^K zty6grof5C4$io&s`V+pM!F~)3iu1fJOgm>?oGj>o#~rL{9VeoCTjrcM0|MVq;ky&K zwgaDFyk7-sjDMQQQFf*ZBp??sJf|%AjydN;M8LfjZ1>^c3{%11P2f=julL}cVdOU# zCoWt@2*lJDsg-bp29Uvp06)**<26hQJZ)hN+&+XihsK=(brGw=ZZLW4GL}V5ia5=X zfRy3E5}q{>Oq@te91Pets2xB}8dVevXT}5+hXTwUZhvgS2fOez8*dN9dt-6WjkSOx zqI8lZby8$e#HGsFt|IeRjDqpmML6j5KgJ&}?sjk?L0=gaEkZEWxnu^x*ouKGV-T<% z#5XgzvxIM_;z0uk!Pqr1>k3VF%#~A>m=_FUVuf*a1bYTq;^qW4X5|8(RTp5d_#;6^-&RG@sYwbL2;Btf=oN0Dqut8cCRb!xa zcvQpwIpgz7;={3%F!qOmA~+lvZ}ebJVO_6zvZ)wi`zafv1+W*5)6V&IVZ1stZoD8$ zDfE+3aaQKXnRCA`oR%KTR?Ihk&AxiJxc+;NH#P^(*qd(IxJ+P0D9ihsLIrY@Suq*| j?ewZ?-D&cY*-!rgG^LA`I>-QU00000NkvXXu0mjf)N@7! From 528747684d171287cdadc5513a7f03d1d05e4786 Mon Sep 17 00:00:00 2001 From: David Beitey Date: Sun, 4 Nov 2012 14:08:58 +1000 Subject: [PATCH 0142/1975] Split post content on all types of line endings for adding paragraph tags --- docs/changelog.rst | 2 ++ pelican/tools/pelican_import.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 6cea6d93..4ba292a1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,8 @@ Release history ================ * Improve handling of links to intra-site resources +* Ensure WordPress import adds paragraphs in for all types of line endings + in post content. 3.0 (2012-08-08) ================== diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index fc28c6a4..bedd07f0 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -236,7 +236,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=Fals with open(html_filename, 'w', encoding='utf-8') as fp: # Replace newlines with paragraphs wrapped with

      so # HTML is valid before conversion - paragraphs = content.split('\n\n') + paragraphs = content.splitlines() paragraphs = [u'

      {0}

      '.format(p) for p in paragraphs] new_content = ''.join(paragraphs) From d0f5875f66b1a80b6011aeb626bb4ebe430ccdd0 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 22 Oct 2012 23:04:25 +0200 Subject: [PATCH 0143/1975] remove the LessCSSGenerator and the related config option --- pelican/__init__.py | 5 +---- pelican/generators.py | 46 ------------------------------------------- pelican/settings.py | 1 - 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 804fe5b4..443d330b 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -9,8 +9,7 @@ from pelican import signals from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator, - LessCSSGenerator, SourceFileGenerator, - TemplatePagesGenerator) + SourceFileGenerator, TemplatePagesGenerator) from pelican.log import init from pelican.settings import read_settings from pelican.utils import (clean_output_dir, files_changed, file_changed, @@ -177,8 +176,6 @@ class Pelican(object): generators.append(TemplatePagesGenerator) if self.settings['PDF_GENERATOR']: generators.append(PdfGenerator) - if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc - generators.append(LessCSSGenerator) if self.settings['OUTPUT_SOURCES']: generators.append(SourceFileGenerator) diff --git a/pelican/generators.py b/pelican/generators.py index 01f4701c..33d0ff20 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -571,49 +571,3 @@ class SourceFileGenerator(Generator): logger.info(u' Generating source files...') for object in chain(self.context['articles'], self.context['pages']): self._create_source(object, self.output_path) - -class LessCSSGenerator(Generator): - """Compile less css files.""" - - def _compile(self, less_file, source_dir, dest_dir): - base = os.path.relpath(less_file, source_dir) - target = os.path.splitext( - os.path.join(dest_dir, base))[0] + '.css' - target_dir = os.path.dirname(target) - - if not os.path.exists(target_dir): - try: - os.makedirs(target_dir) - except OSError: - logger.error("Couldn't create the less css output folder in " + - target_dir) - - subprocess.call([self._lessc, less_file, target]) - logger.info(u' [ok] compiled %s' % base) - - def generate_output(self, writer=None): - logger.info(u' Compiling less css') - - # store out compiler here, so it won't be evaulted on each run of - # _compile - lg = self.settings['LESS_GENERATOR'] - self._lessc = lg if isinstance(lg, basestring) else 'lessc' - - # walk static paths - for static_path in self.settings['STATIC_PATHS']: - for f in self.get_files( - os.path.join(self.path, static_path), - extensions=['less']): - - self._compile(f, self.path, self.output_path) - - # walk theme static paths - theme_output_path = os.path.join(self.output_path, 'theme') - - for static_path in self.settings['THEME_STATIC_PATHS']: - theme_static_path = os.path.join(self.theme, static_path) - for f in self.get_files( - theme_static_path, - extensions=['less']): - - self._compile(f, theme_static_path, theme_output_path) diff --git a/pelican/settings.py b/pelican/settings.py index 35752fee..fa58d8b1 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -75,7 +75,6 @@ _DEFAULT_CONFIG = {'PATH': '.', 'DEFAULT_STATUS': 'published', 'ARTICLE_PERMALINK_STRUCTURE': '', 'TYPOGRIFY': False, - 'LESS_GENERATOR': False, 'SUMMARY_MAX_LENGTH': 50, 'WEBASSETS': False, 'PLUGINS': [], From 5f51cffe0810c0d450c1dcac2288b5da6a0f38fb Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 22 Oct 2012 23:09:59 +0200 Subject: [PATCH 0144/1975] update docs: remove mentions of lesscss compiling and replace with webassets --- README.rst | 4 ++-- docs/index.rst | 4 ++-- docs/settings.rst | 5 ----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 018f73ba..b2648bf1 100644 --- a/README.rst +++ b/README.rst @@ -27,7 +27,7 @@ Pelican currently supports: * Publication of articles in multiple languages * Atom/RSS feeds * Code syntax highlighting -* Compilation of `LESS CSS`_ (optional) +* Asset management with `webassets`_ (optional) * Import from WordPress, Dotclear, or RSS feeds * Integration with external tools: Twitter, Google Analytics, etc. (optional) @@ -62,9 +62,9 @@ client handy, use the webchat_ for quick feedback. .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ .. _Jinja2: http://jinja.pocoo.org/ -.. _`LESS CSS`: http://lesscss.org/ .. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`#pelican on Freenode`: irc://irc.freenode.net/pelican .. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 .. _contribute: http://docs.getpelican.com/en/latest/contribute.html +.. _webassets: https://github.com/miracle2k/webassets diff --git a/docs/index.rst b/docs/index.rst index 3fc1cf9f..fd99b449 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,7 +23,7 @@ Pelican currently supports: * Publication of articles in multiple languages * Atom/RSS feeds * Code syntax highlighting -* Compilation of `LESS CSS`_ (optional) +* Asset management with `webassets`_ (optional) * Import from WordPress, Dotclear, or RSS feeds * Integration with external tools: Twitter, Google Analytics, etc. (optional) @@ -75,8 +75,8 @@ A French version of the documentation is available at :doc:`fr/index`. .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ .. _Jinja2: http://jinja.pocoo.org/ -.. _`LESS CSS`: http://lesscss.org/ .. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`#pelican on Freenode`: irc://irc.freenode.net/pelican .. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4 +.. _webassets: https://github.com/miracle2k/webassets diff --git a/docs/settings.rst b/docs/settings.rst index 6bcc7292..ca2c7b0f 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -105,9 +105,6 @@ Setting name (default value) What doe incorporated into the generated HTML via the `Typogrify `_ library, which can be installed via: ``pip install typogrify`` -`LESS_GENERATOR` (``FALSE``) Set to True or complete path to `lessc` (if not - found in system PATH) to enable compiling less - css files. Requires installation of `less css`_. `DIRECT_TEMPLATES` (``('index', 'tags', 'categories', 'archives')``) List of templates that are used directly to render content. Typically direct templates are used to generate index pages for collections of content e.g. tags and @@ -128,8 +125,6 @@ Setting name (default value) What doe .. [#] Default is the system locale. -.. _less css: http://lesscss.org/ - URL settings ------------ From b66a37ccb1e0b69ec786c6f9a4397cc87e482ecf Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 24 Oct 2012 22:51:45 +0200 Subject: [PATCH 0145/1975] Unit tests for webassets remove the unit tests for the lesscss generator (TestLessCSSGenerator class) and replace it with tests for webassets: - add a sample scss file - run pelican with example files - compare the generated css file with a reference one - look in the html code for the correct link tag --- tests/test_generators.py | 85 ++++++++++---------- tests/themes/assets/static/css/style.min.css | 1 + tests/themes/assets/static/css/style.scss | 19 +++++ tests/themes/assets/templates/base.html | 7 ++ 4 files changed, 68 insertions(+), 44 deletions(-) create mode 100644 tests/themes/assets/static/css/style.min.css create mode 100644 tests/themes/assets/static/css/style.scss create mode 100644 tests/themes/assets/templates/base.html diff --git a/tests/test_generators.py b/tests/test_generators.py index accdb699..ba923980 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -1,15 +1,18 @@ # -*- coding: utf-8 -*- from mock import MagicMock +import hashlib import os -import re + +from codecs import open from tempfile import mkdtemp from shutil import rmtree -from pelican.generators import ArticlesGenerator, LessCSSGenerator, \ - PagesGenerator, TemplatePagesGenerator +from pelican import Pelican +from pelican.generators import ArticlesGenerator, PagesGenerator, \ + TemplatePagesGenerator from pelican.writers import Writer -from pelican.settings import _DEFAULT_CONFIG +from pelican.settings import _DEFAULT_CONFIG, read_settings from .support import unittest, skipIfNoExecutable CUR_DIR = os.path.dirname(__file__) @@ -240,53 +243,47 @@ class TestTemplatePagesGenerator(unittest.TestCase): self.assertEquals(output_file.read(), 'foo: bar') -class TestLessCSSGenerator(unittest.TestCase): - - LESS_CONTENT = """ - @color: #4D926F; - - #header { - color: @color; - } - h2 { - color: @color; - } +@skipIfNoExecutable(['scss', '-v']) +@skipIfNoExecutable(['cssmin', '--version']) +class TestWebAssets(unittest.TestCase): + """ + scss style.scss style.ref.css """ def setUp(self): - self.temp_content = mkdtemp() - self.temp_output = mkdtemp() + self.temp_path = mkdtemp() + self.theme_dir = os.path.join(CUR_DIR, 'themes', 'assets') + + self.settings = read_settings(override={ + 'PATH': os.path.join(CUR_DIR, 'content', 'TestCategory'), + 'OUTPUT_PATH': self.temp_path, + 'WEBASSETS': True, + 'THEME': self.theme_dir, + }) + pelican = Pelican(settings=self.settings) + pelican.run() + + self.css_ref = open(os.path.join(self.theme_dir, 'static', 'css', + 'style.min.css')).read() + self.version = hashlib.md5(self.css_ref).hexdigest()[0:8] def tearDown(self): - rmtree(self.temp_content) - rmtree(self.temp_output) + rmtree(self.temp_path) - @skipIfNoExecutable('lessc') - def test_less_compiler(self): + def test_compilation(self): + "Compare the compiled css with the reference" - settings = _DEFAULT_CONFIG.copy() - settings['STATIC_PATHS'] = ['static'] - settings['LESS_GENERATOR'] = True + gen_file = os.path.join(self.temp_path, 'theme', 'gen', + 'style.{0}.min.css'.format(self.version)) - generator = LessCSSGenerator(None, settings, self.temp_content, - _DEFAULT_CONFIG['THEME'], self.temp_output, None) + self.assertTrue(os.path.isfile(gen_file)) + css_new = open(gen_file).read() + self.assertEqual(css_new, self.css_ref) - # create a dummy less file - less_dir = os.path.join(self.temp_content, 'static', 'css') - less_filename = os.path.join(less_dir, 'test.less') + def test_template(self): + "Look in the output index.html file for the link tag" - less_output = os.path.join(self.temp_output, 'static', 'css', - 'test.css') - - os.makedirs(less_dir) - with open(less_filename, 'w') as less_file: - less_file.write(self.LESS_CONTENT) - - generator.generate_output() - - # we have the file ? - self.assertTrue(os.path.exists(less_output)) - - # was it compiled ? - self.assertIsNotNone(re.search(r'^\s+color:\s*#4D926F;$', - open(less_output).read(), re.MULTILINE | re.IGNORECASE)) + link_tag = ''.format(self.version) + html = open(os.path.join(self.temp_path, 'index.html')).read() + self.assertRegexpMatches(html, link_tag) diff --git a/tests/themes/assets/static/css/style.min.css b/tests/themes/assets/static/css/style.min.css new file mode 100644 index 00000000..daf9c3cb --- /dev/null +++ b/tests/themes/assets/static/css/style.min.css @@ -0,0 +1 @@ +body{font:14px/1.5 "Droid Sans",sans-serif;background-color:#e4e4e4;color:#242424}a{color:red}a:hover{color:orange} \ No newline at end of file diff --git a/tests/themes/assets/static/css/style.scss b/tests/themes/assets/static/css/style.scss new file mode 100644 index 00000000..10cd05be --- /dev/null +++ b/tests/themes/assets/static/css/style.scss @@ -0,0 +1,19 @@ +/* -*- scss-compile-at-save: nil -*- */ + +$baseFontFamily : "Droid Sans", sans-serif; +$textColor : #242424; +$bodyBackground : #e4e4e4; + +body { + font: 14px/1.5 $baseFontFamily; + background-color: $bodyBackground; + color: $textColor; +} + +a { + color: red; + + &:hover { + color: orange; + } +} diff --git a/tests/themes/assets/templates/base.html b/tests/themes/assets/templates/base.html new file mode 100644 index 00000000..13b3fb10 --- /dev/null +++ b/tests/themes/assets/templates/base.html @@ -0,0 +1,7 @@ +{% extends "!simple/base.html" %} + +{% block head %} + {% assets filters="scss,cssmin", output="gen/style.%(version)s.min.css", "css/style.scss" %} + + {% endassets %} +{% endblock %} From 1b20319074d1a187ad60e3bcc4c567429d09198d Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 24 Oct 2012 23:34:38 +0200 Subject: [PATCH 0146/1975] add a warning for the users of the LESS_GENERATOR setting --- pelican/settings.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pelican/settings.py b/pelican/settings.py index fa58d8b1..2c318997 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -132,7 +132,7 @@ def configure_settings(settings): """ if not 'PATH' in settings or not os.path.isdir(settings['PATH']): raise Exception('You need to specify a path containing the content' - ' (see pelican --help for more information)') + ' (see pelican --help for more information)') # find the theme in pelican.theme if the given one does not exists if not os.path.isdir(settings['THEME']): @@ -142,7 +142,7 @@ def configure_settings(settings): settings['THEME'] = theme_path else: raise Exception("Impossible to find the theme %s" - % settings['THEME']) + % settings['THEME']) # if locales is not a list, make it one locales = settings['LOCALE'] @@ -185,12 +185,17 @@ def configure_settings(settings): "http://docs.notmyidea.org/alexis/pelican/settings.html#timezone " "for more information") + if 'LESS_GENERATOR' in settings: + logger.warn("The LESS_GENERATOR setting has been removed in favor " + "of WEBASSETS") + if 'WEBASSETS' in settings and settings['WEBASSETS'] is not False: try: from webassets.ext.jinja2 import AssetsExtension settings['JINJA_EXTENSIONS'].append(AssetsExtension) except ImportError: - logger.warn("You must install the webassets module to use WEBASSETS.") + logger.warn("You must install the webassets module to use " + "WEBASSETS") settings['WEBASSETS'] = False if 'OUTPUT_SOURCES_EXTENSION' in settings: From d6ec9b2028a68404735cd53a1f9c40ced267e711 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 6 Nov 2012 23:58:17 +0100 Subject: [PATCH 0147/1975] update "custom" output for functional tests LC_ALL=C pelican -o tests/output/custom/ -s samples/pelican.conf.py samples/content/ we really need to merge #539 so that functional tests won't succeed if output is different... --- .../output/custom/author/alexis-metaireau.html | 2 +- .../custom/author/alexis-metaireau2.html | 2 +- tests/output/custom/theme/css/main.css | 5 ++++- .../custom/theme/images/icons/delicious.png | Bin 963 -> 958 bytes .../custom/theme/images/icons/facebook.png | Bin 300 -> 202 bytes .../custom/theme/images/icons/github.png | Bin 0 -> 346 bytes .../custom/theme/images/icons/gitorious.png | Bin 3675 -> 227 bytes .../custom/theme/images/icons/gittip.png | Bin 671 -> 487 bytes .../custom/theme/images/icons/google-plus.png | Bin 0 -> 527 bytes .../custom/theme/images/icons/lastfm.png | Bin 980 -> 975 bytes .../custom/theme/images/icons/linkedin.png | Bin 376 -> 896 bytes tests/output/custom/theme/images/icons/rss.png | Bin 896 -> 879 bytes .../custom/theme/images/icons/twitter.png | Bin 835 -> 830 bytes 13 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 tests/output/custom/theme/images/icons/github.png create mode 100644 tests/output/custom/theme/images/icons/google-plus.png diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 55dcebc9..c64aacb9 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -199,7 +199,7 @@ Page 1 / 2 -
      » + »

      diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 48e2ef1c..53f001fa 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -218,7 +218,7 @@ as well as inline markup.

      - « + « Page 2 / 2 diff --git a/tests/output/custom/theme/css/main.css b/tests/output/custom/theme/css/main.css index 3d94200b..29cce82c 100644 --- a/tests/output/custom/theme/css/main.css +++ b/tests/output/custom/theme/css/main.css @@ -309,7 +309,10 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');} - .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} + .social a[href*='github.com'], + .social a[href*='git.io'] {background-image: url('../images/icons/github.png');} + .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} + .social a[href*='plus.google.com'] {background-image: url('../images/icons/google-plus.png');} /* About diff --git a/tests/output/custom/theme/images/icons/delicious.png b/tests/output/custom/theme/images/icons/delicious.png index c6ce246a4602f8f74e75ea8cfe9f5a00daceeb33..3dccdd848ec99fba9950e8195d4e73867ada2738 100644 GIT binary patch delta 825 zcmV-91IGNr2fhc8l7AOTL_t(I5e31$ZyR+Sz~RsR?&phr@k{KwZtJ8rq)AI+DoYGR zC_<Oerq^Ob`+NMdMNmJK})5LG*d-L6W zc^(6xSS(h?<8dRCv6pJK*-N!ry|lD=zU=6Cvvz*9eR|Y8ZGZP?(}Q5zu4Ye;Yw6U< z%$bdQs2_ec*4Ey;wYBn;5kze=d5?*!aR(Wra;~tbOQk6n6iE^S28IC;10{@PkM=_sWfibg}N~Hk+008J5K8N8Pi863TKFA4#Hh*A4LHxOMyT9w>A|jE91R@fPNF*X6Uw!$hG@H#gbvAe5wL~g-eup^rQ51og zp);b<%zv>^j{y^y03niqp-c{sG_BT_qiPrDe~O}j;qVY7MvR0=e89tT48Q~+iXe(0 z5da7Szq_*X#=c5t?5!{y68J805+M>0_z_^U^LUHy(Gvhb05FsS1cCng`k$w&UZ0x| z0uQY|E3Pp}ktUY9r? z14j_0@d5$B_Z=+DVmR~|IWB$}mM>H*v$|ft{9t3_8G-9yY7Y#LsVRkJX3(iJpMCzF zEX-G(o!tYKB)aGO!M}TZ8^dBTeR$)>Cv9!p_HOg)(${Nmzm=^2eRt!qyLG(s`nCRG zm@*E1KbX?WJ$-q;+RNr<%sY4f7_?eHhX4RqE;sleG7W{b+8`d-UX>0Lw_Sg01_C6gQ*jEVV3R?>>)IFTt-owgqb9j7)Y+P_(Yqg0SFKiMFKz~ z0T7c(3$0d27zs!15W*(uoXg13IK8w{K9ir-#p0L)iZ~7c1H%A_fFee`P4j_+GV@s3 zeN@hYNJu6XuAgM>Z}pDO<&u2>rBW}f(As+j{V8H)V1ExhkV6P8z=FJZQ)jk*(+39! z_g7b!7rI@Kjg2Qfe6WUX2W&q4m9>AbkbdcF>N7oxr3%(~flSKebasN)?kzQL-rD7r zOZ6X4m**v)zbsG|$Ot3_kjmLb+1wTp2}Q&gk?16geEG#E(r7f^)S2wL*J3H-dM%>J zLs0-C`hWI-dLzqBEdmn22ndiE43%JSU$eTpZma6~=^w+;r{CWLi4Y?u6c2E*ZQ}%n zFg$iFCol26_QJv&J1Uj7)`Osr?>R(qh=`Bxg@DE8qjlQ*k548&CJm(kL7=<5{Kt{1 z)uzUM-$iSUNQ8)g(punocZ59{0-$vYtxc3+0)Ga*Znt>#>NQL6>^u&#**t!5h^fGJ z+eFb2*oQEM>mN6Jo{edm^!qLY+rbNh(z!}`QrBu1@2{*p#dmBH+6BX9Y)oM$(&%J~ zPe1!sW~M9l=GLx?W8LvQ|DWycm42a++Pi-J147KiQBh-@2#%>6#Rd*OBd_>2Qm$Xwckl|rT_o{07*qo IM6N<$f};Ym*CsGUh074yEL{XMZ7cf&`*=*r72Z+j+2B5y<+hzU#(AFv z+!m8y#^HcNtmEqdUmXGsPJ&&BYk)<>PJbac!3$@wEwC5mE`k2GKxqL+9X1|{k^fkb zPG1EuO5&~{J{6@4w%#7&G9!Ay3~z07*qoM6N<$f=VTic>n+a literal 0 HcmV?d00001 diff --git a/tests/output/custom/theme/images/icons/gitorious.png b/tests/output/custom/theme/images/icons/gitorious.png index 6485f5ecc5f6047a052d9adfb686ee154e7233af..3eeb3ecec36a73ff505e04ecdecbcc4792ef6786 100644 GIT binary patch delta 199 zcmV;&0672K9OD6yB!4_mOjJbxdO9bDQz(m9HIZRZpK)ubh)uJ7cde3mxs-3gmU_mX zpuexJ#ki)~zOmiL)z#I~?BD9@>fQ0@|NsA$KGRG9003f1L_t&-(|ye`5`Z8K0Ko$# z3IP-G|9`cS8ED+{nj_01Be_koAnlp75qc?o2`=J4p}Suqmq2^}LK)BUG$EY#9zOeh z21r&_4>(k-B_NrZDX5wKgt~2Y2}1&6nnZ{!;tLK&3GEfRNsIsh002ovPDHLkV1iD^ BTdx2B literal 3675 zcmeH}_cs;(AIIM!du1jmd)(}q&As*>mwP2~txFP0S<$suA0ydaQQ0fx>V~qnD`Z|H zDsM1YRfBtf8PhSR$Jg1$Z#Z(m^oWl9R>38%Fr zV-o!|&8oo5l;~FpNdreqVXu59TS#ArPaCJS)~oig4I?ydw2WCs3f4*(#&YPD3tysp zyLy&ZrFA0dh5gU|Zg3a4e&2NdXtJ$6v<*278zrMgbh332;&r zrUQOx5VdKotgD z`hA5QR(*4vZDlM6DVAhkU}Z6+_|xb0_{drY{|m>{Rte_f~M(8MshYu zaDF=@zFp0G=Tzfw8oWz^vUSY}hTV7;tYWO}x%9@qin2NJ zz-^>1h>9&zzl~0rDhSGtx}s}@G(%cU8$HTuwl1u5UTNv!XK>?b2$mG^VXBOK5UJE9S~ooN=pm#z z=Y+30S+kBG1X@TR1#Igi$iJ}=^&f}&} zMOJneveKy1y3%l~Rk>!n6kF1&-|TP{$*kLJB6d^E5S>amk6pK&v7IlaFXb}VR6D4V zuJ9@5Eo#;a`gpf=C#T@UElh!#U+F?f>-wL|;W8)i6W>3j2ZoGD>IOz(Y9b@yqDHq; zfS(4ROfT`LHO#3~2Ud*AL}f31fDf#vM_57*)#U_^`9#`UW=N*s1@ zEq7yYs5%rQ?QS?V7*u1cMJAi8n@ca0;w>^PDhnpjoo{~P`f=q=Ja5*fsfjf>UtBl} z?aGaA>aOYB$!N_8e;@wOi6#wG{0ws?-wnQq`)}`YsM)J6(+pxFMPwjlUngmyn!j8Z{`LttFk$+cV$Sx@r=55a6^FI(C4~Z^-Z1 zE+f|NDDQah#LvALQhXs%;Gl5-Q)eISi}l*5Hp7cdS)awK2uqk{B)V~3NXAVj9Z@~? zrl~lnf`t0Pt@TUm-isBj6%CaI`2`2(A(ghKzNSITPQL=@*hSc5A+kF;lspPbF(MRb z%EUZV3jN3FG23wZT?PpcLnt>+NZ3Es@H zRuSJOKhdDRqLMo!7{y}aV-a!MDgFt_OQUkxN|4l`e}Mv0JK8DJOhW`M1S>s zI9TNoTYuVpH@QjXN+wOePeWSOc?T(a9JJ&c{D$}xgr*+tf$;n|oH(GGRatOtczdW} zfS9K8{KpIOHd_bV(ob7dVMnDLWeueY=wK#j~DvftZIEe3rW#u*^ zyC$MlG}PQD@>csmRC^k8}B#pF?a6S+w#gTy!(jfnCHgV1*rl@=B$eBui4CZnPz6+GA-J_-9GrGPn5|X z7AH1G<6!t#A2r^!c$D@NhSjyS)ZyLH9p12(Uy9!+h>k6!6RrLa zL^}#Q^9j!hk0axw29kD7V#UT`){(DMwS{lMb}!`^iFJrNNaR*b0PHDka(5lxuS+ch{+zj-+Oi=YCHqIJMsjZi4BjC{ypbHe2EKN zcOxv`X7T&+o;7f3OrM;*uHK?fxVif-aJQbg#*TQ0$g5Rz_T3EJ)Hux;x9n|x-kev1 zzv+YD32ki*^CWHX7N`*B_gh1La*-z|3RE@cTlYf!NZq7^MXvdXdtxVq!RDDDv7PD` z%NFN-oo(G2*nIqiw&UsC^pCm6x7&gW_eSRoNz}2?Bd6&HsVuPbsky0xaZGVr1=qDy zRhPBzoopPJ!baRjL<_i2U!D%uaC6B-98PRa5k_-Hi?VmKGd}u0Dn8k4+v2Gu_H^`I z`OqJ%Aa`ru{%E^BXfBBF$E!sa%hgBxkHyJezv~WcKb0P3@ML6=sVH;yj@=Zbh-ZD1 z-_6Lz9Dq;}05H)2{3f6I1^^Fa0oZf_KrIIVZoj9_-39ZfDh7YjeuipAOblqHnRd;pX1guKpVP^?KjrDZl!Lxy>?erb8ta^(jygszj+vLaYB8AoV>@2=0&gbI-vZ)aP<#t2rh=>% z4uBFcLlywp|AF`)lt#v2F_0Q$J;*j+Ou*EHfuU+HqPPTPDok^%yZQe}XCt6Z)(A~N zcBHfM{}?w@xFIl?fc=bY!HpjbZD7OVJuUzD)PENK|M2eZ|NFOZ{Lct+ zMRt)212k~{fo$2ZY~Ftm`1kK0n4Zi?_eO#`O~^wbDXNGM6!8_gwN kRAy|1D^$uYJUPBNklU>nq-!*wY* zC4;*|6YMHgDyXOh9jsz9Dcv*)g5V+u32`wNycWSfXg96&Pc%sJPsJj(q|NJ)yLbsY z`3(p6eb4hgcfWg1@K!3}kT1EUlTM$io)M8@AnF}2scJ<;GJm8%(5kUR3z*0a|DdbCT%J)bh`HezbnMuVYyTyDN+~Cl&G~Hznz$(+AA^3FB9?L}LfIfBP2G<%bw!ICx}`(bE@M z{rZ{f=TEY+{(sAt$E>NMW)=<^fUQ?r}wsXW56LcT0&f`n_;MP5C7>IHPrSLNgK0)H=Or`z@ou;ky^b{A9EE>W*< zpsHZK z>upIAVz}dFal_O6CT?`r$qOAn;FBaOK-k!D!Jidayc;Y>7GYGxnGBxue+IChM|)V`ar=`j`~3M zC07%M|NqZF^fS8TVssIRJYwIy1j>GXU1E8{UJs6dLU1-v!-3nb2Irih=+?6PKKJ@8lF5#&^v9fcghZg&b90USur#Ch_yBx0YzYJ9ftpZ|9@Mbb;3sH7#Llc zapC{3OLv2zTp&7Rr3KUgB!TRsHrfndzX7?Q-YzOS8|-?va>A!K_nuYT9<U;^giL<|Q^RJR%`Z!y$8yYa>Upa1{=xci{g2`qvgF`RFk`e^@wXB(G2 zShMW$$p`;HLHGV;SLhaf#f_+F1DIs^y0_<$oBBFk`Sl>Ab*Ovm_g^4AcawG2Lj|D- zqK4swiTo;US!A@iaP1FZz%33(6Ney%eY$dMwPn_zpvZ?`|G(*ST!StSLI9gPlb*yp RBR2p5002ovPDHLkV1g3B{|5j7 literal 0 HcmV?d00001 diff --git a/tests/output/custom/theme/images/icons/lastfm.png b/tests/output/custom/theme/images/icons/lastfm.png index b09c7876537ad9faa7a7a68ad6c8035d2e32ec3a..3a6c6262b644dadbcf6cce5dfe4fed9740a9ec1f 100644 GIT binary patch delta 842 zcmV-Q1GW6r2hRtPl7A>kL_t(I5e30dY!p=-!13>U^LF-sk?xk2w$KnZDpdlBD2Jw1Np_ZC(a~^^ahDtECA8NxevjB}{B#LnDPOMcfyN(rj=^z~3 z2O_Yt2K5OzdI(zU@cdrbH3rM8$TM|ltYGKw6ZLx)Bb}hk;TK`3g#G3RbhCvTq%b-H z?;eBtPH47Z`v~duFZ8bbMlqiy+3b;&eXS#G%&u|L*?$F+pKqWt2HRdIz4#;U<{WZ( ziryFJaSs}pQzyy2bDX&Gh-jsS6Jp)^{nkJLy<Hd0y}`_qa!RHICj0UZAyYm(;_00EH@>X`%6+0`S0z|WaY#sA|m28 z0ud3hQ7r$wc}nK9lk)GYCzrgBcRu}**NtlZ@2`^FxrZ*7P@OK_Gv^4WuhCyvMCbG9 zu@QRTU1jz38G=75s}(L|(1{~ks}OsRK^S6; zhghpkeqyxIyZ!Khmqh4X7HcgOGnjG#Rq*k&#$^QYJS5TB)*8AufZA5n#P}uCEoDDX zoW9jPQAVP8n?&(2j;iX1Rc%xbXN~H#%WAB8&##Sqsc>`EPd}XbAE?ij UbKRwmQaM~w07vUoteIwd2imk z_wS;{)!F=V@=K0d`SQ~4RAc>Jzg&7z7xM*eJf}P}Z4yc($$#T`Y6V3DkqB#7NqIdo z{u)VACv7enztKE9;QI%OV_01WtpRxqKLwrv*nxB494G~G0uD%GoN~8KCQcq@qym1L z|A%pcI1A39lmY;eP2_SY08;A5;cmdLC*^NEqUptw^g(dJQY^ z!T~t2ck}A<>Za((L1?VOvwL9Y2rR82PgS9|jGenj*zJ^zw1Ogso`-<~_N(vE^#-b+ z!0-^feH5x=P;bEYA(E+|=v@AVd^SzI(IGDST8G$(oqwYwGxNkhUPq-2wz)=f;d|VT zS>(_pozKqU?$^1O zwke!?hkrN<2+o|_OuFX@0^5iB!^14>KYFdUZBl}ZQz9Y~FV!WO{X-HF`RC0~Wcm0< zA|m3}0}&CiVI+UOep2Sr6Y}@VCl9h2vuF{=f zKxeb)ks&(YTw&$ZX@cKwqRS<6yG9q(ou^-&E`NryPkS1>(jwYuW8(-fmqk^|*u{F}A1Yf>O?w*+yx z0CTqhbhrm|xBzvz1a!FqcDf06xd(T;33s;)cDV|7y9#-^3V(UK4tTl@dAbdGx)6D~ z346Q>d%O;MybpT35_-H7db<*PyAOQ56??oAe7qEXzZ8PM6@tJSfxsMsz#E3bAcevo zhQc3+!Xb*pB8tN!io+y}!zGKvCX2);jm0dE#x0JoX$_3 z&P$-qPoL0IpwUyI(p93+RHM;WqtaHS(paR_T&B}wrP5ib(q5<3UZ>Sxr`2Al)Ly97 zV5rq$snuqw(`KsHYOK|5uGnj@)^D%YaIe{Lu-9|2*MD=d*>thlbg|lUvebKVFwb$yn*z3L7?7rLWzuWJ^-|oob@6YA&(B<*a=JM9) z^VjM0*y{D#>-FC4_2%;U|Ns9Oj;1#N0004WQchCH7$m zNsr_-rSbCl=$>a! zT#UcpD5G|76F86FG*L;*?Gy5CNz8~@V3=k75A+&{>?x8{4FCWD07*qoM6N<$f^Ejt Ar~m)} delta 350 zcmV-k0iphY2lxVzBYyw^b5ch_0Itp)=>Px#V^B;~MGyc0KZmWH$J$Alx#;uvdbG^e z=kH&n!$6a@!rkci`}{$ayo$Zj;O+HRp};|mv$WLV^7{O7uFF80y{ypSmBiLho4f!2 z|3HebZLP@V@Az7wzxn$7k-*gO`1*yp(aquNH>hjL00001bbnG#Qvg8b*k%9#00Cl4 zM??UK1szBL000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igk_1|=i3(xCzX004nW zL_t&-({<0$4#FS|1<<0CRVy%Xv>;CX|F0C5;2xYeX_}lgX$wGf`-TVr5tjpQ*#$4m zuBAiHh{xLP3Ri^q)}4&j0`b07*qoM6N<$f`s&<#{d8T diff --git a/tests/output/custom/theme/images/icons/rss.png b/tests/output/custom/theme/images/icons/rss.png index 7d4e85d981cbecb04b76dab5a234dc4690bd15ab..7862c65afeb66ba9cc7e9576a3a62b850b2e184d 100644 GIT binary patch delta 745 zcmV(%-GyYSq$rgqMYKkaS-FvbSn$Jl_*=W(eMC&poDl`J)JE%~!DK`*EMrc$FSLQO^8wa$m zGC9wK$0%|-i+>cWv@WxDg^@ApiX=q=$&o7xCAqD^v z#6g|deBW*3JH|&y~+ElCyQ-AY3ev(6%g(JTUw-+U69u>2XEnzC(V_9^w`BzdLGqpGA|C0Rn+wz0^j z?cy_E@qbEgm}IP;SMGdOw~NjdX(KgEX5{O{I!aTrI2>doH`Iu=Pf60i3vdvDqoYn>itk1VAcp^W5xI@5cu zZ9A~AKLF(C-r5t&Td&v6>o10~v()W06-6~$6!EUQv9*lprj>4|c_*3L8?xDbpUod$ bI0gR$D~Vu?3V6ai00000NkvXXu0mjfF-~l$ delta 762 zcmVF%oP zx>fhy6N_AJx&I-|9nl*0}t+<%LSXEBX}Vzi2I7Kv^W z;wr62&dFo%tO|ghKfXlx;caS7kSQn}gc5uKM1Y0#DrD;r)gVhjK_5J^7=@ocI3Tk8 z5%t}mEf}srF@$UllIxKE3FB2D1~Ut#1p-(_e0o;|y@!7FBwTm}-B?BeC4#3vgZmD_ zpqx-eL6l&@h5DLNDl25yCylorLPp;rpYBJ`bkM<-$$zy&XJKv+*c=oPA>^RdcGocO z^|4z>a{(Sb35%DIBflaWUCfz>QFjZBp}hMA+!o*!5JCWhI3vLdv-@E4JLJM)^p8{M zwgoua!=+>7`_};|cRh#oK;+RvNi2+$zuQKub16jv51d?zwBNAdUx{4b}$ zji|JrAb&I(ka=9Dcn7&Rv4LpBpbOJG(WkzEmoiEdL+?Cp{$NG=mqBT6$zwgnoL zD1unaA_jAf0BAr$f;BUY^O)xHyVy#H`VN6Xm!#iE(@oTXAczN*+DQD*r{~SZW8IMD zh;NZ=gk(KxxgkivbhhKSa{HdFQ5%gFKObr@3Z$_>;3yYcI!BQ-Z@vtk;_|^ zz1*Sk!tr26WmpXvvlgk9v@&P8apqm--o=q_*;oJOuB}wPzkg>OM4=Sf#+U(5Bx-{p zAVDV)UEr|6I9l4TVN>*AT!V)~z?jI`0uF&gcN!OS!6FwnMRbC?j>J0fbfcZnIh6;| zEAd*2JnG<+zu?;$?8m^cI4`=ww0G9U$$}nu(!;9JaU!bTGUvP*5cp{dKc2$19rz66 z!z$2VG(?WFGk;Ye0l9$TIc3Rr%sC$-0`9M1djS7sm6dMx^NjG z5K~vAPQndZKn52A+?~OvYd9(Jtb+;g!y&vqGHw@WidYqPgULIWu`J@Gh_eg{NEse3 z;du+e#HqxIg8|zHjRUAnlS^h8jI9{BG64bGL3}rZ z+e`R+yYoLZrHhp#%l(i50000W delta 701 zcmV;u0z&=12EzuBl7E~@L_t(IjV+Q(Yh6_wN7sMveeN?&Oay6a8y~5lSn5EjLp!l! zK|hT%{R~bz>rh0{VWlAAKoG$W3bptEZD{(qO}y`O&pCVle-7gM0Bf?A-8#;nw$9a2 zkf<-QDif9GBUL^JcPd3^K zty6grof5C4$io&s`V+pM!F~)3iu1fJOgm>?oGj>o#~rL{9VeoCTjrcM0|MVq;ky&K zwgaDFyk7-sjDMQQQFf*ZBp??sJf|%AjydN;M8LfjZ1>^c3{%11P2f=julL}cVdOU# zCoWt@2*lJDsg-bp29Uvp06)**<26hQJZ)hN+&+XihsK=(brGw=ZZLW4GL}V5ia5=X zfRy3E5}q{>Oq@te91Pets2xB}8dVevXT}5+hXTwUZhvgS2fOez8*dN9dt-6WjkSOx zqI8lZby8$e#HGsFt|IeRjDqpmML6j5KgJ&}?sjk?L0=gaEkZEWxnu^x*ouKGV-T<% z#5XgzvxIM_;z0uk!Pqr1>k3VF%#~A>m=_FUVuf*a1bYTq;^qW4X5|8(RTp5d_#;6^-&RG@sYwbL2;Btf=oN0Dqut8cCRb!xa zcvQpwIpgz7;={3%F!qOmA~+lvZ}ebJVO_6zvZ)wi`zafv1+W*5)6V&IVZ1stZoD8$ zDfE+3aaQKXnRCA`oR%KTR?Ihk&AxiJxc+;NH#P^(*qd(IxJ+P0D9ihsLIrY@Suq*| j?ewZ?-D&cY*-!rgG^LA`I>-QU00000NkvXXu0mjf)N@7! From df66579fc2706110def6c66031058e1078bdc0f9 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 9 Oct 2012 00:56:15 +0200 Subject: [PATCH 0148/1975] directory comparison should be recursive in functional tests --- tests/test_pelican.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 10b40d38..762663d2 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -22,6 +22,21 @@ INPUT_PATH = os.path.join(SAMPLES_PATH, "content") SAMPLE_CONFIG = os.path.join(SAMPLES_PATH, "pelican.conf.py") +def recursiveDiff(dcmp): + diff = { + 'diff_files': [os.sep.join((dcmp.right, f)) + for f in dcmp.diff_files], + 'left_only': [os.sep.join((dcmp.right, f)) + for f in dcmp.left_only], + 'right_only': [os.sep.join((dcmp.right, f)) + for f in dcmp.right_only], + } + for sub_dcmp in dcmp.subdirs.values(): + for k, v in recursiveDiff(sub_dcmp).iteritems(): + diff[k] += v + return diff + + class TestPelican(unittest.TestCase): # general functional testing for pelican. Basically, this test case tries # to run pelican in different situations and see how it behaves @@ -43,9 +58,9 @@ class TestPelican(unittest.TestCase): "to docs/contribute.rst to update the expected " \ "output of the functional tests." - self.assertEqual(diff.left_only, [], msg=msg) - self.assertEqual(diff.right_only, [], msg=msg) - self.assertEqual(diff.diff_files, [], msg=msg) + self.assertEqual(diff['left_only'], [], msg=msg) + self.assertEqual(diff['right_only'], [], msg=msg) + self.assertEqual(diff['diff_files'], [], msg=msg) @unittest.skip("Test failing") def test_basic_generation_works(self): @@ -61,9 +76,8 @@ class TestPelican(unittest.TestCase): }) pelican = Pelican(settings=settings) pelican.run() - diff = dircmp( - self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertFilesEqual(diff) + dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) + self.assertFilesEqual(recursiveDiff(dcmp)) def test_custom_generation_works(self): # the same thing with a specified set of settings should work @@ -73,5 +87,5 @@ class TestPelican(unittest.TestCase): }) pelican = Pelican(settings=settings) pelican.run() - diff = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom"))) - self.assertFilesEqual(diff) + dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom"))) + self.assertFilesEqual(recursiveDiff(dcmp)) From 4cfb0cd24ef1ddc2de6951bb5e0f74ae1f2d7c71 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 5 Nov 2012 23:40:38 +0100 Subject: [PATCH 0149/1975] Move Webassets in a plugin --- pelican/__init__.py | 5 --- pelican/generators.py | 31 ------------------- pelican/plugins/assets.py | 64 +++++++++++++++++++++++++++++++++++++++ pelican/settings.py | 12 +------- tests/test_generators.py | 2 +- 5 files changed, 66 insertions(+), 48 deletions(-) create mode 100644 pelican/plugins/assets.py diff --git a/pelican/__init__.py b/pelican/__init__.py index 443d330b..c0f33687 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -158,11 +158,6 @@ class Pelican(object): writer = self.get_writer() - # pass the assets environment to the generators - if self.settings['WEBASSETS']: - generators[1].env.assets_environment = generators[0].assets_env - generators[2].env.assets_environment = generators[0].assets_env - for p in generators: if hasattr(p, 'generate_output'): p.generate_output(writer) diff --git a/pelican/generators.py b/pelican/generators.py index 33d0ff20..00b0d6d3 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -465,37 +465,6 @@ class StaticGenerator(Generator): copy(path, source, os.path.join(output_path, destination), final_path, overwrite=True) - def generate_context(self): - - if self.settings['WEBASSETS']: - from webassets import Environment as AssetsEnvironment - - # Define the assets environment that will be passed to the - # generators. The StaticGenerator must then be run first to have - # the assets in the output_path before generating the templates. - - # Let ASSET_URL honor Pelican's RELATIVE_URLS setting. - # Hint for templates: - # Current version of webassets seem to remove any relative - # paths at the beginning of the URL. So, if RELATIVE_URLS - # is on, ASSET_URL will start with 'theme/', regardless if we - # set assets_url here to './theme/' or to 'theme/'. - # XXX However, this breaks the ASSET_URL if user navigates to - # a sub-URL, e.g. if he clicks on a category. To workaround this - # issue, I use - # - # instead of - # - if self.settings.get('RELATIVE_URLS'): - assets_url = './theme/' - else: - assets_url = self.settings['SITEURL'] + '/theme/' - assets_src = os.path.join(self.output_path, 'theme') - self.assets_env = AssetsEnvironment(assets_src, assets_url) - - if logging.getLevelName(logger.getEffectiveLevel()) == "DEBUG": - self.assets_env.debug = True - def generate_output(self, writer): self._copy_paths(self.settings['STATIC_PATHS'], self.path, diff --git a/pelican/plugins/assets.py b/pelican/plugins/assets.py new file mode 100644 index 00000000..58f9f863 --- /dev/null +++ b/pelican/plugins/assets.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +""" +Asset management plugin for Pelican +=================================== + +This plugin allows you to use the `webassets`_ module to manage assets such as +CSS and JS files. + +Hint for templates: Current version of webassets seems to remove any relative +paths at the beginning of the URL. So, if ``RELATIVE_URLS`` is on, +``ASSET_URL`` will start with ``theme/``, regardless if we set ``assets_url`` +here to ``./theme/`` or to ``theme/``. + +However, this breaks the ``ASSET_URL`` if user navigates to a sub-URL, e.g. if +he clicks on a category. A workaround for this issue is to use:: + + + +instead of:: + + + +.. _webassets: https://webassets.readthedocs.org/ + +""" + +import os +import logging + +from pelican import signals +from webassets import Environment +from webassets.ext.jinja2 import AssetsExtension + + +def add_jinja2_ext(pelican): + """Add Webassets to Jinja2 extensions in Pelican settings.""" + + pelican.settings['JINJA_EXTENSIONS'].append(AssetsExtension) + + +def create_assets_env(generator): + """Define the assets environment and pass it to the generator.""" + + logger = logging.getLogger(__name__) + + # Let ASSET_URL honor Pelican's RELATIVE_URLS setting. + if generator.settings.get('RELATIVE_URLS'): + assets_url = './theme/' + else: + assets_url = generator.settings['SITEURL'] + '/theme/' + assets_src = os.path.join(generator.output_path, 'theme') + + generator.env.assets_environment = Environment(assets_src, assets_url) + + if logging.getLevelName(logger.getEffectiveLevel()) == "DEBUG": + generator.env.assets_environment.debug = True + + +def register(): + """Plugin registration.""" + + signals.initialized.connect(add_jinja2_ext) + signals.article_generator_init.connect(create_assets_env) + signals.pages_generator_init.connect(create_assets_env) diff --git a/pelican/settings.py b/pelican/settings.py index 2c318997..b4fe04f4 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -76,7 +76,6 @@ _DEFAULT_CONFIG = {'PATH': '.', 'ARTICLE_PERMALINK_STRUCTURE': '', 'TYPOGRIFY': False, 'SUMMARY_MAX_LENGTH': 50, - 'WEBASSETS': False, 'PLUGINS': [], 'MARKDOWN_EXTENSIONS': ['toc', ], 'TEMPLATE_PAGES': {} @@ -187,16 +186,7 @@ def configure_settings(settings): if 'LESS_GENERATOR' in settings: logger.warn("The LESS_GENERATOR setting has been removed in favor " - "of WEBASSETS") - - if 'WEBASSETS' in settings and settings['WEBASSETS'] is not False: - try: - from webassets.ext.jinja2 import AssetsExtension - settings['JINJA_EXTENSIONS'].append(AssetsExtension) - except ImportError: - logger.warn("You must install the webassets module to use " - "WEBASSETS") - settings['WEBASSETS'] = False + "of the Webassets plugin") if 'OUTPUT_SOURCES_EXTENSION' in settings: if not isinstance(settings['OUTPUT_SOURCES_EXTENSION'], str): diff --git a/tests/test_generators.py b/tests/test_generators.py index ba923980..6b714082 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -257,7 +257,7 @@ class TestWebAssets(unittest.TestCase): self.settings = read_settings(override={ 'PATH': os.path.join(CUR_DIR, 'content', 'TestCategory'), 'OUTPUT_PATH': self.temp_path, - 'WEBASSETS': True, + 'PLUGINS': ['pelican.plugins.assets', ], 'THEME': self.theme_dir, }) pelican = Pelican(settings=self.settings) From 4c15ec9f86e499d2dc9b39087ea1aaf1795f25e6 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 Nov 2012 00:04:45 +0100 Subject: [PATCH 0150/1975] Move webassets doc to the plugins page --- docs/plugins.rst | 89 ++++++++++++++++++++++++++++++++++++++++++----- docs/settings.rst | 72 +------------------------------------- 2 files changed, 81 insertions(+), 80 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index c275c57c..83ef264c 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -59,7 +59,7 @@ Signal Arguments Description ============================= ============================ =========================================================================== initialized pelican object finalized pelican object invoked after all the generators are executed and just before pelican exits - usefull for custom post processing actions, such as: + usefull for custom post processing actions, such as: - minifying js/css assets. - notify/ping search engines with an updated sitemap. article_generate_context article_generator, metadata @@ -75,23 +75,23 @@ pages_generator_init pages_generator invoked in the P The list is currently small, don't hesitate to add signals and make a pull request if you need them! -.. note:: - - The signal ``content_object_init`` can send different type of object as +.. note:: + + The signal ``content_object_init`` can send different type of object as argument. If you want to register only one type of object then you will need to specify the sender when you are connecting to the signal. - + :: - + from pelican import signals from pelican import contents - + def test(sender, instance): print "%s : %s content initialized !!" % (sender, instance) - + def register(): signals.content_object_init.connect(test, sender=contents.Article) - + List of plugins @@ -99,6 +99,7 @@ List of plugins The following plugins are currently included with Pelican under ``pelican.plugins``: +* `Asset management`_ * `GitHub activity`_ * `Global license`_ * `Gravatar`_ @@ -114,6 +115,76 @@ Ideas for plugins that haven't been written yet: Plugin descriptions =================== +Asset management +---------------- + +This plugin allows you to use the `webassets`_ module to manage assets such as +CSS and JS files. The module must first be installed:: + + pip install webassets + +The `webassets` module allows you to perform a number of useful asset management +functions, including: + +* CSS minifier (`cssmin`, `yuicompressor`, ...) +* CSS compiler (`less`, `sass`, ...) +* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) + +Others filters include gzip compression, integration of images in CSS via data +URIs, and more. `webassets` can also append a version identifier to your asset +URL to convince browsers to download new versions of your assets when you use +far-future expires headers. Please refer to the `webassets documentation`_ for +more information. + +When using with Pelican, `webassets` is configured to process assets in the +``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by +including one or more template tags. For example... + +.. code-block:: jinja + + {% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %} + + {% endassets %} + +... will produce a minified css file with a version identifier: + +.. code-block:: html + + + +These filters can be combined. Here is an example that uses the SASS compiler +and minifies the output: + +.. code-block:: jinja + + {% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} + + {% endassets %} + +Another example for Javascript: + +.. code-block:: jinja + + {% assets filters="uglifyjs,gzip", output="js/packed.js", "js/jquery.js", "js/base.js", "js/widgets.js" %} + + {% endassets %} + +The above will produce a minified and gzipped JS file: + +.. code-block:: html + + + +Pelican's debug mode is propagated to `webassets` to disable asset packaging +and instead work with the uncompressed assets. However, this also means that +the LESS and SASS files are not compiled. This should be fixed in a future +version of `webassets` (cf. the related `bug report +`_). + +.. _webassets: https://github.com/miracle2k/webassets +.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html + + GitHub activity --------------- diff --git a/docs/settings.rst b/docs/settings.rst index ca2c7b0f..c4ac3584 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -52,7 +52,7 @@ Setting name (default value) What doe the datetime.datetime constructor. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before generating new files. -`FILES_TO_COPY` (``()``) A list of files to copy from the source (inside the content +`FILES_TO_COPY` (``()``) A list of files to copy from the source (inside the content directory) to the destination (inside the output directory). For example: ``(('extra/robots.txt', 'robots.txt'),)``. `JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use. @@ -426,7 +426,6 @@ Setting name (default value) What does it do? value is `static`, but if your theme has other static paths, you can put them here. `CSS_FILE` (``'main.css'``) Specify the CSS file you want to load. -`WEBASSETS` (``False``) Asset management with `webassets` (see below) ================================================ ===================================================== @@ -487,75 +486,6 @@ adding the following to your configuration:: CSS_FILE = "wide.css" -Asset management ----------------- - -The `WEBASSETS` setting allows you to use the `webassets`_ module to manage -assets such as CSS and JS files. The module must first be installed:: - - pip install webassets - -The `webassets` module allows you to perform a number of useful asset management -functions, including: - -* CSS minifier (`cssmin`, `yuicompressor`, ...) -* CSS compiler (`less`, `sass`, ...) -* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) - -Others filters include gzip compression, integration of images in CSS via data -URIs, and more. `webassets` can also append a version identifier to your asset -URL to convince browsers to download new versions of your assets when you use -far-future expires headers. Please refer to the `webassets documentation`_ for -more information. - -When using with Pelican, `webassets` is configured to process assets in the -``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by -including one or more template tags. For example... - -.. code-block:: jinja - - {% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %} - - {% endassets %} - -... will produce a minified css file with a version identifier: - -.. code-block:: html - - - -These filters can be combined. Here is an example that uses the SASS compiler -and minifies the output: - -.. code-block:: jinja - - {% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %} - - {% endassets %} - -Another example for Javascript: - -.. code-block:: jinja - - {% assets filters="uglifyjs,gzip", output="js/packed.js", "js/jquery.js", "js/base.js", "js/widgets.js" %} - - {% endassets %} - -The above will produce a minified and gzipped JS file: - -.. code-block:: html - - - -Pelican's debug mode is propagated to `webassets` to disable asset packaging -and instead work with the uncompressed assets. However, this also means that -the LESS and SASS files are not compiled. This should be fixed in a future -version of `webassets` (cf. the related `bug report -`_). - -.. _webassets: https://github.com/miracle2k/webassets -.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html - Example settings ================ From 7088135f5e31202cac4894cf6d7f3514c4a86d61 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 Nov 2012 01:00:28 +0100 Subject: [PATCH 0151/1975] Add tests for webassets: test absolute url and Jinja configuration --- tests/test_generators.py | 85 +++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/tests/test_generators.py b/tests/test_generators.py index 6b714082..8a839ba1 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -8,6 +8,11 @@ from codecs import open from tempfile import mkdtemp from shutil import rmtree +try: + import webassets +except ImportError: + webassets = None + from pelican import Pelican from pelican.generators import ArticlesGenerator, PagesGenerator, \ TemplatePagesGenerator @@ -243,6 +248,7 @@ class TestTemplatePagesGenerator(unittest.TestCase): self.assertEquals(output_file.read(), 'foo: bar') +@unittest.skipUnless(webassets, "webassets isn't installed") @skipIfNoExecutable(['scss', '-v']) @skipIfNoExecutable(['cssmin', '--version']) class TestWebAssets(unittest.TestCase): @@ -250,28 +256,52 @@ class TestWebAssets(unittest.TestCase): scss style.scss style.ref.css """ - def setUp(self): - self.temp_path = mkdtemp() - self.theme_dir = os.path.join(CUR_DIR, 'themes', 'assets') + @classmethod + def setUpClass(cls): + """Run pelican with two settings (absolute and relative urls).""" - self.settings = read_settings(override={ + cls.theme_dir = os.path.join(CUR_DIR, 'themes', 'assets') + + cls.temp_path = mkdtemp() + cls.settings = read_settings(override={ 'PATH': os.path.join(CUR_DIR, 'content', 'TestCategory'), - 'OUTPUT_PATH': self.temp_path, + 'OUTPUT_PATH': cls.temp_path, 'PLUGINS': ['pelican.plugins.assets', ], - 'THEME': self.theme_dir, + 'THEME': cls.theme_dir, }) - pelican = Pelican(settings=self.settings) + pelican = Pelican(settings=cls.settings) pelican.run() - self.css_ref = open(os.path.join(self.theme_dir, 'static', 'css', - 'style.min.css')).read() - self.version = hashlib.md5(self.css_ref).hexdigest()[0:8] + # run Pelican a second time with absolute urls + cls.temp_path2 = mkdtemp() + cls.settings2 = read_settings(override={ + 'PATH': os.path.join(CUR_DIR, 'content', 'TestCategory'), + 'OUTPUT_PATH': cls.temp_path2, + 'PLUGINS': ['pelican.plugins.assets', ], + 'THEME': cls.theme_dir, + 'RELATIVE_URLS': False, + 'SITEURL': 'http://localhost' + }) + pelican2 = Pelican(settings=cls.settings2) + pelican2.run() - def tearDown(self): - rmtree(self.temp_path) + cls.css_ref = open(os.path.join(cls.theme_dir, 'static', 'css', + 'style.min.css')).read() + cls.version = hashlib.md5(cls.css_ref).hexdigest()[0:8] + + @classmethod + def tearDownClass(cls): + rmtree(cls.temp_path) + rmtree(cls.temp_path2) + + def test_jinja2_ext(self): + """Test that the Jinja2 extension was correctly added.""" + + from webassets.ext.jinja2 import AssetsExtension + self.assertIn(AssetsExtension, self.settings['JINJA_EXTENSIONS']) def test_compilation(self): - "Compare the compiled css with the reference" + """Compare the compiled css with the reference.""" gen_file = os.path.join(self.temp_path, 'theme', 'gen', 'style.{0}.min.css'.format(self.version)) @@ -280,10 +310,29 @@ class TestWebAssets(unittest.TestCase): css_new = open(gen_file).read() self.assertEqual(css_new, self.css_ref) - def test_template(self): - "Look in the output index.html file for the link tag" + def check_link_tag(self, css_file, html_file): + """Check the presence of `css_file` in `html_file`.""" - link_tag = ''.format(self.version) - html = open(os.path.join(self.temp_path, 'index.html')).read() + link_tag = ''.\ + format(css_file=css_file) + html = open(html_file).read() self.assertRegexpMatches(html, link_tag) + + def test_template(self): + """Look in the output index.html file for the link tag.""" + + css_file = 'theme/gen/style.{0}.min.css'.format(self.version) + html_files = ['index.html', 'archives.html', + 'this-is-an-article-with-category.html'] + for f in html_files: + self.check_link_tag(css_file, os.path.join(self.temp_path, f)) + + def test_absolute_url(self): + """Look in the output index.html file for the link tag with abs url.""" + + css_file = 'http://localhost/theme/gen/style.{0}.min.css'.\ + format(self.version) + html_files = ['index.html', 'archives.html', + 'this-is-an-article-with-category.html'] + for f in html_files: + self.check_link_tag(css_file, os.path.join(self.temp_path2, f)) From 721a422e5e65746fc35445fb32b8a4477b8285a7 Mon Sep 17 00:00:00 2001 From: jawher Date: Sat, 20 Oct 2012 16:03:14 +0200 Subject: [PATCH 0152/1975] The all Atom and RSS feed generators should include all articles, regardless of the article's language or the site's. Fixes #550. --- pelican/generators.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 01f4701c..2ee9eea8 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -164,12 +164,20 @@ class ArticlesGenerator(Generator): 'Feeds generated without SITEURL set properly may not be valid' ) + # Isuue #550: FEED_ATOM and FEED_RSS should include all articles, regardless of the language + all_articles = list(self.articles) + + for article in self.articles: + all_articles.extend(article.translations) + + all_articles.sort(key=attrgetter('date'), reverse=True) + if self.settings.get('FEED_ATOM'): - writer.write_feed(self.articles, self.context, + writer.write_feed(all_articles, self.context, self.settings['FEED_ATOM']) if self.settings.get('FEED_RSS'): - writer.write_feed(self.articles, self.context, + writer.write_feed(all_articles, self.context, self.settings['FEED_RSS'], feed_type='rss') for cat, arts in self.categories: From 593acfc37a64510b87c744676eaca1b587f32394 Mon Sep 17 00:00:00 2001 From: jawher Date: Sat, 20 Oct 2012 16:53:10 +0200 Subject: [PATCH 0153/1975] Remove comment --- pelican/generators.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 2ee9eea8..966bd36c 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -164,7 +164,6 @@ class ArticlesGenerator(Generator): 'Feeds generated without SITEURL set properly may not be valid' ) - # Isuue #550: FEED_ATOM and FEED_RSS should include all articles, regardless of the language all_articles = list(self.articles) for article in self.articles: From c7d87feec31627ae2351950b01cad2a0e30de627 Mon Sep 17 00:00:00 2001 From: jawher Date: Mon, 22 Oct 2012 23:37:52 +0200 Subject: [PATCH 0154/1975] Reverted FEED_ATOM and FEED_RSS to their original behaviour and added FEED_ALL_ATOM and FEED_ALL_RSS FEED_(ATOM|RSS) generated feeds include the version in the default language of a translated article, whereas FEED_ALL(ATOM|RSS) would include *really* all posts, regardless of their language. --- docs/fr/configuration.rst | 8 +++++++- docs/settings.rst | 7 ++++--- docs/themes.rst | 2 ++ pelican/generators.py | 30 +++++++++++++++++------------- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 76f03a61..e3fb8542 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -59,11 +59,17 @@ CATEGORY_FEED_RSS : Idem pour les flux rss (Optionnel); FEED_ATOM : - Chemin du flux Atom global ; + Chemin du flux Atom global; FEED_RSS : Chemin du flux Rss global (Optionnel); +FEED_ALL_ATOM : + Chemin du flux Atom global qui inclut la totalité des posts, indépendamment de la langue; + +FEED_ALL_RSS : + Chemin du flux Rss global qui inclut la totalité des posts, indépendamment de la langue (Optionnel); + TAG_FEED_ATOM : Chemin des flux Atom pour les tags (Optionnel); diff --git a/docs/settings.rst b/docs/settings.rst index 6bcc7292..eeca4c3a 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -306,6 +306,8 @@ Setting name (default value) What does it do? feeds, you can just set: `FEED_DOMAIN = SITEURL` `FEED_ATOM` (``'feeds/all.atom.xml'``) Relative URL to output the Atom feed. `FEED_RSS` (``None``, i.e. no RSS) Relative URL to output the RSS feed. +`FEED_ALL_ATOM` (``None``, i.e. no all feed) Relative URL to output the all posts Atom feed. +`FEED_ALL_RSS` (``None``, i.e. no all RSS) Relative URL to output the all posts RSS feed. `CATEGORY_FEED_ATOM` ('feeds/%s.atom.xml'[2]_) Where to put the category Atom feeds. `CATEGORY_FEED_RSS` (``None``, i.e. no RSS) Where to put the category RSS feeds. `TAG_FEED_ATOM` (``None``, i.e. no tag feed) Relative URL to output the tag Atom feed. It should @@ -315,9 +317,8 @@ Setting name (default value) What does it do? quantity is unrestricted by default. ================================================ ===================================================== -If you don't want to generate some of these feeds, set ``None`` to the -variables above. If you don't want to generate any feeds set both ``FEED_ATOM`` -and ``FEED_RSS`` to none. +If you don't want to generate some or any of these feeds, set ``None`` to the +variables above. .. [2] %s is the name of the category. diff --git a/docs/themes.rst b/docs/themes.rst index e482bc9b..664b4466 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -200,6 +200,8 @@ Here is a complete list of the feed variables:: FEED_ATOM FEED_RSS + FEED_ALL_ATOM + FEED_ALL_RSS CATEGORY_FEED_ATOM CATEGORY_FEED_RSS TAG_FEED_ATOM diff --git a/pelican/generators.py b/pelican/generators.py index 966bd36c..33316a94 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -156,29 +156,33 @@ class ArticlesGenerator(Generator): def generate_feeds(self, writer): """Generate the feeds from the current context, and output files.""" - if self.settings.get('FEED_ATOM') is None \ - and self.settings.get('FEED_RSS') is None: - return - elif self.settings.get('SITEURL') is '': + if self.settings.get('SITEURL') is '': logger.warning( 'Feeds generated without SITEURL set properly may not be valid' ) - all_articles = list(self.articles) - - for article in self.articles: - all_articles.extend(article.translations) - - all_articles.sort(key=attrgetter('date'), reverse=True) - if self.settings.get('FEED_ATOM'): - writer.write_feed(all_articles, self.context, + writer.write_feed(self.articles, self.context, self.settings['FEED_ATOM']) if self.settings.get('FEED_RSS'): - writer.write_feed(all_articles, self.context, + writer.write_feed(self.articles, self.context, self.settings['FEED_RSS'], feed_type='rss') + if self.settings.get('FEED_ALL_ATOM') or self.settings.get('FEED_ALL_RSS'): + all_articles = list(self.articles) + for article in self.articles: + all_articles.extend(article.translations) + all_articles.sort(key=attrgetter('date'), reverse=True) + + if self.settings.get('FEED_ALL_ATOM'): + writer.write_feed(all_articles, self.context, + self.settings['FEED_ALL_ATOM']) + + if self.settings.get('FEED_ALL_RSS'): + writer.write_feed(all_articles, self.context, + self.settings['FEED_ALL_RSS'], feed_type='rss') + for cat, arts in self.categories: arts.sort(key=attrgetter('date'), reverse=True) if self.settings.get('CATEGORY_FEED_ATOM'): From 559367075996d414c5f0b832cd85ccb07402d4ad Mon Sep 17 00:00:00 2001 From: jawher Date: Thu, 25 Oct 2012 16:49:24 +0200 Subject: [PATCH 0155/1975] The default settings sets up FEED_ALL_ATOM (instead of FEED_ATOM) to all.atom.xml --- pelican/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/settings.py b/pelican/settings.py index 35752fee..052a58a1 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -24,7 +24,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'MARKUP': ('rst', 'md'), 'STATIC_PATHS': ['images', ], 'THEME_STATIC_PATHS': ['static', ], - 'FEED_ATOM': 'feeds/all.atom.xml', + 'FEED_ALL_ATOM': 'feeds/all.atom.xml', 'CATEGORY_FEED_ATOM': 'feeds/%s.atom.xml', 'TRANSLATION_FEED_ATOM': 'feeds/all-%s.atom.xml', 'FEED_MAX_ITEMS': '', From 537e9df3ed107360d92ac7153e42aa0c9d773029 Mon Sep 17 00:00:00 2001 From: jawher Date: Thu, 25 Oct 2012 16:50:27 +0200 Subject: [PATCH 0156/1975] Reworked the "unset feed_domain" warning to handle all feed variables --- pelican/settings.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pelican/settings.py b/pelican/settings.py index 052a58a1..237e8d22 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -175,7 +175,15 @@ def configure_settings(settings): settings['FEED_DOMAIN'] = settings['SITEURL'] # Warn if feeds are generated with both SITEURL & FEED_DOMAIN undefined - if (('FEED_ATOM' in settings) or ('FEED_RSS' in settings)) and (not 'FEED_DOMAIN' in settings): + feed_keys = ['FEED_ATOM', 'FEED_RSS',\ + 'FEED_ALL_ATOM', 'FEED_ALL_RSS',\ + 'CATEGORY_FEED_ATOM', 'CATEGORY_FEED_RSS',\ + 'TAG_FEED_ATOM', 'TAG_FEED_RSS',\ + 'TRANSLATION_FEED_ATOM', 'TRANSLATION_FEED_RSS',\ + ] + + generate_feed = bool([k for k, v in settings.iteritems() if k in feed_keys and v]) + if generate_feed and not('FEED_DOMAIN' in settings): logger.warn("Since feed URLs should always be absolute, you should specify " "FEED_DOMAIN in your settings. (e.g., 'FEED_DOMAIN = " "http://www.example.com')") From 93905e828d5b72bad7361d493e9f2db29d096e60 Mon Sep 17 00:00:00 2001 From: jawher Date: Thu, 25 Oct 2012 16:56:28 +0200 Subject: [PATCH 0157/1975] Split long if condition in 2 lines --- pelican/generators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/generators.py b/pelican/generators.py index 33316a94..fc59c905 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -169,7 +169,8 @@ class ArticlesGenerator(Generator): writer.write_feed(self.articles, self.context, self.settings['FEED_RSS'], feed_type='rss') - if self.settings.get('FEED_ALL_ATOM') or self.settings.get('FEED_ALL_RSS'): + if self.settings.get('FEED_ALL_ATOM') or \ + self.settings.get('FEED_ALL_RSS'): all_articles = list(self.articles) for article in self.articles: all_articles.extend(article.translations) From a79904c0751fdc01c24ed22d78147974ced472c7 Mon Sep 17 00:00:00 2001 From: jawher Date: Tue, 30 Oct 2012 11:06:33 +0100 Subject: [PATCH 0158/1975] Update the generators tests to use FEED_ALL_ATOM as the default set atom feed instead of FEED_ATOM --- tests/test_generators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_generators.py b/tests/test_generators.py index accdb699..a4c047aa 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -50,14 +50,14 @@ class TestArticlesGenerator(unittest.TestCase): def test_generate_feeds(self): - generator = ArticlesGenerator(None, {'FEED_ATOM': _DEFAULT_CONFIG['FEED_ATOM']}, + generator = ArticlesGenerator(None, {'FEED_ALL_ATOM': _DEFAULT_CONFIG['FEED_ALL_ATOM']}, None, _DEFAULT_CONFIG['THEME'], None, _DEFAULT_CONFIG['MARKUP']) writer = MagicMock() generator.generate_feeds(writer) writer.write_feed.assert_called_with([], None, 'feeds/all.atom.xml') - generator = ArticlesGenerator(None, {'FEED_ATOM': None}, None, + generator = ArticlesGenerator(None, {'FEED_ALL_ATOM': None}, None, _DEFAULT_CONFIG['THEME'], None, None) writer = MagicMock() generator.generate_feeds(writer) From fd18f2efa98bcd02595658b23039946968eec57d Mon Sep 17 00:00:00 2001 From: jawher Date: Tue, 30 Oct 2012 21:05:57 +0100 Subject: [PATCH 0159/1975] Generate links for FEED_ALL_ATOM and FEED_ALL_RSS in the simple them's head. --- pelican/themes/simple/templates/base.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pelican/themes/simple/templates/base.html b/pelican/themes/simple/templates/base.html index c1d9cb78..3ea2e8b9 100644 --- a/pelican/themes/simple/templates/base.html +++ b/pelican/themes/simple/templates/base.html @@ -4,6 +4,12 @@ {% block head %} {% block title %}{{ SITENAME }}{% endblock title %} + {% if FEED_ALL_ATOM %} + + {% endif %} + {% if FEED_ALL_RSS %} + + {% endif %} {% if FEED_ATOM %} {% endif %} From b6db45420c7edbd495344fe986d468b030e9a5ee Mon Sep 17 00:00:00 2001 From: jawher Date: Tue, 30 Oct 2012 21:06:43 +0100 Subject: [PATCH 0160/1975] Default to using FEED_ALL_ATOM instead of FEED_ATOM (and likewise for RSS) in the notmyidea theme --- pelican/themes/notmyidea/templates/base.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html index 6ab87c5a..45c2c3a2 100644 --- a/pelican/themes/notmyidea/templates/base.html +++ b/pelican/themes/notmyidea/templates/base.html @@ -4,11 +4,11 @@ {% block title %}{{ SITENAME }}{%endblock%} - {% if FEED_ATOM %} - + {% if FEED_ALL_ATOM %} + {% endif %} - {% if FEED_RSS %} - + {% if FEED_ALL_RSS %} + {% endif %} diff --git a/pelican/themes/notmyidea/templates/page.html b/pelican/themes/notmyidea/templates/page.html index 9635fb8d..60409d5c 100644 --- a/pelican/themes/notmyidea/templates/page.html +++ b/pelican/themes/notmyidea/templates/page.html @@ -3,6 +3,8 @@ {% block content %}

      {{ page.title }}

      + {% import 'translations.html' as translations with context %} + {{ translations.translations_for(page) }} {% if PDF_PROCESSOR %}get the pdf{% endif %} {{ page.content }} diff --git a/pelican/themes/notmyidea/templates/translations.html b/pelican/themes/notmyidea/templates/translations.html index 0079883e..ca03a2c9 100644 --- a/pelican/themes/notmyidea/templates/translations.html +++ b/pelican/themes/notmyidea/templates/translations.html @@ -1,6 +1,8 @@ +{% macro translations_for(article) %} {% if article.translations %} Translations: {% for translation in article.translations %} {{ translation.lang }} {% endfor %} {% endif %} +{% endmacro %} diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 16c34266..86b14f62 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -5,6 +5,8 @@

      {{ article.title }}

      + {% import 'translations.html' as translations with context %} + {{ translations.translations_for(article) }}
      diff --git a/pelican/themes/simple/templates/page.html b/pelican/themes/simple/templates/page.html index 6308d588..3a0dc4a9 100644 --- a/pelican/themes/simple/templates/page.html +++ b/pelican/themes/simple/templates/page.html @@ -2,5 +2,8 @@ {% block title %}{{ page.title }}{%endblock%} {% block content %}

      {{ page.title }}

      + {% import 'translations.html' as translations with context %} + {{ translations.translations_for(page) }} + {{ page.content }} {% endblock %} diff --git a/pelican/themes/simple/templates/translations.html b/pelican/themes/simple/templates/translations.html new file mode 100644 index 00000000..db8c372d --- /dev/null +++ b/pelican/themes/simple/templates/translations.html @@ -0,0 +1,9 @@ +{% macro translations_for(article) %} +{% if article.translations %} +Translations: +{% for translation in article.translations %} +{{ translation.lang }} +{% endfor %} +{% endif %} +{% endmacro %} + From 3e454045e9036131e30729f5755c27ef3134ba9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Pievil=C3=A4inen?= Date: Wed, 21 Nov 2012 15:45:00 +0200 Subject: [PATCH 0183/1975] Update test data --- tests/output/custom/a-markdown-powered-article.html | 3 +++ tests/output/custom/article-1.html | 3 +++ tests/output/custom/article-2.html | 3 +++ tests/output/custom/article-3.html | 3 +++ tests/output/custom/author/alexis-metaireau.html | 12 ++++++++++++ tests/output/custom/author/alexis-metaireau2.html | 12 ++++++++++++ tests/output/custom/category/bar.html | 3 +++ tests/output/custom/category/cat1.html | 12 ++++++++++++ tests/output/custom/category/misc.html | 6 ++++++ tests/output/custom/category/yeah.html | 3 +++ tests/output/custom/drafts/a-draft-article.html | 3 +++ tests/output/custom/index.html | 12 ++++++++++++ tests/output/custom/index2.html | 12 ++++++++++++ tests/output/custom/oh-yeah-fr.html | 3 +++ tests/output/custom/oh-yeah.html | 3 +++ .../custom/pages/this-is-a-test-hidden-page.html | 4 ++++ tests/output/custom/pages/this-is-a-test-page.html | 4 ++++ tests/output/custom/second-article-fr.html | 3 +++ tests/output/custom/second-article.html | 3 +++ tests/output/custom/tag/bar.html | 12 ++++++++++++ tests/output/custom/tag/baz.html | 6 ++++++ tests/output/custom/tag/foo.html | 9 +++++++++ tests/output/custom/tag/foobar.html | 3 +++ tests/output/custom/tag/oh.html | 3 +++ tests/output/custom/tag/yeah.html | 3 +++ tests/output/custom/this-is-a-super-article.html | 3 +++ tests/output/custom/unbelievable.html | 3 +++ 27 files changed, 149 insertions(+) diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 9ca4763c..6e495efb 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -76,6 +76,9 @@ + + +

      You're mutually oblivious.

      diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index b0e0f879..e94373a9 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -76,6 +76,9 @@ + + +

      Article 1

      diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index 973b870a..f39bb27b 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -76,6 +76,9 @@ + + +

      Article 2

      diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index 7697a4ef..f0cc6c34 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -76,6 +76,9 @@ + + +

      Article 3

      diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index c64aacb9..42b84647 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -74,6 +74,9 @@ + + +

      You're mutually oblivious.

      There are comments.

      @@ -113,6 +116,9 @@ + + +

      Article 1

      @@ -148,6 +154,9 @@ + + +

      Article 2

      @@ -183,6 +192,9 @@ + + +

      Article 3

      diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 53f001fa..32b55f6f 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -82,11 +82,14 @@

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      @@ -127,11 +130,14 @@ YEAH !

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      @@ -167,6 +173,9 @@ Translations:

      tags: foobarfoobar

      + + +

      Multi-line metadata should be supported as well as inline markup.

      @@ -203,6 +212,9 @@ as well as inline markup.

      + + +

      Or completely awesome. Depends the needs.

      diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index e645f4e2..87263d13 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -74,11 +74,14 @@

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index 4d76e095..af5ad56c 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -74,6 +74,9 @@ + + +

      You're mutually oblivious.

      There are comments.

      @@ -113,6 +116,9 @@ + + +

      Article 1

      @@ -148,6 +154,9 @@ + + +

      Article 2

      @@ -183,6 +192,9 @@ + + +

      Article 3

      diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index a0ac83a5..90948668 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -74,11 +74,14 @@

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      There are comments.

      @@ -119,6 +122,9 @@ Translations: + + +

      Or completely awesome. Depends the needs.

      diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index ece5f0eb..a848c4a4 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -74,6 +74,9 @@

      tags: foobarfoobar

      + + +

      Some content here !

      This is a simple title

      diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index e38fb7b2..bcfd1243 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -76,6 +76,9 @@ + + +

      This is a draft article, it should live under the /drafts/ folder and not be listed anywhere else.

      diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index 80913795..3bcea824 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -74,11 +74,14 @@

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      There are comments.

      @@ -119,6 +122,9 @@ Translations: + + +

      You're mutually oblivious.

      read more @@ -153,6 +159,9 @@ Translations: + + +

      Article 1

      @@ -188,6 +197,9 @@ Translations: + + +

      Article 2

      diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 1eb336b6..bba153f4 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -82,6 +82,9 @@ + + +

      Article 3

      @@ -117,6 +120,9 @@

      tags: foobarfoobar

      + + +

      Multi-line metadata should be supported as well as inline markup.

      @@ -153,11 +159,14 @@ as well as inline markup.

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      @@ -198,6 +207,9 @@ YEAH !

      + + +

      Or completely awesome. Depends the needs.

      diff --git a/tests/output/custom/oh-yeah-fr.html b/tests/output/custom/oh-yeah-fr.html index fb669e9b..ddc17b30 100644 --- a/tests/output/custom/oh-yeah-fr.html +++ b/tests/output/custom/oh-yeah-fr.html @@ -76,11 +76,14 @@ + + Translations: en +

      Et voila du contenu en français

      diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index c4eb421f..a48044ab 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -76,11 +76,14 @@

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      diff --git a/tests/output/custom/pages/this-is-a-test-hidden-page.html b/tests/output/custom/pages/this-is-a-test-hidden-page.html index 913a5974..2b489963 100644 --- a/tests/output/custom/pages/this-is-a-test-hidden-page.html +++ b/tests/output/custom/pages/this-is-a-test-hidden-page.html @@ -55,6 +55,10 @@

      This is a test hidden page

      + + + +

      This is great for things like error(404) pages Anyone can see this page but it's not linked to anywhere!

      diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 87e4925f..7d74011d 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -55,6 +55,10 @@

      This is a test page

      + + + +

      Just an image.

      alternate text diff --git a/tests/output/custom/second-article-fr.html b/tests/output/custom/second-article-fr.html index 1100df29..cd1ee194 100644 --- a/tests/output/custom/second-article-fr.html +++ b/tests/output/custom/second-article-fr.html @@ -76,11 +76,14 @@

      tags: foobarbaz

      + + Translations: en +

      Ceci est un article, en français.

      diff --git a/tests/output/custom/second-article.html b/tests/output/custom/second-article.html index 7a908526..ebabacc3 100644 --- a/tests/output/custom/second-article.html +++ b/tests/output/custom/second-article.html @@ -76,11 +76,14 @@

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index 03ce0de3..b9ef8402 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -74,11 +74,14 @@

      tags: foobarbaz

      + + Translations: en +

      Ceci est un article, en français.

      There are comments.

      @@ -119,11 +122,14 @@ Translations:

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      @@ -159,6 +165,9 @@ Translations:

      tags: foobarfoobar

      + + +

      Multi-line metadata should be supported as well as inline markup.

      @@ -195,11 +204,14 @@ as well as inline markup.

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      diff --git a/tests/output/custom/tag/baz.html b/tests/output/custom/tag/baz.html index e32cc9ea..29c1fae9 100644 --- a/tests/output/custom/tag/baz.html +++ b/tests/output/custom/tag/baz.html @@ -74,11 +74,14 @@

      tags: foobarbaz

      + + Translations: en +

      Ceci est un article, en français.

      There are comments.

      @@ -119,11 +122,14 @@ Translations:

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      diff --git a/tests/output/custom/tag/foo.html b/tests/output/custom/tag/foo.html index 9c295933..04415b2c 100644 --- a/tests/output/custom/tag/foo.html +++ b/tests/output/custom/tag/foo.html @@ -74,11 +74,14 @@

      tags: foobarbaz

      + + Translations: en +

      Ceci est un article, en français.

      There are comments.

      @@ -119,11 +122,14 @@ Translations:

      tags: foobarbaz

      + + Translations: fr +

      This is some article, in english

      @@ -159,6 +165,9 @@ Translations:

      tags: foobarfoobar

      + + +

      Multi-line metadata should be supported as well as inline markup.

      diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index cad2dae3..38c4c61e 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -74,6 +74,9 @@

      tags: foobarfoobar

      + + +

      Some content here !

      This is a simple title

      diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html index 53d45369..498b3fde 100644 --- a/tests/output/custom/tag/oh.html +++ b/tests/output/custom/tag/oh.html @@ -74,11 +74,14 @@

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index bfd7b4cd..16d325f2 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -74,11 +74,14 @@

      tags: ohbaryeah

      + + Translations: fr +

      Why not ?

      After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index f1e3fa40..8d024437 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -76,6 +76,9 @@

      tags: foobarfoobar

      + + +

      Some content here !

      diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html index e08b2952..1a1b0788 100644 --- a/tests/output/custom/unbelievable.html +++ b/tests/output/custom/unbelievable.html @@ -76,6 +76,9 @@ + + +

      Or completely awesome. Depends the needs.

      From 587184c778b69381392626147d6910a8ea0d71b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 21 Nov 2012 16:38:27 +0100 Subject: [PATCH 0184/1975] trim the blocks when generating templates. --- pelican/generators.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pelican/generators.py b/pelican/generators.py index d7476850..e0aaa130 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -47,6 +47,7 @@ class Generator(object): simple_loader = FileSystemLoader(os.path.join(theme_path, "themes", "simple", "templates")) self.env = Environment( + trim_blocks=True, loader=ChoiceLoader([ FileSystemLoader(self._templates_path), simple_loader, # implicit inheritance From 09ddd92efc29f042a0c349dcb63e38caa7ece047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 21 Nov 2012 16:39:05 +0100 Subject: [PATCH 0185/1975] update the output for functional tests --- .../basic/a-markdown-powered-article.html | 57 +--- tests/output/basic/archives.html | 50 +--- tests/output/basic/article-1.html | 57 +--- tests/output/basic/article-2.html | 57 +--- tests/output/basic/article-3.html | 57 +--- .../output/basic/author/alexis-metaireau.html | 105 ++----- tests/output/basic/categories.html | 46 +-- tests/output/basic/category/bar.html | 78 ++---- tests/output/basic/category/cat1.html | 152 +++------- tests/output/basic/category/misc.html | 107 ++----- tests/output/basic/category/yeah.html | 71 ++--- .../output/basic/drafts/a-draft-article.html | 57 +--- tests/output/basic/feeds/all-en.atom.xml | 10 +- tests/output/basic/feeds/all-fr.atom.xml | 4 +- tests/output/basic/feeds/all.atom.xml | 12 +- tests/output/basic/feeds/cat1.atom.xml | 6 +- tests/output/basic/feeds/misc.atom.xml | 4 +- tests/output/basic/index.html | 262 +++++------------- tests/output/basic/oh-yeah-fr.html | 62 +---- tests/output/basic/oh-yeah.html | 63 ++--- .../pages/this-is-a-test-hidden-page.html | 42 +-- .../basic/pages/this-is-a-test-page.html | 42 +-- tests/output/basic/second-article-fr.html | 64 +---- tests/output/basic/second-article.html | 64 +---- tests/output/basic/tag/bar.html | 169 +++-------- tests/output/basic/tag/baz.html | 114 ++------ tests/output/basic/tag/foo.html | 138 +++------ tests/output/basic/tag/foobar.html | 71 ++--- tests/output/basic/tag/oh.html | 78 ++---- tests/output/basic/tag/yeah.html | 78 ++---- tests/output/basic/theme/css/main.css | 5 +- .../basic/theme/images/icons/delicious.png | Bin 963 -> 958 bytes .../basic/theme/images/icons/facebook.png | Bin 300 -> 202 bytes .../basic/theme/images/icons/github.png | Bin 0 -> 346 bytes .../basic/theme/images/icons/gitorious.png | Bin 3675 -> 227 bytes .../basic/theme/images/icons/gittip.png | Bin 671 -> 487 bytes .../basic/theme/images/icons/google-plus.png | Bin 0 -> 527 bytes .../basic/theme/images/icons/lastfm.png | Bin 980 -> 975 bytes .../basic/theme/images/icons/linkedin.png | Bin 376 -> 896 bytes tests/output/basic/theme/images/icons/rss.png | Bin 896 -> 879 bytes .../basic/theme/images/icons/twitter.png | Bin 835 -> 830 bytes .../output/basic/this-is-a-super-article.html | 56 +--- tests/output/basic/unbelievable.html | 57 +--- .../custom/a-markdown-powered-article.html | 110 ++------ tests/output/custom/archives.html | 98 ++----- tests/output/custom/article-1.html | 110 ++------ tests/output/custom/article-2.html | 110 ++------ tests/output/custom/article-3.html | 110 ++------ .../custom/author/alexis-metaireau.html | 220 ++++----------- .../custom/author/alexis-metaireau2.html | 236 +++++----------- tests/output/custom/categories.html | 94 ++----- tests/output/custom/category/bar.html | 140 +++------- tests/output/custom/category/cat1.html | 217 ++++----------- tests/output/custom/category/misc.html | 170 +++--------- tests/output/custom/category/yeah.html | 133 +++------ .../output/custom/drafts/a-draft-article.html | 110 ++------ tests/output/custom/index.html | 227 ++++----------- tests/output/custom/index2.html | 229 ++++----------- tests/output/custom/oh-yeah-fr.html | 115 ++------ tests/output/custom/oh-yeah.html | 117 +++----- .../pages/this-is-a-test-hidden-page.html | 94 ++----- .../custom/pages/this-is-a-test-page.html | 94 ++----- tests/output/custom/second-article-fr.html | 117 +++----- tests/output/custom/second-article.html | 117 +++----- tests/output/custom/tag/bar.html | 238 +++++----------- tests/output/custom/tag/baz.html | 177 +++--------- tests/output/custom/tag/foo.html | 204 ++++---------- tests/output/custom/tag/foobar.html | 133 +++------ tests/output/custom/tag/oh.html | 140 +++------- tests/output/custom/tag/yeah.html | 140 +++------- .../custom/this-is-a-super-article.html | 110 ++------ tests/output/custom/unbelievable.html | 110 ++------ 72 files changed, 1652 insertions(+), 4863 deletions(-) create mode 100644 tests/output/basic/theme/images/icons/github.png create mode 100644 tests/output/basic/theme/images/icons/google-plus.png diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index 6f41ddde..5a29c0b7 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -4,11 +4,8 @@ A markdown powered article - - - - - + + @@ -22,36 +19,23 @@ -
    - -
    +
    -
    - - -
    +
    - - - \ No newline at end of file diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 058b47f3..fc2af483 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -4,11 +4,8 @@ A Pelican Blog - - - - - + + @@ -22,64 +19,40 @@ -
- -
+

Archives for A Pelican Blog

-
Wed 29 February 2012
Second article
-
Wed 20 April 2011
A markdown powered article
-
Thu 17 February 2011
Article 1
-
Thu 17 February 2011
Article 2
-
Thu 17 February 2011
Article 3
-
Thu 02 December 2010
This is a super article !
-
Wed 20 October 2010
Oh yeah !
-
Fri 15 October 2010
Unbelievable !
-
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index 2a389510..85644e68 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -4,11 +4,8 @@ Article 1 - - - - - + + @@ -22,36 +19,23 @@ - - -
+
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index 798ec4a5..e32851bb 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -4,11 +4,8 @@ Article 2 - - - - - + + @@ -22,36 +19,23 @@ - - -
+
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 49bad541..29406243 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -4,11 +4,8 @@ Article 3 - - - - - + + @@ -22,36 +19,23 @@ - - -
+
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index f1089963..014127c5 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -4,11 +4,8 @@ A Pelican Blog - Alexis Métaireau - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
+ - - - - - - - - - - - -
- - -
+ + +
+
@@ -148,8 +98,5 @@ as well as inline markup.

The theme is by Smashing Magazine, thanks!

- - - \ No newline at end of file diff --git a/tests/output/basic/categories.html b/tests/output/basic/categories.html index f9bd569b..e94987b8 100644 --- a/tests/output/basic/categories.html +++ b/tests/output/basic/categories.html @@ -4,11 +4,8 @@ A Pelican Blog - - - - - + + @@ -22,44 +19,24 @@ - - - - - - - + + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/category/cat1.html b/tests/output/basic/category/cat1.html index 5f376e6a..3d592144 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -4,11 +4,8 @@ A Pelican Blog - cat1 - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
- - - -
- - - - -
- - -
+ + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index fb862c5a..5ebcfe92 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -4,11 +4,8 @@ A Pelican Blog - misc - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
  1. + +
  2. Unbelievable !

    @@ -102,37 +66,17 @@ Translations: Fri 15 October 2010 - -
    - By Dummy Author -
    - -

    In misc.

    +

    In misc.

    - - - -

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

    read more - - +
  3. - - -
- - - -
- - - - -
- - -
+ + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/category/yeah.html b/tests/output/basic/category/yeah.html index 5dcf2857..5aef966a 100644 --- a/tests/output/basic/category/yeah.html +++ b/tests/output/basic/category/yeah.html @@ -4,11 +4,8 @@ A Pelican Blog - yeah - - - - - + + @@ -22,34 +19,20 @@ - - - - - + + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html index 7da9c416..71e778ce 100644 --- a/tests/output/basic/drafts/a-draft-article.html +++ b/tests/output/basic/drafts/a-draft-article.html @@ -4,11 +4,8 @@ A draft article - - - - - + + @@ -22,36 +19,23 @@ - - -
+

A draft article

- -
+
-

This is a draft article, it should live under the /drafts/ folder and not be +

This is a draft article, it should live under the /drafts/ folder and not be listed anywhere else.

-
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index 16163dc0..c7e53da6 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,8 +1,8 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00ZDummy Authortag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> @@ -21,5 +21,5 @@ YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index 979e21ef..2cfb5ea6 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog/2012-09-17T15:02:39ZTrop bien !2012-09-17T15:02:39ZDummy Authortag:,2012-09-17:oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00ZDummy Authortag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> +A Pelican Blog/2012-09-17T15:02:39ZTrop bien !2012-09-17T15:02:39Ztag:,2012-09-17:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index 27c92e6d..a439882f 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,8 +1,10 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:,2012-02-29:second-article.html<p>This is some article, in english</p> -A markdown powered article2011-04-20T00:00:00ZDummy Authortag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog/2012-09-17T15:02:39ZTrop bien !2012-09-17T15:02:39Ztag:,2012-09-17:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> +A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> @@ -21,5 +23,5 @@ YEAH !</p> <img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index 4ff8e6ca..68e6f4cf 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,5 +1,5 @@ -A Pelican Blog/2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00ZDummy Authortag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-1.html<p>Article 1</p> -Article 22011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-2.html<p>Article 2</p> -Article 32011-02-17T00:00:00ZDummy Authortag:,2011-02-17:article-3.html<p>Article 3</p> +A Pelican Blog/2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> +Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml index ec3c79bc..dce36d06 100644 --- a/tests/output/basic/feeds/misc.atom.xml +++ b/tests/output/basic/feeds/misc.atom.xml @@ -1,4 +1,4 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:,2012-02-29:second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 18673102..8a063033 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -4,11 +4,8 @@ A Pelican Blog - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
  1. + +
  2. - - - + - - - -
  3. + +
  4. - - - + - - - -
  5. + +
  6. - - - + - - - -
  7. + +
  8. - - - + - - - -
  9. + +
  10. - - - + - - - -
  11. + +
  12. Oh yeah !

    @@ -277,22 +179,14 @@ as well as inline markup.

    Wed 20 October 2010 - -
    +
    By Alexis Métaireau
    - -

    In bar.

    -

    tags: ohbaryeah

    - - -Translations: +

    In bar.

    +

    tags: ohbaryeah

    Translations: + fr - fr - - - -
    +

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    @@ -300,17 +194,12 @@ YEAH !

    read more - -
    +
  13. - - - + - - - -
  14. + +
  15. Unbelievable !

    @@ -322,37 +211,17 @@ YEAH !

    Fri 15 October 2010 - -
    - By Dummy Author -
    - -

    In misc.

    +

    In misc.

    - - - -

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

    read more - - +
  16. - - -
- - - -
- - - - -
- - -
+ + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html index 335428ef..5143907f 100644 --- a/tests/output/basic/oh-yeah-fr.html +++ b/tests/output/basic/oh-yeah-fr.html @@ -4,11 +4,8 @@ Trop bien ! - - - - - + + @@ -22,36 +19,23 @@ - - -
+

Trop bien !

- -
+
@@ -59,33 +43,18 @@ Mon 17 September 2012 - -
- By Dummy Author -
- -

In misc.

- - - +

In misc.

Translations: + en - en - - -
-

Et voila du contenu en français

+

Et voila du contenu en français

-
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index b172f2eb..0e06699d 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -4,11 +4,8 @@ Oh yeah ! - - - - - + + @@ -22,36 +19,23 @@ - - -
+

Oh yeah !

- -
+
-
+

Why not ?

After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

@@ -83,14 +59,10 @@ YEAH !

-
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/pages/this-is-a-test-hidden-page.html b/tests/output/basic/pages/this-is-a-test-hidden-page.html index e3b3f5f5..a8c624d5 100644 --- a/tests/output/basic/pages/this-is-a-test-hidden-page.html +++ b/tests/output/basic/pages/this-is-a-test-hidden-page.html @@ -4,11 +4,8 @@ This is a test hidden page - - - - - + + @@ -22,40 +19,26 @@ -

This is a test hidden page

- -

This is great for things like error(404) pages + +

This is great for things like error(404) pages Anyone can see this page but it's not linked to anywhere!

-
- - -
+
@@ -65,8 +48,5 @@ Anyone can see this page but it's not linked to anywhere!

The theme is by Smashing Magazine, thanks!

- - - \ No newline at end of file diff --git a/tests/output/basic/pages/this-is-a-test-page.html b/tests/output/basic/pages/this-is-a-test-page.html index f68a97d6..1584309c 100644 --- a/tests/output/basic/pages/this-is-a-test-page.html +++ b/tests/output/basic/pages/this-is-a-test-page.html @@ -4,11 +4,8 @@ This is a test page - - - - - + + @@ -22,40 +19,26 @@ -

This is a test page

- -

Just an image.

+ +

Just an image.

alternate text
-
- - -
+ - - - \ No newline at end of file diff --git a/tests/output/basic/second-article-fr.html b/tests/output/basic/second-article-fr.html index 6dcc1a91..742bfa20 100644 --- a/tests/output/basic/second-article-fr.html +++ b/tests/output/basic/second-article-fr.html @@ -4,11 +4,8 @@ Deuxième article - - - - - + + @@ -22,36 +19,23 @@ - - -
+
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/second-article.html b/tests/output/basic/second-article.html index e33300aa..a672f9c6 100644 --- a/tests/output/basic/second-article.html +++ b/tests/output/basic/second-article.html @@ -4,11 +4,8 @@ Second article - - - - - + + @@ -22,36 +19,23 @@ - - -
+
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index 77462fe6..4bc5adc0 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -4,11 +4,8 @@ A Pelican Blog - bar - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
  1. + +
  2. - - - + - - - -
  3. + +
  4. - - - + - - - -
  5. + +
  6. Oh yeah !

    @@ -178,22 +116,14 @@ as well as inline markup.

    Wed 20 October 2010 - -
    +
    By Alexis Métaireau
    - -

    In bar.

    -

    tags: ohbaryeah

    - - -Translations: +

    In bar.

    +

    tags: ohbaryeah

    Translations: + fr - fr - - - -
    +

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    @@ -201,24 +131,12 @@ YEAH !

    read more - -
    +
  7. - - -
- - - -
- - - - -
- - -
+ + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/tag/baz.html b/tests/output/basic/tag/baz.html index 4ebe1f1d..21dc22f5 100644 --- a/tests/output/basic/tag/baz.html +++ b/tests/output/basic/tag/baz.html @@ -4,11 +4,8 @@ A Pelican Blog - baz - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
- - - -
- - - - -
- - -
+ + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/tag/foo.html b/tests/output/basic/tag/foo.html index d1e2dbb8..e5997631 100644 --- a/tests/output/basic/tag/foo.html +++ b/tests/output/basic/tag/foo.html @@ -4,11 +4,8 @@ A Pelican Blog - foo - - - - - + + @@ -22,34 +19,20 @@ - - - - - +

Other articles


    - - - - - + - - - -
  1. + +
  2. - - - + - - - -
- - - -
- - - - -
- - -
+ + +
+
@@ -183,8 +114,5 @@ as well as inline markup.

The theme is by Smashing Magazine, thanks!

- - - \ No newline at end of file diff --git a/tests/output/basic/tag/foobar.html b/tests/output/basic/tag/foobar.html index bd4a7b66..211a73bd 100644 --- a/tests/output/basic/tag/foobar.html +++ b/tests/output/basic/tag/foobar.html @@ -4,11 +4,8 @@ A Pelican Blog - foobar - - - - - + + @@ -22,34 +19,20 @@ - - - - - + + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/tag/oh.html b/tests/output/basic/tag/oh.html index b77856dd..a286ca8d 100644 --- a/tests/output/basic/tag/oh.html +++ b/tests/output/basic/tag/oh.html @@ -4,11 +4,8 @@ A Pelican Blog - oh - - - - - + + @@ -22,34 +19,20 @@ - - - - - + + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/tag/yeah.html b/tests/output/basic/tag/yeah.html index 90f34fe0..1e91b765 100644 --- a/tests/output/basic/tag/yeah.html +++ b/tests/output/basic/tag/yeah.html @@ -4,11 +4,8 @@ A Pelican Blog - yeah - - - - - + + @@ -22,34 +19,20 @@ - - - - - + + +
+
- - - \ No newline at end of file diff --git a/tests/output/basic/theme/css/main.css b/tests/output/basic/theme/css/main.css index 3d94200b..29cce82c 100644 --- a/tests/output/basic/theme/css/main.css +++ b/tests/output/basic/theme/css/main.css @@ -309,7 +309,10 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} .social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');} .social a[href*='linkedin.com'] {background-image: url('../images/icons/linkedin.png');} .social a[href*='gitorious.org'] {background-image: url('../images/icons/gitorious.png');} - .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} + .social a[href*='github.com'], + .social a[href*='git.io'] {background-image: url('../images/icons/github.png');} + .social a[href*='gittip.com'] {background-image: url('../images/icons/gittip.png');} + .social a[href*='plus.google.com'] {background-image: url('../images/icons/google-plus.png');} /* About diff --git a/tests/output/basic/theme/images/icons/delicious.png b/tests/output/basic/theme/images/icons/delicious.png index c6ce246a4602f8f74e75ea8cfe9f5a00daceeb33..3dccdd848ec99fba9950e8195d4e73867ada2738 100644 GIT binary patch delta 825 zcmV-91IGNr2fhc8l7AOTL_t(I5e31$ZyR+Sz~RsR?&phr@k{KwZtJ8rq)AI+DoYGR zC_<Oerq^Ob`+NMdMNmJK})5LG*d-L6W zc^(6xSS(h?<8dRCv6pJK*-N!ry|lD=zU=6Cvvz*9eR|Y8ZGZP?(}Q5zu4Ye;Yw6U< z%$bdQs2_ec*4Ey;wYBn;5kze=d5?*!aR(Wra;~tbOQk6n6iE^S28IC;10{@PkM=_sWfibg}N~Hk+008J5K8N8Pi863TKFA4#Hh*A4LHxOMyT9w>A|jE91R@fPNF*X6Uw!$hG@H#gbvAe5wL~g-eup^rQ51og zp);b<%zv>^j{y^y03niqp-c{sG_BT_qiPrDe~O}j;qVY7MvR0=e89tT48Q~+iXe(0 z5da7Szq_*X#=c5t?5!{y68J805+M>0_z_^U^LUHy(Gvhb05FsS1cCng`k$w&UZ0x| z0uQY|E3Pp}ktUY9r? z14j_0@d5$B_Z=+DVmR~|IWB$}mM>H*v$|ft{9t3_8G-9yY7Y#LsVRkJX3(iJpMCzF zEX-G(o!tYKB)aGO!M}TZ8^dBTeR$)>Cv9!p_HOg)(${Nmzm=^2eRt!qyLG(s`nCRG zm@*E1KbX?WJ$-q;+RNr<%sY4f7_?eHhX4RqE;sleG7W{b+8`d-UX>0Lw_Sg01_C6gQ*jEVV3R?>>)IFTt-owgqb9j7)Y+P_(Yqg0SFKiMFKz~ z0T7c(3$0d27zs!15W*(uoXg13IK8w{K9ir-#p0L)iZ~7c1H%A_fFee`P4j_+GV@s3 zeN@hYNJu6XuAgM>Z}pDO<&u2>rBW}f(As+j{V8H)V1ExhkV6P8z=FJZQ)jk*(+39! z_g7b!7rI@Kjg2Qfe6WUX2W&q4m9>AbkbdcF>N7oxr3%(~flSKebasN)?kzQL-rD7r zOZ6X4m**v)zbsG|$Ot3_kjmLb+1wTp2}Q&gk?16geEG#E(r7f^)S2wL*J3H-dM%>J zLs0-C`hWI-dLzqBEdmn22ndiE43%JSU$eTpZma6~=^w+;r{CWLi4Y?u6c2E*ZQ}%n zFg$iFCol26_QJv&J1Uj7)`Osr?>R(qh=`Bxg@DE8qjlQ*k548&CJm(kL7=<5{Kt{1 z)uzUM-$iSUNQ8)g(punocZ59{0-$vYtxc3+0)Ga*Znt>#>NQL6>^u&#**t!5h^fGJ z+eFb2*oQEM>mN6Jo{edm^!qLY+rbNh(z!}`QrBu1@2{*p#dmBH+6BX9Y)oM$(&%J~ zPe1!sW~M9l=GLx?W8LvQ|DWycm42a++Pi-J147KiQBh-@2#%>6#Rd*OBd_>2Qm$Xwckl|rT_o{07*qo IM6N<$f};Ym*CsGUh074yEL{XMZ7cf&`*=*r72Z+j+2B5y<+hzU#(AFv z+!m8y#^HcNtmEqdUmXGsPJ&&BYk)<>PJbac!3$@wEwC5mE`k2GKxqL+9X1|{k^fkb zPG1EuO5&~{J{6@4w%#7&G9!Ay3~z07*qoM6N<$f=VTic>n+a literal 0 HcmV?d00001 diff --git a/tests/output/basic/theme/images/icons/gitorious.png b/tests/output/basic/theme/images/icons/gitorious.png index 6485f5ecc5f6047a052d9adfb686ee154e7233af..3eeb3ecec36a73ff505e04ecdecbcc4792ef6786 100644 GIT binary patch delta 199 zcmV;&0672K9OD6yB!4_mOjJbxdO9bDQz(m9HIZRZpK)ubh)uJ7cde3mxs-3gmU_mX zpuexJ#ki)~zOmiL)z#I~?BD9@>fQ0@|NsA$KGRG9003f1L_t&-(|ye`5`Z8K0Ko$# z3IP-G|9`cS8ED+{nj_01Be_koAnlp75qc?o2`=J4p}Suqmq2^}LK)BUG$EY#9zOeh z21r&_4>(k-B_NrZDX5wKgt~2Y2}1&6nnZ{!;tLK&3GEfRNsIsh002ovPDHLkV1iD^ BTdx2B literal 3675 zcmeH}_cs;(AIIM!du1jmd)(}q&As*>mwP2~txFP0S<$suA0ydaQQ0fx>V~qnD`Z|H zDsM1YRfBtf8PhSR$Jg1$Z#Z(m^oWl9R>38%Fr zV-o!|&8oo5l;~FpNdreqVXu59TS#ArPaCJS)~oig4I?ydw2WCs3f4*(#&YPD3tysp zyLy&ZrFA0dh5gU|Zg3a4e&2NdXtJ$6v<*278zrMgbh332;&r zrUQOx5VdKotgD z`hA5QR(*4vZDlM6DVAhkU}Z6+_|xb0_{drY{|m>{Rte_f~M(8MshYu zaDF=@zFp0G=Tzfw8oWz^vUSY}hTV7;tYWO}x%9@qin2NJ zz-^>1h>9&zzl~0rDhSGtx}s}@G(%cU8$HTuwl1u5UTNv!XK>?b2$mG^VXBOK5UJE9S~ooN=pm#z z=Y+30S+kBG1X@TR1#Igi$iJ}=^&f}&} zMOJneveKy1y3%l~Rk>!n6kF1&-|TP{$*kLJB6d^E5S>amk6pK&v7IlaFXb}VR6D4V zuJ9@5Eo#;a`gpf=C#T@UElh!#U+F?f>-wL|;W8)i6W>3j2ZoGD>IOz(Y9b@yqDHq; zfS(4ROfT`LHO#3~2Ud*AL}f31fDf#vM_57*)#U_^`9#`UW=N*s1@ zEq7yYs5%rQ?QS?V7*u1cMJAi8n@ca0;w>^PDhnpjoo{~P`f=q=Ja5*fsfjf>UtBl} z?aGaA>aOYB$!N_8e;@wOi6#wG{0ws?-wnQq`)}`YsM)J6(+pxFMPwjlUngmyn!j8Z{`LttFk$+cV$Sx@r=55a6^FI(C4~Z^-Z1 zE+f|NDDQah#LvALQhXs%;Gl5-Q)eISi}l*5Hp7cdS)awK2uqk{B)V~3NXAVj9Z@~? zrl~lnf`t0Pt@TUm-isBj6%CaI`2`2(A(ghKzNSITPQL=@*hSc5A+kF;lspPbF(MRb z%EUZV3jN3FG23wZT?PpcLnt>+NZ3Es@H zRuSJOKhdDRqLMo!7{y}aV-a!MDgFt_OQUkxN|4l`e}Mv0JK8DJOhW`M1S>s zI9TNoTYuVpH@QjXN+wOePeWSOc?T(a9JJ&c{D$}xgr*+tf$;n|oH(GGRatOtczdW} zfS9K8{KpIOHd_bV(ob7dVMnDLWeueY=wK#j~DvftZIEe3rW#u*^ zyC$MlG}PQD@>csmRC^k8}B#pF?a6S+w#gTy!(jfnCHgV1*rl@=B$eBui4CZnPz6+GA-J_-9GrGPn5|X z7AH1G<6!t#A2r^!c$D@NhSjyS)ZyLH9p12(Uy9!+h>k6!6RrLa zL^}#Q^9j!hk0axw29kD7V#UT`){(DMwS{lMb}!`^iFJrNNaR*b0PHDka(5lxuS+ch{+zj-+Oi=YCHqIJMsjZi4BjC{ypbHe2EKN zcOxv`X7T&+o;7f3OrM;*uHK?fxVif-aJQbg#*TQ0$g5Rz_T3EJ)Hux;x9n|x-kev1 zzv+YD32ki*^CWHX7N`*B_gh1La*-z|3RE@cTlYf!NZq7^MXvdXdtxVq!RDDDv7PD` z%NFN-oo(G2*nIqiw&UsC^pCm6x7&gW_eSRoNz}2?Bd6&HsVuPbsky0xaZGVr1=qDy zRhPBzoopPJ!baRjL<_i2U!D%uaC6B-98PRa5k_-Hi?VmKGd}u0Dn8k4+v2Gu_H^`I z`OqJ%Aa`ru{%E^BXfBBF$E!sa%hgBxkHyJezv~WcKb0P3@ML6=sVH;yj@=Zbh-ZD1 z-_6Lz9Dq;}05H)2{3f6I1^^Fa0oZf_KrIIVZoj9_-39ZfDh7YjeuipAOblqHnRd;pX1guKpVP^?KjrDZl!Lxy>?erb8ta^(jygszj+vLaYB8AoV>@2=0&gbI-vZ)aP<#t2rh=>% z4uBFcLlywp|AF`)lt#v2F_0Q$J;*j+Ou*EHfuU+HqPPTPDok^%yZQe}XCt6Z)(A~N zcBHfM{}?w@xFIl?fc=bY!HpjbZD7OVJuUzD)PENK|M2eZ|NFOZ{Lct+ zMRt)212k~{fo$2ZY~Ftm`1kK0n4Zi?_eO#`O~^wbDXNGM6!8_gwN kRAy|1D^$uYJUPBNklU>nq-!*wY* zC4;*|6YMHgDyXOh9jsz9Dcv*)g5V+u32`wNycWSfXg96&Pc%sJPsJj(q|NJ)yLbsY z`3(p6eb4hgcfWg1@K!3}kT1EUlTM$io)M8@AnF}2scJ<;GJm8%(5kUR3z*0a|DdbCT%J)bh`HezbnMuVYyTyDN+~Cl&G~Hznz$(+AA^3FB9?L}LfIfBP2G<%bw!ICx}`(bE@M z{rZ{f=TEY+{(sAt$E>NMW)=<^fUQ?r}wsXW56LcT0&f`n_;MP5C7>IHPrSLNgK0)H=Or`z@ou;ky^b{A9EE>W*< zpsHZK z>upIAVz}dFal_O6CT?`r$qOAn;FBaOK-k!D!Jidayc;Y>7GYGxnGBxue+IChM|)V`ar=`j`~3M zC07%M|NqZF^fS8TVssIRJYwIy1j>GXU1E8{UJs6dLU1-v!-3nb2Irih=+?6PKKJ@8lF5#&^v9fcghZg&b90USur#Ch_yBx0YzYJ9ftpZ|9@Mbb;3sH7#Llc zapC{3OLv2zTp&7Rr3KUgB!TRsHrfndzX7?Q-YzOS8|-?va>A!K_nuYT9<U;^giL<|Q^RJR%`Z!y$8yYa>Upa1{=xci{g2`qvgF`RFk`e^@wXB(G2 zShMW$$p`;HLHGV;SLhaf#f_+F1DIs^y0_<$oBBFk`Sl>Ab*Ovm_g^4AcawG2Lj|D- zqK4swiTo;US!A@iaP1FZz%33(6Ney%eY$dMwPn_zpvZ?`|G(*ST!StSLI9gPlb*yp RBR2p5002ovPDHLkV1g3B{|5j7 literal 0 HcmV?d00001 diff --git a/tests/output/basic/theme/images/icons/lastfm.png b/tests/output/basic/theme/images/icons/lastfm.png index b09c7876537ad9faa7a7a68ad6c8035d2e32ec3a..3a6c6262b644dadbcf6cce5dfe4fed9740a9ec1f 100644 GIT binary patch delta 842 zcmV-Q1GW6r2hRtPl7A>kL_t(I5e30dY!p=-!13>U^LF-sk?xk2w$KnZDpdlBD2Jw1Np_ZC(a~^^ahDtECA8NxevjB}{B#LnDPOMcfyN(rj=^z~3 z2O_Yt2K5OzdI(zU@cdrbH3rM8$TM|ltYGKw6ZLx)Bb}hk;TK`3g#G3RbhCvTq%b-H z?;eBtPH47Z`v~duFZ8bbMlqiy+3b;&eXS#G%&u|L*?$F+pKqWt2HRdIz4#;U<{WZ( ziryFJaSs}pQzyy2bDX&Gh-jsS6Jp)^{nkJLy<Hd0y}`_qa!RHICj0UZAyYm(;_00EH@>X`%6+0`S0z|WaY#sA|m28 z0ud3hQ7r$wc}nK9lk)GYCzrgBcRu}**NtlZ@2`^FxrZ*7P@OK_Gv^4WuhCyvMCbG9 zu@QRTU1jz38G=75s}(L|(1{~ks}OsRK^S6; zhghpkeqyxIyZ!Khmqh4X7HcgOGnjG#Rq*k&#$^QYJS5TB)*8AufZA5n#P}uCEoDDX zoW9jPQAVP8n?&(2j;iX1Rc%xbXN~H#%WAB8&##Sqsc>`EPd}XbAE?ij UbKRwmQaM~w07vUoteIwd2imk z_wS;{)!F=V@=K0d`SQ~4RAc>Jzg&7z7xM*eJf}P}Z4yc($$#T`Y6V3DkqB#7NqIdo z{u)VACv7enztKE9;QI%OV_01WtpRxqKLwrv*nxB494G~G0uD%GoN~8KCQcq@qym1L z|A%pcI1A39lmY;eP2_SY08;A5;cmdLC*^NEqUptw^g(dJQY^ z!T~t2ck}A<>Za((L1?VOvwL9Y2rR82PgS9|jGenj*zJ^zw1Ogso`-<~_N(vE^#-b+ z!0-^feH5x=P;bEYA(E+|=v@AVd^SzI(IGDST8G$(oqwYwGxNkhUPq-2wz)=f;d|VT zS>(_pozKqU?$^1O zwke!?hkrN<2+o|_OuFX@0^5iB!^14>KYFdUZBl}ZQz9Y~FV!WO{X-HF`RC0~Wcm0< zA|m3}0}&CiVI+UOep2Sr6Y}@VCl9h2vuF{=f zKxeb)ks&(YTw&$ZX@cKwqRS<6yG9q(ou^-&E`NryPkS1>(jwYuW8(-fmqk^|*u{F}A1Yf>O?w*+yx z0CTqhbhrm|xBzvz1a!FqcDf06xd(T;33s;)cDV|7y9#-^3V(UK4tTl@dAbdGx)6D~ z346Q>d%O;MybpT35_-H7db<*PyAOQ56??oAe7qEXzZ8PM6@tJSfxsMsz#E3bAcevo zhQc3+!Xb*pB8tN!io+y}!zGKvCX2);jm0dE#x0JoX$_3 z&P$-qPoL0IpwUyI(p93+RHM;WqtaHS(paR_T&B}wrP5ib(q5<3UZ>Sxr`2Al)Ly97 zV5rq$snuqw(`KsHYOK|5uGnj@)^D%YaIe{Lu-9|2*MD=d*>thlbg|lUvebKVFwb$yn*z3L7?7rLWzuWJ^-|oob@6YA&(B<*a=JM9) z^VjM0*y{D#>-FC4_2%;U|Ns9Oj;1#N0004WQchCH7$m zNsr_-rSbCl=$>a! zT#UcpD5G|76F86FG*L;*?Gy5CNz8~@V3=k75A+&{>?x8{4FCWD07*qoM6N<$f^Ejt Ar~m)} delta 350 zcmV-k0iphY2lxVzBYyw^b5ch_0Itp)=>Px#V^B;~MGyc0KZmWH$J$Alx#;uvdbG^e z=kH&n!$6a@!rkci`}{$ayo$Zj;O+HRp};|mv$WLV^7{O7uFF80y{ypSmBiLho4f!2 z|3HebZLP@V@Az7wzxn$7k-*gO`1*yp(aquNH>hjL00001bbnG#Qvg8b*k%9#00Cl4 zM??UK1szBL000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igk_1|=i3(xCzX004nW zL_t&-({<0$4#FS|1<<0CRVy%Xv>;CX|F0C5;2xYeX_}lgX$wGf`-TVr5tjpQ*#$4m zuBAiHh{xLP3Ri^q)}4&j0`b07*qoM6N<$f`s&<#{d8T diff --git a/tests/output/basic/theme/images/icons/rss.png b/tests/output/basic/theme/images/icons/rss.png index 7d4e85d981cbecb04b76dab5a234dc4690bd15ab..7862c65afeb66ba9cc7e9576a3a62b850b2e184d 100644 GIT binary patch delta 745 zcmV(%-GyYSq$rgqMYKkaS-FvbSn$Jl_*=W(eMC&poDl`J)JE%~!DK`*EMrc$FSLQO^8wa$m zGC9wK$0%|-i+>cWv@WxDg^@ApiX=q=$&o7xCAqD^v z#6g|deBW*3JH|&y~+ElCyQ-AY3ev(6%g(JTUw-+U69u>2XEnzC(V_9^w`BzdLGqpGA|C0Rn+wz0^j z?cy_E@qbEgm}IP;SMGdOw~NjdX(KgEX5{O{I!aTrI2>doH`Iu=Pf60i3vdvDqoYn>itk1VAcp^W5xI@5cu zZ9A~AKLF(C-r5t&Td&v6>o10~v()W06-6~$6!EUQv9*lprj>4|c_*3L8?xDbpUod$ bI0gR$D~Vu?3V6ai00000NkvXXu0mjfF-~l$ delta 762 zcmVF%oP zx>fhy6N_AJx&I-|9nl*0}t+<%LSXEBX}Vzi2I7Kv^W z;wr62&dFo%tO|ghKfXlx;caS7kSQn}gc5uKM1Y0#DrD;r)gVhjK_5J^7=@ocI3Tk8 z5%t}mEf}srF@$UllIxKE3FB2D1~Ut#1p-(_e0o;|y@!7FBwTm}-B?BeC4#3vgZmD_ zpqx-eL6l&@h5DLNDl25yCylorLPp;rpYBJ`bkM<-$$zy&XJKv+*c=oPA>^RdcGocO z^|4z>a{(Sb35%DIBflaWUCfz>QFjZBp}hMA+!o*!5JCWhI3vLdv-@E4JLJM)^p8{M zwgoua!=+>7`_};|cRh#oK;+RvNi2+$zuQKub16jv51d?zwBNAdUx{4b}$ zji|JrAb&I(ka=9Dcn7&Rv4LpBpbOJG(WkzEmoiEdL+?Cp{$NG=mqBT6$zwgnoL zD1unaA_jAf0BAr$f;BUY^O)xHyVy#H`VN6Xm!#iE(@oTXAczN*+DQD*r{~SZW8IMD zh;NZ=gk(KxxgkivbhhKSa{HdFQ5%gFKObr@3Z$_>;3yYcI!BQ-Z@vtk;_|^ zz1*Sk!tr26WmpXvvlgk9v@&P8apqm--o=q_*;oJOuB}wPzkg>OM4=Sf#+U(5Bx-{p zAVDV)UEr|6I9l4TVN>*AT!V)~z?jI`0uF&gcN!OS!6FwnMRbC?j>J0fbfcZnIh6;| zEAd*2JnG<+zu?;$?8m^cI4`=ww0G9U$$}nu(!;9JaU!bTGUvP*5cp{dKc2$19rz66 z!z$2VG(?WFGk;Ye0l9$TIc3Rr%sC$-0`9M1djS7sm6dMx^NjG z5K~vAPQndZKn52A+?~OvYd9(Jtb+;g!y&vqGHw@WidYqPgULIWu`J@Gh_eg{NEse3 z;du+e#HqxIg8|zHjRUAnlS^h8jI9{BG64bGL3}rZ z+e`R+yYoLZrHhp#%l(i50000W delta 701 zcmV;u0z&=12EzuBl7E~@L_t(IjV+Q(Yh6_wN7sMveeN?&Oay6a8y~5lSn5EjLp!l! zK|hT%{R~bz>rh0{VWlAAKoG$W3bptEZD{(qO}y`O&pCVle-7gM0Bf?A-8#;nw$9a2 zkf<-QDif9GBUL^JcPd3^K zty6grof5C4$io&s`V+pM!F~)3iu1fJOgm>?oGj>o#~rL{9VeoCTjrcM0|MVq;ky&K zwgaDFyk7-sjDMQQQFf*ZBp??sJf|%AjydN;M8LfjZ1>^c3{%11P2f=julL}cVdOU# zCoWt@2*lJDsg-bp29Uvp06)**<26hQJZ)hN+&+XihsK=(brGw=ZZLW4GL}V5ia5=X zfRy3E5}q{>Oq@te91Pets2xB}8dVevXT}5+hXTwUZhvgS2fOez8*dN9dt-6WjkSOx zqI8lZby8$e#HGsFt|IeRjDqpmML6j5KgJ&}?sjk?L0=gaEkZEWxnu^x*ouKGV-T<% z#5XgzvxIM_;z0uk!Pqr1>k3VF%#~A>m=_FUVuf*a1bYTq;^qW4X5|8(RTp5d_#;6^-&RG@sYwbL2;Btf=oN0Dqut8cCRb!xa zcvQpwIpgz7;={3%F!qOmA~+lvZ}ebJVO_6zvZ)wi`zafv1+W*5)6V&IVZ1stZoD8$ zDfE+3aaQKXnRCA`oR%KTR?Ihk&AxiJxc+;NH#P^(*qd(IxJ+P0D9ihsLIrY@Suq*| j?ewZ?-D&cY*-!rgG^LA`I>-QU00000NkvXXu0mjf)N@7! diff --git a/tests/output/basic/this-is-a-super-article.html b/tests/output/basic/this-is-a-super-article.html index 2d9cfe74..54b03422 100644 --- a/tests/output/basic/this-is-a-super-article.html +++ b/tests/output/basic/this-is-a-super-article.html @@ -4,11 +4,8 @@ This is a super article ! - - - - - + + @@ -22,36 +19,23 @@ - - -
+
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index b08103a4..6f2c86ce 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -4,11 +4,8 @@ Unbelievable ! - - - - - + + @@ -22,36 +19,23 @@ - - -
+

Unbelievable !

- -
+
-

Or completely awesome. Depends the needs.

+

Or completely awesome. Depends the needs.

-
-
- - -
+
- - - \ No newline at end of file diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 6e495efb..aca81bbf 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -4,13 +4,9 @@ A markdown powered article + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
+
-
- -
+ - - -
+
- - - - \ No newline at end of file diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index fe2ad2c4..5fcca41e 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -4,13 +4,9 @@ Alexis' log + + - - - - - - @@ -24,107 +20,65 @@ - - Fork me on GitHub - - - -
+

Archives for Alexis' log

-
Wed 29 February 2012
Second article
-
Wed 20 April 2011
A markdown powered article
-
Thu 17 February 2011
Article 1
-
Thu 17 February 2011
Article 2
-
Thu 17 February 2011
Article 3
-
Thu 02 December 2010
This is a super article !
-
Wed 20 October 2010
Oh yeah !
-
Fri 15 October 2010
Unbelievable !
-
-
- -
+ - - -
+
- - - - \ No newline at end of file diff --git a/tests/output/custom/article-1.html b/tests/output/custom/article-1.html index e94373a9..85be4fd3 100644 --- a/tests/output/custom/article-1.html +++ b/tests/output/custom/article-1.html @@ -4,13 +4,9 @@ Article 1 + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
+

Article 1

- -
+
-

Article 1

+

Article 1

- -
+

Comments !

-
-
- -
+ - - -
+
- - - - \ No newline at end of file diff --git a/tests/output/custom/article-2.html b/tests/output/custom/article-2.html index f39bb27b..7c00b698 100644 --- a/tests/output/custom/article-2.html +++ b/tests/output/custom/article-2.html @@ -4,13 +4,9 @@ Article 2 + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
+

Article 2

- -
+
-

Article 2

+

Article 2

- -
+

Comments !

-
-
- -
+ - - -
+
- - - - \ No newline at end of file diff --git a/tests/output/custom/article-3.html b/tests/output/custom/article-3.html index f0cc6c34..42e6e9ca 100644 --- a/tests/output/custom/article-3.html +++ b/tests/output/custom/article-3.html @@ -4,13 +4,9 @@ Article 3 + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
+

Article 3

- -
+
-

Article 3

+

Article 3

- -
+

Comments !

-
-
- -
+ - - -
+
- - - - \ No newline at end of file diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 42b84647..f809217d 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -4,13 +4,9 @@ Alexis' log - Alexis Métaireau + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - +

Other articles


    - - - - - + - - - -
  1. + +
  2. - - - + - - - -
- - -

- - Page 1 / 2 - - » - -

- - -
- - - - -
- -
+ +

+ Page 1 / 2 + » +

+
+
+ - - -
+ - - - - \ No newline at end of file diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 32b55f6f..459e7bc6 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -4,13 +4,9 @@ Alexis' log - Alexis Métaireau + + - - - - - - @@ -24,44 +20,26 @@ - - Fork me on GitHub - - - - - - -
+ +
    - -
  1. +
  2. - - - + - - - -
  3. + +
  4. - - - + - - - -
  5. + +
  6. - - - + - - - -
- - -

- - - « - - - Page 2 / 2 - -

- - -
- - - - -
- -
+ +

+ « + Page 2 / 2 +

+
+
+ - - -
+
@@ -293,9 +185,6 @@ as well as inline markup.

The theme is by Smashing Magazine, thanks!

- - - - \ No newline at end of file diff --git a/tests/output/custom/categories.html b/tests/output/custom/categories.html index bad9dcfd..f7e811d5 100644 --- a/tests/output/custom/categories.html +++ b/tests/output/custom/categories.html @@ -4,13 +4,9 @@ Alexis' log + + - - - - - - @@ -24,87 +20,49 @@ - - Fork me on GitHub - - - - - - - +

There are comments.

- - - + - - - -
  • + +
  • - - - + - - - -
  • + +
  • - - - - - -

    - - Page 1 / 1 - -

    - - - - - - - -
    - -
    + +

    + Page 1 / 1 +

    +
    +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index 90948668..d01c8b2d 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -4,13 +4,9 @@ Alexis' log - misc + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - -
    + +

    Other articles


      - - - - - + - - - -
    - - -

    - - Page 1 / 1 - -

    - - -
    - - - - -
    - -
    + +

    + Page 1 / 1 +

    +
    +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index a848c4a4..af7f0ba2 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -4,13 +4,9 @@ Alexis' log - yeah + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - -
  • +

    + Page 1 / 1 +

    + + + +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/drafts/a-draft-article.html b/tests/output/custom/drafts/a-draft-article.html index bcfd1243..0c4244eb 100644 --- a/tests/output/custom/drafts/a-draft-article.html +++ b/tests/output/custom/drafts/a-draft-article.html @@ -4,13 +4,9 @@ A draft article + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +

    A draft article

    - -
    +
    -

    This is a draft article, it should live under the /drafts/ folder and not be +

    This is a draft article, it should live under the /drafts/ folder and not be listed anywhere else.

    - -
    +

    Comments !

    -
    -
    - -
    + - - -
    +
    @@ -152,9 +104,6 @@ listed anywhere else.

    The theme is by Smashing Magazine, thanks!

    - - - - \ No newline at end of file diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index 3bcea824..5d95c9d0 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -4,13 +4,9 @@ Alexis' log + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - +

    Other articles


      - - - - - + - - - -
    1. + +
    2. - - - + - - - -
    - - -

    - - Page 1 / 2 - - » - -

    - - -
    - - - - -
    - -
    + +

    + Page 1 / 2 + » +

    +
    +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index bba153f4..481819a8 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -4,13 +4,9 @@ Alexis' log + + - - - - - - @@ -24,44 +20,26 @@ - - Fork me on GitHub - - - - - - -
    + +
      - -
    1. +
    2. - - - + - - - -
    3. + +
    4. - - - + - - - -
    5. + +
    6. Oh yeah !

      @@ -150,25 +102,14 @@ as well as inline markup.

      Wed 20 October 2010 - -
      +
      By Alexis Métaireau
      - -

      In bar.

      -

      tags: ohbaryeah

      - - - - -Translations: +

      In bar.

      +

      tags: ohbaryeah

      Translations: + fr - fr - - - - -
      +

      Why not ?

      After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

      @@ -176,17 +117,12 @@ YEAH !

      read more -

      There are comments.

      -
      +

      There are comments.

    7. - - - + - - - -
    - - -

    - - - « - - - Page 2 / 2 - -

    - - -
    - - - - -
    - -
    + +

    + « + Page 2 / 2 +

    +
    +
    + - - -
    +
    - - - - \ No newline at end of file diff --git a/tests/output/custom/oh-yeah-fr.html b/tests/output/custom/oh-yeah-fr.html index ddc17b30..e9be2020 100644 --- a/tests/output/custom/oh-yeah-fr.html +++ b/tests/output/custom/oh-yeah-fr.html @@ -4,13 +4,9 @@ Trop bien ! + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +

    Trop bien !

    - -
    +
    -

    Et voila du contenu en français

    +

    Et voila du contenu en français

    - -
    +

    Comments !

    -
    -
    - -
    + - - -
    +
    - - - - \ No newline at end of file diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index a48044ab..e0c37caa 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -4,13 +4,9 @@ Oh yeah ! + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +

    Oh yeah !

    - -
    +
    -
    +

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    @@ -93,8 +62,7 @@ YEAH !

    - -
    +

    Comments !

    -
    -
    - -
    + - - -
    +
    - - - - \ No newline at end of file diff --git a/tests/output/custom/pages/this-is-a-test-hidden-page.html b/tests/output/custom/pages/this-is-a-test-hidden-page.html index 2b489963..500011e0 100644 --- a/tests/output/custom/pages/this-is-a-test-hidden-page.html +++ b/tests/output/custom/pages/this-is-a-test-hidden-page.html @@ -4,13 +4,9 @@ This is a test hidden page + + - - - - - - @@ -24,87 +20,51 @@ - - Fork me on GitHub - -

    This is a test hidden page

    - - - - - -

    This is great for things like error(404) pages + +

    This is great for things like error(404) pages Anyone can see this page but it's not linked to anywhere!

    -
    - -
    + - - -
    +
    @@ -114,9 +74,6 @@ Anyone can see this page but it's not linked to anywhere!

    The theme is by Smashing Magazine, thanks!

    - - - - \ No newline at end of file diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 7d74011d..81c2bffb 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -4,13 +4,9 @@ This is a test page + + - - - - - - @@ -24,87 +20,51 @@ - - Fork me on GitHub - -

    This is a test page

    - - - - - -

    Just an image.

    + +

    Just an image.

    alternate text
    -
    - -
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/second-article-fr.html b/tests/output/custom/second-article-fr.html index cd1ee194..b71b9244 100644 --- a/tests/output/custom/second-article-fr.html +++ b/tests/output/custom/second-article-fr.html @@ -4,13 +4,9 @@ Deuxième article + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +

    Deuxième article

    - -
    +
    -

    Ceci est un article, en français.

    +

    Ceci est un article, en français.

    - -
    +

    Comments !

    -
    -
    - -
    + - - -
    +
    - - - - \ No newline at end of file diff --git a/tests/output/custom/second-article.html b/tests/output/custom/second-article.html index ebabacc3..52872f27 100644 --- a/tests/output/custom/second-article.html +++ b/tests/output/custom/second-article.html @@ -4,13 +4,9 @@ Second article + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +

    Second article

    - -
    +
    -

    This is some article, in english

    +

    This is some article, in english

    - -
    +

    Comments !

    -
    -
    - -
    + - - -
    +
    - - - - \ No newline at end of file diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index b9ef8402..8b478d55 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -4,13 +4,9 @@ Alexis' log - bar + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - +

    Other articles


      - - - - - + - - - -
    1. + +
    2. - - - + - - - -
    3. + +
    4. - - - + - - - -
    5. + +
    6. Oh yeah !

      @@ -195,25 +126,14 @@ as well as inline markup.

      Wed 20 October 2010 - -
      +
      By Alexis Métaireau
      - -

      In bar.

      -

      tags: ohbaryeah

      - - - - -Translations: +

      In bar.

      +

      tags: ohbaryeah

      Translations: + fr - fr - - - - -
      +

      Why not ?

      After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

      @@ -221,67 +141,37 @@ YEAH !

      read more -

      There are comments.

      -
      +

      There are comments.

    7. - - -
    - - -

    - - Page 1 / 1 - -

    - - -
    - - - - -
    - -
    + +

    + Page 1 / 1 +

    +
    +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/tag/baz.html b/tests/output/custom/tag/baz.html index 29c1fae9..02f55ddb 100644 --- a/tests/output/custom/tag/baz.html +++ b/tests/output/custom/tag/baz.html @@ -4,13 +4,9 @@ Alexis' log - baz + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - +

    Other articles


      - - - - - + - - - -
    - - -

    - - Page 1 / 1 - -

    - - -
    - - - - -
    - -
    + +

    + Page 1 / 1 +

    +
    +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/tag/foo.html b/tests/output/custom/tag/foo.html index 04415b2c..9e84459a 100644 --- a/tests/output/custom/tag/foo.html +++ b/tests/output/custom/tag/foo.html @@ -4,13 +4,9 @@ Alexis' log - foo + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - +

    Other articles


      - - - - - + - - - -
    1. + +
    2. - - - + - - - -
    - - -

    - - Page 1 / 1 - -

    - - -
    - - - - -
    - -
    + +

    + Page 1 / 1 +

    +
    +
    + - - -
    +
    @@ -243,9 +149,6 @@ as well as inline markup.

    The theme is by Smashing Magazine, thanks!

    - - - - \ No newline at end of file diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index 38c4c61e..28d250e6 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -4,13 +4,9 @@ Alexis' log - foobar + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - + + +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html index 498b3fde..4894ff3a 100644 --- a/tests/output/custom/tag/oh.html +++ b/tests/output/custom/tag/oh.html @@ -4,13 +4,9 @@ Alexis' log - oh + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - + + +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index 16d325f2..36f40b4e 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -4,13 +4,9 @@ Alexis' log - yeah + + - - - - - - @@ -24,40 +20,23 @@ - - Fork me on GitHub - - - - - - + + +
    + - - -
    + - - - - \ No newline at end of file diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index 8d024437..e931d0a0 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -4,13 +4,9 @@ This is a super article ! + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +
    -
    - -
    + - - -
    +
    - - - - \ No newline at end of file diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html index 1a1b0788..fa03883d 100644 --- a/tests/output/custom/unbelievable.html +++ b/tests/output/custom/unbelievable.html @@ -4,13 +4,9 @@ Unbelievable ! + + - - - - - - @@ -24,42 +20,26 @@ - - Fork me on GitHub - - - -
    +

    Unbelievable !

    - -
    +
    -

    Or completely awesome. Depends the needs.

    +

    Or completely awesome. Depends the needs.

    - -
    +

    Comments !

    -
    -
    - -
    + - - -
    +
    - - - - \ No newline at end of file From 816e8d88e0b6622cf7eb7d4a9357e22dbaff12f2 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Nov 2012 13:22:49 +0100 Subject: [PATCH 0186/1975] Change webasset tests organization to avoid running pelican twice for each test. As setUp is run for each test, the previous implementation was running pelican twice (once for relative urls and once for absolute) for each test, which was not really optimal :-). Solution: make a base class which is inherated by a class for relative urls and another for absolute urls. --- tests/test_webassets.py | 85 ++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/tests/test_webassets.py b/tests/test_webassets.py index e47e7f81..52a7fa17 100644 --- a/tests/test_webassets.py +++ b/tests/test_webassets.py @@ -11,48 +11,47 @@ from pelican.settings import read_settings from .support import unittest, skipIfNoExecutable, module_exists CUR_DIR = os.path.dirname(__file__) +THEME_DIR = os.path.join(CUR_DIR, 'themes', 'assets') +CSS_REF = open(os.path.join(THEME_DIR, 'static', 'css', + 'style.min.css')).read() +CSS_HASH = hashlib.md5(CSS_REF).hexdigest()[0:8] @unittest.skipUnless(module_exists('webassets'), "webassets isn't installed") @skipIfNoExecutable(['scss', '-v']) @skipIfNoExecutable(['cssmin', '--version']) class TestWebAssets(unittest.TestCase): + """Base class for testing webassets.""" - def setUp(self): - """Run pelican with two settings (absolute and relative urls).""" - - self.theme_dir = os.path.join(CUR_DIR, 'themes', 'assets') - + def setUp(self, override=None): self.temp_path = mkdtemp() - self.settings = read_settings(override={ + settings = { 'PATH': os.path.join(CUR_DIR, 'content', 'TestCategory'), 'OUTPUT_PATH': self.temp_path, 'PLUGINS': ['pelican.plugins.assets', ], - 'THEME': self.theme_dir, - }) + 'THEME': THEME_DIR, + } + if override: + settings.update(override) + + self.settings = read_settings(override=settings) pelican = Pelican(settings=self.settings) pelican.run() - # run Pelican a second time with absolute urls - self.temp_path2 = mkdtemp() - self.settings2 = read_settings(override={ - 'PATH': os.path.join(CUR_DIR, 'content', 'TestCategory'), - 'OUTPUT_PATH': self.temp_path2, - 'PLUGINS': ['pelican.plugins.assets', ], - 'THEME': self.theme_dir, - 'RELATIVE_URLS': False, - 'SITEURL': 'http://localhost' - }) - pelican2 = Pelican(settings=self.settings2) - pelican2.run() - - self.css_ref = open(os.path.join(self.theme_dir, 'static', 'css', - 'style.min.css')).read() - self.version = hashlib.md5(self.css_ref).hexdigest()[0:8] - def tearDown(self): rmtree(self.temp_path) - rmtree(self.temp_path2) + + def check_link_tag(self, css_file, html_file): + """Check the presence of `css_file` in `html_file`.""" + + link_tag = ''.\ + format(css_file=css_file) + html = open(html_file).read() + self.assertRegexpMatches(html, link_tag) + + +class TestWebAssetsRelativeURLS(TestWebAssets): + """Test pelican with relative urls.""" def test_jinja2_ext(self): """Test that the Jinja2 extension was correctly added.""" @@ -64,39 +63,39 @@ class TestWebAssets(unittest.TestCase): """Compare the compiled css with the reference.""" gen_file = os.path.join(self.temp_path, 'theme', 'gen', - 'style.{0}.min.css'.format(self.version)) - + 'style.{0}.min.css'.format(CSS_HASH)) self.assertTrue(os.path.isfile(gen_file)) + css_new = open(gen_file).read() - self.assertEqual(css_new, self.css_ref) - - def check_link_tag(self, css_file, html_file): - """Check the presence of `css_file` in `html_file`.""" - - link_tag = ''.\ - format(css_file=css_file) - html = open(html_file).read() - self.assertRegexpMatches(html, link_tag) + self.assertEqual(css_new, CSS_REF) def test_template(self): - """Look in the output index.html file for the link tag.""" + """Look in the output files for the link tag.""" - css_file = './theme/gen/style.{0}.min.css'.format(self.version) + css_file = './theme/gen/style.{0}.min.css'.format(CSS_HASH) html_files = ['index.html', 'archives.html', 'this-is-an-article-with-category.html'] for f in html_files: self.check_link_tag(css_file, os.path.join(self.temp_path, f)) self.check_link_tag( - '.././theme/gen/style.{0}.min.css'.format(self.version), + '.././theme/gen/style.{0}.min.css'.format(CSS_HASH), os.path.join(self.temp_path, 'category/misc.html')) + +class TestWebAssetsAbsoluteURLS(TestWebAssets): + """Test pelican with absolute urls.""" + + def setUp(self): + TestWebAssets.setUp(self, override={'RELATIVE_URLS': False, + 'SITEURL': 'http://localhost'}) + def test_absolute_url(self): - """Look in the output index.html file for the link tag with abs url.""" + """Look in the output files for the link tag with absolute url.""" css_file = 'http://localhost/theme/gen/style.{0}.min.css'.\ - format(self.version) + format(CSS_HASH) html_files = ['index.html', 'archives.html', 'this-is-an-article-with-category.html'] for f in html_files: - self.check_link_tag(css_file, os.path.join(self.temp_path2, f)) + self.check_link_tag(css_file, os.path.join(self.temp_path, f)) From 5fd6eac47723a5fbc286778167dd673a013a438a Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 23 Nov 2012 15:38:41 +0100 Subject: [PATCH 0187/1975] update changelog (new webassets plugin) --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 3d1786bf..abf323c8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -17,6 +17,8 @@ Release history * Allow for blank author: if ``AUTHOR`` setting is not set, author won't default to ``${USER}`` anymore and a post won't contain any author information if the post author is empty. +* LESS and Webassets support removed from Pelican core in favor of a Webassets + plugin. 3.0 (2012-08-08) ================== From 1c44f49d1b927fce9a3c4d3129e7bd85319fcd40 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 23 Nov 2012 15:50:54 +0100 Subject: [PATCH 0188/1975] remove importlib dependency importlib is only available for python >= 2.7 --- tests/support.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/support.py b/tests/support.py index 52a410ff..5b63eeba 100644 --- a/tests/support.py +++ b/tests/support.py @@ -4,7 +4,6 @@ __all__ = [ ] import cStringIO -import importlib import os import re import subprocess @@ -145,7 +144,7 @@ def module_exists(module_name): """Test if a module is importable.""" try: - importlib.import_module(module_name) + __import__(module_name) except ImportError: return False else: From a6f328516a8ac6486fdcfbc00b65eca7868e1990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Pievil=C3=A4inen?= Date: Sat, 24 Nov 2012 13:18:49 +0200 Subject: [PATCH 0189/1975] Metadata parity for RST/MD, document summary. --- docs/getting_started.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 09840e8a..9dc6ab59 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -153,7 +153,9 @@ following syntax (give your file the ``.rst`` extension):: :date: 2010-10-03 10:20 :tags: thats, awesome :category: yeah + :slug: my-super-post :author: Alexis Metaireau + :summary: Short version for index and feeds Pelican implements an extension of reStructuredText to enable support for the ``abbr`` HTML tag. To use it, write something like this in your post:: @@ -165,10 +167,13 @@ Markdown generation will not work until you explicitly install the ``Markdown`` package, which can be done via ``pip install Markdown``. Metadata syntax for Markdown posts should follow this pattern:: - Date: 2010-12-03 Title: My super title + Date: 2010-12-03 10:20 Tags: thats, awesome + Category: yeah Slug: my-super-post + Author: Alexis Metaireau + Summary: Short version for index and feeds This is the content of my super blog post. @@ -178,7 +183,9 @@ category can be determined by the directory in which the file resides. For example, a file located at ``python/foobar/myfoobar.rst`` will have a category of ``foobar``. If you would like to organize your files in other ways where the name of the subfolder would not be a good category name, you can set the -setting ``USE_FOLDER_AS_CATEGORY`` to ``False``. +setting ``USE_FOLDER_AS_CATEGORY`` to ``False``. If summary isn't given, setting +``SUMMARY_MAX_LENGTH`` determines how many words from the beginning of an article +are used as the summary. Generate your blog ------------------ From 4de668159dfb5afd18532ad8a08f75953d1d36d3 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Mon, 26 Nov 2012 11:26:33 -0500 Subject: [PATCH 0190/1975] Update docs/settings.rst Updated the documentation for the MARKUP setting to reflect the current supported markup file extensions. --- docs/settings.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index ba9a7a69..eb88233e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -60,9 +60,9 @@ Setting name (default value) What doe here or a single string representing one locale. When providing a list, all the locales will be tried until one works. -`MARKUP` (``('rst', 'md')``) A list of available markup languages you want +`MARKUP` (``('rst', 'md', 'markdown', 'mkd')``) A list of available markup languages you want to use. For the moment, the only available values - are `rst` and `md`. + are `rst`, `md`, `markdown`, and `mkd`. `MD_EXTENSIONS` (``['codehilite','extra']``) A list of the extensions that the Markdown processor will use. Refer to the extensions chapter in the Python-Markdown documentation for a complete list of From 103ae436c9f404e2d25cf9deab7ab2476e9f2f84 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Mon, 26 Nov 2012 13:03:25 -0500 Subject: [PATCH 0191/1975] Update docs/settings.rst Updated commit based on the discussion in the pull request. --- docs/settings.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index eb88233e..be091596 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -60,9 +60,9 @@ Setting name (default value) What doe here or a single string representing one locale. When providing a list, all the locales will be tried until one works. -`MARKUP` (``('rst', 'md', 'markdown', 'mkd')``) A list of available markup languages you want +`MARKUP` (``('rst', 'md')``) A list of available markup languages you want to use. For the moment, the only available values - are `rst`, `md`, `markdown`, and `mkd`. + are `rst`, `md`, `markdown`, `mkd`, `html`, and `htm`. `MD_EXTENSIONS` (``['codehilite','extra']``) A list of the extensions that the Markdown processor will use. Refer to the extensions chapter in the Python-Markdown documentation for a complete list of From fa82e19c1ffa18bfb5e03a8311727a022525c53f Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 24 Nov 2012 00:26:46 +0100 Subject: [PATCH 0192/1975] change default value for DEFAULT_DATE to None (was 'fs' => guess from file mtime) --- docs/settings.rst | 2 +- pelican/generators.py | 2 +- pelican/settings.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index be091596..a7cf107b 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -43,7 +43,7 @@ Setting name (default value) What doe `DISPLAY_PAGES_ON_MENU` (``True``) Whether to display pages on the menu of the template. Templates may or not honor this setting. -`DEFAULT_DATE` (``fs``) The default date you want to use. +`DEFAULT_DATE` (``None``) The default date you want to use. If 'fs', Pelican will use the file system timestamp information (mtime) if it can't get date information from the metadata. diff --git a/pelican/generators.py b/pelican/generators.py index b1d9ec12..020a3711 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -331,7 +331,7 @@ class ArticlesGenerator(Generator): if category != '': metadata['category'] = Category(category, self.settings) - if 'date' not in metadata and self.settings['DEFAULT_DATE']: + if 'date' not in metadata and self.settings.get('DEFAULT_DATE'): if self.settings['DEFAULT_DATE'] == 'fs': metadata['date'] = datetime.datetime.fromtimestamp( os.stat(f).st_ctime) diff --git a/pelican/settings.py b/pelican/settings.py index 49879f84..d2c0cef5 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -36,7 +36,6 @@ _DEFAULT_CONFIG = {'PATH': '.', 'OUTPUT_SOURCES_EXTENSION': '.text', 'USE_FOLDER_AS_CATEGORY': True, 'DEFAULT_CATEGORY': 'misc', - 'DEFAULT_DATE': 'fs', 'WITH_FUTURE_DATES': True, 'CSS_FILE': 'main.css', 'NEWEST_FIRST_ARCHIVES': True, From 4d6ddd0af3775c992fed642153c0cb96c66fed23 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 24 Nov 2012 00:41:25 +0100 Subject: [PATCH 0193/1975] fix failing tests --- tests/content/TestCategory/article_with_category.rst | 1 + tests/test_generators.py | 3 +++ tests/test_webassets.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/content/TestCategory/article_with_category.rst b/tests/content/TestCategory/article_with_category.rst index 7ed6e6d1..69ffa98b 100644 --- a/tests/content/TestCategory/article_with_category.rst +++ b/tests/content/TestCategory/article_with_category.rst @@ -2,5 +2,6 @@ This is an article with category ! ################################## :category: yeah +:date: 1970-01-01 This article should be in 'yeah' category. diff --git a/tests/test_generators.py b/tests/test_generators.py index ba7ff240..f8f6a3f4 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -31,6 +31,7 @@ class TestArticlesGenerator(unittest.TestCase): settings = _DEFAULT_CONFIG.copy() settings['ARTICLE_DIR'] = 'content' settings['DEFAULT_CATEGORY'] = 'Default' + settings['DEFAULT_DATE'] = (1970, 01, 01) self.generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR, _DEFAULT_CONFIG['THEME'], None, _DEFAULT_CONFIG['MARKUP']) @@ -93,6 +94,7 @@ class TestArticlesGenerator(unittest.TestCase): settings = _DEFAULT_CONFIG.copy() settings['ARTICLE_DIR'] = 'content' settings['DEFAULT_CATEGORY'] = 'Default' + settings['DEFAULT_DATE'] = (1970, 01, 01) settings['USE_FOLDER_AS_CATEGORY'] = False generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR, _DEFAULT_CONFIG['THEME'], None, @@ -175,6 +177,7 @@ class TestPageGenerator(unittest.TestCase): settings = _DEFAULT_CONFIG.copy() settings['PAGE_DIR'] = 'TestPages' + settings['DEFAULT_DATE'] = (1970, 01, 01) generator = PagesGenerator(settings.copy(), settings, CUR_DIR, _DEFAULT_CONFIG['THEME'], None, _DEFAULT_CONFIG['MARKUP']) diff --git a/tests/test_webassets.py b/tests/test_webassets.py index 52a7fa17..afe1674d 100644 --- a/tests/test_webassets.py +++ b/tests/test_webassets.py @@ -80,7 +80,7 @@ class TestWebAssetsRelativeURLS(TestWebAssets): self.check_link_tag( '.././theme/gen/style.{0}.min.css'.format(CSS_HASH), - os.path.join(self.temp_path, 'category/misc.html')) + os.path.join(self.temp_path, 'category/yeah.html')) class TestWebAssetsAbsoluteURLS(TestWebAssets): From 080c884c1ad52587ccff7d742422625c06e3a8a1 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 24 Nov 2012 00:46:03 +0100 Subject: [PATCH 0194/1975] restore test_basic_generation_works functional test --- tests/test_pelican.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 762663d2..39c820c8 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -62,22 +62,17 @@ class TestPelican(unittest.TestCase): self.assertEqual(diff['right_only'], [], msg=msg) self.assertEqual(diff['diff_files'], [], msg=msg) - @unittest.skip("Test failing") def test_basic_generation_works(self): # when running pelican without settings, it should pick up the default - # ones and generate the output without raising any exception / issuing - # any warning. - with patch("pelican.contents.getenv") as mock_getenv: - # force getenv('USER') to always return the same value - mock_getenv.return_value = "Dummy Author" - settings = read_settings(filename=None, override={ - 'PATH': INPUT_PATH, - 'OUTPUT_PATH': self.temp_path, - }) - pelican = Pelican(settings=settings) - pelican.run() - dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) - self.assertFilesEqual(recursiveDiff(dcmp)) + # ones and generate correct output without raising any exception + settings = read_settings(filename=None, override={ + 'PATH': INPUT_PATH, + 'OUTPUT_PATH': self.temp_path, + }) + pelican = Pelican(settings=settings) + pelican.run() + dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) + self.assertFilesEqual(recursiveDiff(dcmp)) def test_custom_generation_works(self): # the same thing with a specified set of settings should work From 07ccf477d06a2a2c1b0290ef33628b86a99324d6 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 24 Nov 2012 00:29:48 +0100 Subject: [PATCH 0195/1975] update "basic" output for functional tests so that test pass LC_ALL="C" pelican -o tests/output/basic/ samples/content/ --- .../output/basic/author/alexis-metaireau.html | 4 +- tests/output/basic/author/dummy-author.html | 288 ------------------ tests/output/basic/category/bar.html | 4 +- tests/output/basic/category/content.html | 147 --------- .../output/basic/drafts/a-draft-article.html | 67 ---- tests/output/basic/feeds/all-fr.atom.xml | 3 +- tests/output/basic/feeds/all.atom.xml | 3 +- tests/output/basic/feeds/content.atom.xml | 4 - tests/output/basic/index.html | 4 +- tests/output/basic/oh-yeah-fr.html | 68 ----- tests/output/basic/oh-yeah.html | 4 +- tests/output/basic/tag/bar.html | 4 +- tests/output/basic/tag/oh.html | 4 +- tests/output/basic/tag/yeah.html | 4 +- 14 files changed, 9 insertions(+), 599 deletions(-) delete mode 100644 tests/output/basic/author/dummy-author.html delete mode 100644 tests/output/basic/category/content.html delete mode 100644 tests/output/basic/drafts/a-draft-article.html delete mode 100644 tests/output/basic/feeds/content.atom.xml delete mode 100644 tests/output/basic/oh-yeah-fr.html diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index 014127c5..07caba91 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -44,9 +44,7 @@ By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/basic/author/dummy-author.html b/tests/output/basic/author/dummy-author.html deleted file mode 100644 index bd47adde..00000000 --- a/tests/output/basic/author/dummy-author.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - A Pelican Blog - Dummy Author - - - - - - - - - - - - - - - - - -

    - - - - - - - - -
    -

    Other articles

    -
    -
      - - - - - - - - - -
    1. - - - - - - - -
    2. - - - - - - - -
    3. - - - - - - - -
    4. - - - - - - - -
    5. - - -
    - - - -
    - - - - -
    - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/output/basic/category/bar.html b/tests/output/basic/category/bar.html index b47d7522..4fe9447c 100644 --- a/tests/output/basic/category/bar.html +++ b/tests/output/basic/category/bar.html @@ -44,9 +44,7 @@ By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/basic/category/content.html b/tests/output/basic/category/content.html deleted file mode 100644 index 19ceef2c..00000000 --- a/tests/output/basic/category/content.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - A Pelican Blog - content - - - - - - - - - - - - - - - -

    - - - - - - - - -
    -

    Other articles

    -
    -
      - - - - - - - - - - -
    1. - - - - - -
    -
    - - - - -
    - - -
    - - - - - - - - \ No newline at end of file diff --git a/tests/output/basic/drafts/a-draft-article.html b/tests/output/basic/drafts/a-draft-article.html deleted file mode 100644 index 71e778ce..00000000 --- a/tests/output/basic/drafts/a-draft-article.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - A draft article - - - - - - - - - - - - - - -
    -
    -
    -

    - A draft article

    -
    - -
    -
    - - Mon 17 September 2012 - - -

    In misc.

    - -

    This is a draft article, it should live under the /drafts/ folder and not be -listed anywhere else.

    - -
    - -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/tests/output/basic/feeds/all-fr.atom.xml b/tests/output/basic/feeds/all-fr.atom.xml index 2cfb5ea6..98b9a681 100644 --- a/tests/output/basic/feeds/all-fr.atom.xml +++ b/tests/output/basic/feeds/all-fr.atom.xml @@ -1,4 +1,3 @@ -A Pelican Blog/2012-09-17T15:02:39ZTrop bien !2012-09-17T15:02:39Ztag:,2012-09-17:oh-yeah-fr.html<p>Et voila du contenu en français</p> -Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> +A Pelican Blog/2012-02-29T00:00:00ZDeuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index a439882f..c715db8c 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,6 +1,5 @@ -A Pelican Blog/2012-09-17T15:02:39ZTrop bien !2012-09-17T15:02:39Ztag:,2012-09-17:oh-yeah-fr.html<p>Et voila du contenu en français</p> -Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> diff --git a/tests/output/basic/feeds/content.atom.xml b/tests/output/basic/feeds/content.atom.xml deleted file mode 100644 index 1fa740b4..00000000 --- a/tests/output/basic/feeds/content.atom.xml +++ /dev/null @@ -1,4 +0,0 @@ - -A Pelican Blog.././2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00ZDummy Authortag:../.,2012-02-29:second-article.html<p>This is some article, in english</p> -Unbelievable !2010-10-15T20:30:00ZDummy Authortag:../.,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> - \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 8a063033..04a4fd12 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -183,9 +183,7 @@ as well as inline markup.

    By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/basic/oh-yeah-fr.html b/tests/output/basic/oh-yeah-fr.html deleted file mode 100644 index 5143907f..00000000 --- a/tests/output/basic/oh-yeah-fr.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - Trop bien ! - - - - - - - - - - - - - -

    -
    -
    -
    -

    - Trop bien !

    -
    - -
    -
    - - Mon 17 September 2012 - - -

    In misc.

    -Translations: - en - -

    Et voila du contenu en français

    - -
    - -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index 0e06699d..1c7bb43e 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -47,9 +47,7 @@ By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index 4bc5adc0..f2d0bf72 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -120,9 +120,7 @@ as well as inline markup.

    By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/basic/tag/oh.html b/tests/output/basic/tag/oh.html index a286ca8d..36731c8c 100644 --- a/tests/output/basic/tag/oh.html +++ b/tests/output/basic/tag/oh.html @@ -44,9 +44,7 @@ By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/tests/output/basic/tag/yeah.html b/tests/output/basic/tag/yeah.html index 1e91b765..fb6909b4 100644 --- a/tests/output/basic/tag/yeah.html +++ b/tests/output/basic/tag/yeah.html @@ -44,9 +44,7 @@ By Alexis Métaireau

    In bar.

    -

    tags: ohbaryeah

    Translations: - fr - +

    tags: ohbaryeah

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! From ce0723cf48a5bc0c77e6e93e4e5a9bc5dc945315 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 24 Nov 2012 00:48:47 +0100 Subject: [PATCH 0196/1975] update contribute.rst doc $USER environment variable is no longer needed --- docs/contribute.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contribute.rst b/docs/contribute.rst index 0820d5c3..c302dcc6 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -56,7 +56,7 @@ To do so, you can use the following two commands:: $ LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py \ samples/content/ - $ LC_ALL="C" USER="Dummy Author" pelican -o tests/output/basic/ samples/content/ + $ LC_ALL="C" pelican -o tests/output/basic/ samples/content/ Coding standards ================ From 447e627286264c3460ba91373a0636bbd2e68730 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 28 Nov 2012 00:41:40 +0100 Subject: [PATCH 0197/1975] update changelog to reflect changes from #592 --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index abf323c8..1f0769da 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -19,6 +19,8 @@ Release history information if the post author is empty. * LESS and Webassets support removed from Pelican core in favor of a Webassets plugin. +* The ``DEFAULT_DATE`` setting now defaults to None, which means that articles + won't be generated anymore unless a date metadata is specified. 3.0 (2012-08-08) ================== From 70566223227550c7a74cd19bf5e3cc8b6b59f607 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 27 Nov 2012 16:01:05 -0800 Subject: [PATCH 0198/1975] Fix missing SITEURL and base home link 1. Following up on bbinet's changes in f12a297, ensure that the notmyidea theme's article.html template includes the SITEURL variable when constructing URL links. 2. Add missing slash to the base.html template so that clicking on the site header at top left refers to "/" instead of "" when SITEURL is not defined. Otherwise, the "" target will cause the browser to load the current page and not the site's root (as one would expect). --- pelican/themes/notmyidea/templates/article.html | 2 +- pelican/themes/notmyidea/templates/base.html | 2 +- tests/output/basic/a-markdown-powered-article.html | 4 ++-- tests/output/basic/archives.html | 2 +- tests/output/basic/article-1.html | 4 ++-- tests/output/basic/article-2.html | 4 ++-- tests/output/basic/article-3.html | 4 ++-- tests/output/basic/author/alexis-metaireau.html | 2 +- tests/output/basic/categories.html | 2 +- tests/output/basic/category/bar.html | 2 +- tests/output/basic/category/cat1.html | 2 +- tests/output/basic/category/misc.html | 2 +- tests/output/basic/category/yeah.html | 2 +- tests/output/basic/index.html | 2 +- tests/output/basic/oh-yeah.html | 4 ++-- tests/output/basic/pages/this-is-a-test-hidden-page.html | 2 +- tests/output/basic/pages/this-is-a-test-page.html | 2 +- tests/output/basic/second-article-fr.html | 4 ++-- tests/output/basic/second-article.html | 4 ++-- tests/output/basic/tag/bar.html | 2 +- tests/output/basic/tag/baz.html | 2 +- tests/output/basic/tag/foo.html | 2 +- tests/output/basic/tag/foobar.html | 2 +- tests/output/basic/tag/oh.html | 2 +- tests/output/basic/tag/yeah.html | 2 +- tests/output/basic/this-is-a-super-article.html | 4 ++-- tests/output/basic/unbelievable.html | 4 ++-- tests/output/custom/a-markdown-powered-article.html | 4 ++-- tests/output/custom/archives.html | 2 +- tests/output/custom/article-1.html | 4 ++-- tests/output/custom/article-2.html | 4 ++-- tests/output/custom/article-3.html | 4 ++-- tests/output/custom/author/alexis-metaireau.html | 2 +- tests/output/custom/author/alexis-metaireau2.html | 2 +- tests/output/custom/categories.html | 2 +- tests/output/custom/category/bar.html | 2 +- tests/output/custom/category/cat1.html | 2 +- tests/output/custom/category/misc.html | 2 +- tests/output/custom/category/yeah.html | 2 +- tests/output/custom/drafts/a-draft-article.html | 4 ++-- tests/output/custom/index.html | 2 +- tests/output/custom/index2.html | 2 +- tests/output/custom/oh-yeah-fr.html | 4 ++-- tests/output/custom/oh-yeah.html | 4 ++-- tests/output/custom/pages/this-is-a-test-hidden-page.html | 2 +- tests/output/custom/pages/this-is-a-test-page.html | 2 +- tests/output/custom/second-article-fr.html | 4 ++-- tests/output/custom/second-article.html | 4 ++-- tests/output/custom/tag/bar.html | 2 +- tests/output/custom/tag/baz.html | 2 +- tests/output/custom/tag/foo.html | 2 +- tests/output/custom/tag/foobar.html | 2 +- tests/output/custom/tag/oh.html | 2 +- tests/output/custom/tag/yeah.html | 2 +- tests/output/custom/this-is-a-super-article.html | 4 ++-- tests/output/custom/unbelievable.html | 4 ++-- 56 files changed, 76 insertions(+), 76 deletions(-) diff --git a/pelican/themes/notmyidea/templates/article.html b/pelican/themes/notmyidea/templates/article.html index fc7e5893..737d3789 100644 --- a/pelican/themes/notmyidea/templates/article.html +++ b/pelican/themes/notmyidea/templates/article.html @@ -5,7 +5,7 @@

    - {{ article.title}}

    {% include 'twitter.html' %}
    diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html index 45c2c3a2..f8b02662 100644 --- a/pelican/themes/notmyidea/templates/base.html +++ b/pelican/themes/notmyidea/templates/base.html @@ -26,7 +26,7 @@ {% include 'github.html' %}
  • @@ -97,7 +97,7 @@
  • diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index bb6ea566..d708da2a 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -3,30 +3,30 @@ A Pelican Blog - misc - + + + + @@ -34,15 +34,15 @@
    \ No newline at end of file diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index 68e6f4cf..3d8100fd 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,5 +1,7 @@ -A Pelican Blog/2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +A Pelican Blog/2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> +<p><a href="unbelievable.html">a root-relative link to unbelievable</a> +<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml index dce36d06..8e5477ba 100644 --- a/tests/output/basic/feeds/misc.atom.xml +++ b/tests/output/basic/feeds/misc.atom.xml @@ -1,4 +1,6 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/feeds/yeah.atom.xml b/tests/output/basic/feeds/yeah.atom.xml index fabeb52f..78d1a2d0 100644 --- a/tests/output/basic/feeds/yeah.atom.xml +++ b/tests/output/basic/feeds/yeah.atom.xml @@ -3,8 +3,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="|filename|/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 3f37bdd5..9c00402e 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -69,6 +69,8 @@

    In cat1.

    You're mutually oblivious.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    read more @@ -188,7 +190,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more @@ -212,6 +214,8 @@ YEAH !

    In misc.

    Or completely awesome. Depends the needs.

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index 2e7b9cbf..ab090b58 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -52,7 +52,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text diff --git a/tests/output/basic/pages/this-is-a-test-page.html b/tests/output/basic/pages/this-is-a-test-page.html index 177dab2f..43e2c2d4 100644 --- a/tests/output/basic/pages/this-is-a-test-page.html +++ b/tests/output/basic/pages/this-is-a-test-page.html @@ -34,7 +34,7 @@

    This is a test page

    Just an image.

    -alternate text +alternate text
    diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index fd0d453c..06b012cb 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -125,7 +125,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more diff --git a/tests/output/basic/tag/foobar.html b/tests/output/basic/tag/foobar.html index 18c19770..11f21b6d 100644 --- a/tests/output/basic/tag/foobar.html +++ b/tests/output/basic/tag/foobar.html @@ -49,8 +49,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/basic/tag/oh.html b/tests/output/basic/tag/oh.html
    index 3279c1a6..d88192a0 100644
    --- a/tests/output/basic/tag/oh.html
    +++ b/tests/output/basic/tag/oh.html
    @@ -49,7 +49,7 @@
     

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text
    diff --git a/tests/output/basic/tag/yeah.html b/tests/output/basic/tag/yeah.html index 31aa542a..8533dbdc 100644 --- a/tests/output/basic/tag/yeah.html +++ b/tests/output/basic/tag/yeah.html @@ -49,7 +49,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text diff --git a/tests/output/basic/this-is-a-super-article.html b/tests/output/basic/this-is-a-super-article.html index 4b47c6ba..0188c07e 100644 --- a/tests/output/basic/this-is-a-super-article.html +++ b/tests/output/basic/this-is-a-super-article.html @@ -52,8 +52,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html
    index b21867f1..95bc7b85 100644
    --- a/tests/output/basic/unbelievable.html
    +++ b/tests/output/basic/unbelievable.html
    @@ -46,6 +46,8 @@
             

    In misc.

    Or completely awesome. Depends the needs.

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index aea2639b..52d0e5f9 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -53,6 +53,8 @@

    In cat1.

    You're mutually oblivious.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    Comments !

    diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 422b873e..5a36c27e 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -49,7 +49,9 @@

    In cat1.

    -

    You're mutually oblivious.

    There are comments.

    +

    You're mutually oblivious.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    There are comments.

    Other articles

    diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index 6a92f6d6..e456805b 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -62,7 +62,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text
    read more @@ -142,6 +142,8 @@ as well as inline markup.

    In misc.

    Or completely awesome. Depends the needs.

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index 253d64ea..d291b9df 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -55,7 +55,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index 92694b44..9316faf0 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -49,7 +49,9 @@

    In cat1.

    -

    You're mutually oblivious.

    There are comments.

    +

    You're mutually oblivious.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    There are comments.

    Other articles

    diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index c848c9c3..6609ce25 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -79,6 +79,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index c39e1a86..587e2f97 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -53,8 +53,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/feeds/all-en.atom.xml b/tests/output/custom/feeds/all-en.atom.xml
    index db5fc2de..f8eb3219 100644
    --- a/tests/output/custom/feeds/all-en.atom.xml
    +++ b/tests/output/custom/feeds/all-en.atom.xml
    @@ -1,14 +1,16 @@
     
     Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p>
    -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p>
    +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>
    +<p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a>
    +<a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p>
     Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p>
     Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p>
     This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p>
     <div class="section" id="this-is-a-simple-title">
     <h2>This is a simple title</h2>
     <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    -<img alt="alternate text" src="pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
     <pre class="literal-block">
     &gt;&gt;&gt; from ipdb import set_trace
     &gt;&gt;&gt; set_trace()
    @@ -19,7 +21,9 @@
     <h2>Why not ?</h2>
     <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
     YEAH !</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
     </div>
     Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p>
    +<p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a>
    +<a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p>
     
    \ No newline at end of file
    diff --git a/tests/output/custom/feeds/all.atom.xml b/tests/output/custom/feeds/all.atom.xml
    index b72f1e15..b009d135 100644
    --- a/tests/output/custom/feeds/all.atom.xml
    +++ b/tests/output/custom/feeds/all.atom.xml
    @@ -2,15 +2,17 @@
     Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p>
     Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p>
     Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p>
    -A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p>
    +A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>
    +<p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a>
    +<a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p>
     Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p>
     Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p>
     This is a super article !2010-12-02T10:14:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-12-02:this-is-a-super-article.html<p>Some content here !</p>
     <div class="section" id="this-is-a-simple-title">
     <h2>This is a simple title</h2>
     <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    -<img alt="alternate text" src="pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
     <pre class="literal-block">
     &gt;&gt;&gt; from ipdb import set_trace
     &gt;&gt;&gt; set_trace()
    @@ -21,7 +23,9 @@
     <h2>Why not ?</h2>
     <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
     YEAH !</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
     </div>
     Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p>
    +<p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a>
    +<a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p>
     
    \ No newline at end of file
    diff --git a/tests/output/custom/feeds/all.rss.xml b/tests/output/custom/feeds/all.rss.xml
    index 8fbf7b04..786cb097 100644
    --- a/tests/output/custom/feeds/all.rss.xml
    +++ b/tests/output/custom/feeds/all.rss.xml
    @@ -2,15 +2,17 @@
     Alexis' loghttp://blog.notmyidea.org/Fri, 02 Mar 2012 14:01:01 +0100Trop bien !http://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p>
     Alexis MétaireauFri, 02 Mar 2012 14:01:01 +0100tag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p>
     Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazDeuxième articlehttp://blog.notmyidea.org/second-article-fr.html<p>Ceci est un article, en français.</p>
    -Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article-fr.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p>
    +Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article-fr.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>
    +<p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a>
    +<a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p>
     Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p>
     Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p>
     Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.htmlThis is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p>
     <div class="section" id="this-is-a-simple-title">
     <h2>This is a simple title</h2>
     <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    -<img alt="alternate text" src="pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
     <pre class="literal-block">
     &gt;&gt;&gt; from ipdb import set_trace
     &gt;&gt;&gt; set_trace()
    @@ -21,7 +23,9 @@
     <h2>Why not ?</h2>
     <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
     YEAH !</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
     </div>
     Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p>
    +<p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a>
    +<a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p>
     Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html
    \ No newline at end of file
    diff --git a/tests/output/custom/feeds/bar.atom.xml b/tests/output/custom/feeds/bar.atom.xml
    index 9b29f6c9..9945f938 100644
    --- a/tests/output/custom/feeds/bar.atom.xml
    +++ b/tests/output/custom/feeds/bar.atom.xml
    @@ -3,6 +3,6 @@
     <h2>Why not ?</h2>
     <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
     YEAH !</p>
    -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
    +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
     </div>
     
    \ No newline at end of file diff --git a/tests/output/custom/feeds/bar.rss.xml b/tests/output/custom/feeds/bar.rss.xml index c958edbf..a7495c36 100644 --- a/tests/output/custom/feeds/bar.rss.xml +++ b/tests/output/custom/feeds/bar.rss.xml @@ -3,6 +3,6 @@ <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeah \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.atom.xml b/tests/output/custom/feeds/cat1.atom.xml index 72703065..5454ce4d 100644 --- a/tests/output/custom/feeds/cat1.atom.xml +++ b/tests/output/custom/feeds/cat1.atom.xml @@ -1,5 +1,7 @@ -Alexis' loghttp://blog.notmyidea.org/2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> +Alexis' loghttp://blog.notmyidea.org/2011-04-20T00:00:00+02:00A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> +<p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a> +<a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/custom/feeds/cat1.rss.xml b/tests/output/custom/feeds/cat1.rss.xml index f5871487..349c3fe6 100644 --- a/tests/output/custom/feeds/cat1.rss.xml +++ b/tests/output/custom/feeds/cat1.rss.xml @@ -1,5 +1,7 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p> +<p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a> +<a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-2.htmlArticle 3http://blog.notmyidea.org/article-3.html<p>Article 3</p> Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-3.html \ No newline at end of file diff --git a/tests/output/custom/feeds/misc.atom.xml b/tests/output/custom/feeds/misc.atom.xml index cce84da9..dbf8bbfd 100644 --- a/tests/output/custom/feeds/misc.atom.xml +++ b/tests/output/custom/feeds/misc.atom.xml @@ -1,4 +1,6 @@ Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> +<p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/custom/feeds/misc.rss.xml b/tests/output/custom/feeds/misc.rss.xml index 938bce29..bbc5a48e 100644 --- a/tests/output/custom/feeds/misc.rss.xml +++ b/tests/output/custom/feeds/misc.rss.xml @@ -1,4 +1,6 @@ Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> +<p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file diff --git a/tests/output/custom/feeds/yeah.atom.xml b/tests/output/custom/feeds/yeah.atom.xml index 802f6329..d2307359 100644 --- a/tests/output/custom/feeds/yeah.atom.xml +++ b/tests/output/custom/feeds/yeah.atom.xml @@ -3,8 +3,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() diff --git a/tests/output/custom/feeds/yeah.rss.xml b/tests/output/custom/feeds/yeah.rss.xml index 68e96cf9..a54e48e4 100644 --- a/tests/output/custom/feeds/yeah.rss.xml +++ b/tests/output/custom/feeds/yeah.rss.xml @@ -3,8 +3,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index a6838a84..7b7cb84b 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -79,6 +79,8 @@

    In cat1.

    You're mutually oblivious.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    read more

    There are comments.

    diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index ba4e4f1a..8e308821 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -113,7 +113,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more @@ -140,6 +140,8 @@ YEAH !

    In misc.

    Or completely awesome. Depends the needs.

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index ce14133e..aafcc69d 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -58,7 +58,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 5df98726..6cb1c582 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -38,7 +38,7 @@

    This is a test page

    Just an image.

    -alternate text +alternate text
    diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index 85bc5a07..319f9595 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -137,7 +137,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index b7a257e4..c8653686 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -53,8 +53,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html
    index 451b1031..ddec0f41 100644
    --- a/tests/output/custom/tag/oh.html
    +++ b/tests/output/custom/tag/oh.html
    @@ -55,7 +55,7 @@
     

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index 151eb64c..a000affd 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -55,7 +55,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index 50daa573..0f1e198b 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -56,8 +56,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html
    index 5333cfdb..f22a05a2 100644
    --- a/tests/output/custom/unbelievable.html
    +++ b/tests/output/custom/unbelievable.html
    @@ -53,6 +53,8 @@
             

    In misc.

    Or completely awesome. Depends the needs.

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    From a6dd3178b1f8285aec57a31004e49590ada79a0c Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 15:10:51 +0100 Subject: [PATCH 0209/1975] test that 4 occurences of log "skipping url replacement" are found --- tests/support.py | 17 +++++++++++++++++ tests/test_pelican.py | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/support.py b/tests/support.py index b6db5195..1bbaf47e 100644 --- a/tests/support.py +++ b/tests/support.py @@ -8,6 +8,8 @@ import os import re import subprocess import sys +import logging +from logging.handlers import BufferingHandler from functools import wraps from contextlib import contextmanager @@ -157,3 +159,18 @@ def get_settings(): settings['DIRECT_TEMPLATES'] = ['archives'] settings['filenames'] = {} return settings + + +class LogCountHandler(BufferingHandler): + """ + Capturing and counting logged messages. + """ + + def __init__(self, capacity=1000): + logging.handlers.BufferingHandler.__init__(self, capacity) + + def count_logs(self, msg=None, level=None): + return len([l for l in self.buffer + if (msg is None or re.match(msg, l.getMessage())) + and (level is None or l.levelno == level) + ]) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 39c820c8..514b4cba 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -8,11 +8,13 @@ from filecmp import dircmp from tempfile import mkdtemp from shutil import rmtree import locale +import logging from mock import patch from pelican import Pelican from pelican.settings import read_settings +from .support import LogCountHandler CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) SAMPLES_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "..", "samples"))) @@ -42,6 +44,8 @@ class TestPelican(unittest.TestCase): # to run pelican in different situations and see how it behaves def setUp(self): + self.logcount_handler = LogCountHandler() + logging.getLogger().addHandler(self.logcount_handler) self.temp_path = mkdtemp() self.old_locale = locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_ALL, 'C') @@ -49,6 +53,7 @@ class TestPelican(unittest.TestCase): def tearDown(self): rmtree(self.temp_path) locale.setlocale(locale.LC_ALL, self.old_locale) + logging.getLogger().removeHandler(self.logcount_handler) def assertFilesEqual(self, diff): msg = "some generated files differ from the expected functional " \ @@ -73,6 +78,10 @@ class TestPelican(unittest.TestCase): pelican.run() dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "basic"))) self.assertFilesEqual(recursiveDiff(dcmp)) + self.assertEqual(self.logcount_handler.count_logs( + msg="Unable to find.*skipping url replacement", + level=logging.WARNING, + ), 4, msg="bad number of occurences found for this log") def test_custom_generation_works(self): # the same thing with a specified set of settings should work From a0504aeabe91f9107801661fa6bf6a6d46dc38a8 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 1 Dec 2012 18:22:43 +0100 Subject: [PATCH 0210/1975] add support for relative cross-site links --- pelican/__init__.py | 5 ++--- pelican/contents.py | 24 +++++++++++++----------- pelican/generators.py | 1 - pelican/writers.py | 6 ++++-- tests/test_contents.py | 6 +++++- tests/test_generators.py | 1 + tests/test_pelican.py | 2 +- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 52d371ec..a175e2a8 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -134,7 +134,8 @@ class Pelican(object): """Run the generators and return""" context = self.settings.copy() - filenames = {} # share the dict between all the generators + context['filenames'] = {} # share the dict between all the generators + context['localsiteurl'] = self.settings.get('SITEURL') # share generators = [ cls( context, @@ -143,8 +144,6 @@ class Pelican(object): self.theme, self.output_path, self.markup, - self.delete_outputdir, - filenames=filenames ) for cls in self.get_generator_classes() ] diff --git a/pelican/contents.py b/pelican/contents.py index 0d599771..522892ba 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -5,7 +5,6 @@ import logging import functools import os import re -import urlparse from datetime import datetime from sys import platform, stdin @@ -132,11 +131,13 @@ class Page(object): key = key if self.in_default_lang else 'lang_%s' % key return self._expand_settings(key) - def _update_content(self, content): + def _update_content(self, content, siteurl): """Change all the relative paths of the content to relative paths suitable for the ouput content. :param content: content resource that will be passed to the templates. + :param siteurl: siteurl which is locally generated by the writer in + case of RELATIVE_URLS. """ hrefs = re.compile(r""" (?P<\s*[^\>]* # match tag with src and href attr @@ -163,8 +164,8 @@ class Page(object): ) if value in self._context['filenames']: - origin = urlparse.urljoin(self._context['SITEURL'], - self._context['filenames'][value].url) + origin = '/'.join((siteurl, + self._context['filenames'][value].url)) else: logger.warning(u"Unable to find {fn}, skipping url" " replacement".format(fn=value)) @@ -174,15 +175,16 @@ class Page(object): return hrefs.sub(replacer, content) - @property @memoized + def get_content(self, siteurl): + return self._update_content( + self._get_content() if hasattr(self, "_get_content") + else self._content, + siteurl) + + @property def content(self): - if hasattr(self, "_get_content"): - content = self._get_content() - else: - content = self._content - content = self._update_content(content) - return content + return self.get_content(self._context['localsiteurl']) def _get_summary(self): """Returns the summary of an article, based on the summary metadata diff --git a/pelican/generators.py b/pelican/generators.py index 2da7d8bd..b5c1b944 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -63,7 +63,6 @@ class Generator(object): # get custom Jinja filters from user settings custom_filters = self.settings.get('JINJA_FILTERS', {}) self.env.filters.update(custom_filters) - self.context['filenames'] = kwargs.get('filenames', {}) signals.generator_init.send(self) diff --git a/pelican/writers.py b/pelican/writers.py index b24a90dd..42ddfb13 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -39,7 +39,7 @@ class Writer(object): link='%s/%s' % (self.site_url, item.url), unique_id='tag:%s,%s:%s' % (self.site_url.replace('http://', ''), item.date.date(), item.url), - description=item.content, + description=item.get_content(self.site_url), categories=item.tags if hasattr(item, 'tags') else None, author_name=getattr(item, 'author', ''), pubdate=set_date_tzinfo(item.date, @@ -124,7 +124,9 @@ class Writer(object): localcontext = context.copy() if relative_urls: - localcontext['SITEURL'] = get_relative_path(name) + relative_path = get_relative_path(name) + context['localsiteurl'] = relative_path + localcontext['SITEURL'] = relative_path localcontext.update(kwargs) diff --git a/tests/test_contents.py b/tests/test_contents.py index 8683d674..a8b9877f 100644 --- a/tests/test_contents.py +++ b/tests/test_contents.py @@ -19,6 +19,9 @@ class TestPage(unittest.TestCase): super(TestPage, self).setUp() self.page_kwargs = { 'content': TEST_CONTENT, + 'context': { + 'localsiteurl': '', + }, 'metadata': { 'summary': TEST_SUMMARY, 'title': 'foo bar', @@ -32,7 +35,8 @@ class TestPage(unittest.TestCase): """ metadata = {'foo': 'bar', 'foobar': 'baz', 'title': 'foobar', } - page = Page(TEST_CONTENT, metadata=metadata) + page = Page(TEST_CONTENT, metadata=metadata, + context={'localsiteurl': ''}) for key, value in metadata.items(): self.assertTrue(hasattr(page, key)) self.assertEqual(value, getattr(page, key)) diff --git a/tests/test_generators.py b/tests/test_generators.py index d2ad6f01..7abaf687 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -96,6 +96,7 @@ class TestArticlesGenerator(unittest.TestCase): settings['DEFAULT_CATEGORY'] = 'Default' settings['DEFAULT_DATE'] = (1970, 01, 01) settings['USE_FOLDER_AS_CATEGORY'] = False + settings['filenames'] = {} generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR, _DEFAULT_CONFIG['THEME'], None, _DEFAULT_CONFIG['MARKUP']) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index 514b4cba..e5de0608 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -81,7 +81,7 @@ class TestPelican(unittest.TestCase): self.assertEqual(self.logcount_handler.count_logs( msg="Unable to find.*skipping url replacement", level=logging.WARNING, - ), 4, msg="bad number of occurences found for this log") + ), 10, msg="bad number of occurences found for this log") def test_custom_generation_works(self): # the same thing with a specified set of settings should work From 523ac9f64cd5851771387c10b2dd85a326edec80 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 1 Dec 2012 18:22:54 +0100 Subject: [PATCH 0211/1975] update functional test output (relative cross-site links support) $ LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py \ samples/content/ $ LC_ALL="C" pelican -o tests/output/basic/ samples/content/ --- tests/output/basic/a-markdown-powered-article.html | 4 ++-- tests/output/basic/category/cat1.html | 4 ++-- tests/output/basic/category/misc.html | 4 ++-- tests/output/basic/feeds/all-en.atom.xml | 8 ++++---- tests/output/basic/feeds/all.atom.xml | 8 ++++---- tests/output/basic/feeds/cat1.atom.xml | 4 ++-- tests/output/basic/feeds/misc.atom.xml | 4 ++-- tests/output/basic/index.html | 8 ++++---- tests/output/basic/unbelievable.html | 4 ++-- tests/output/custom/a-markdown-powered-article.html | 4 ++-- tests/output/custom/author/alexis-metaireau.html | 4 ++-- tests/output/custom/author/alexis-metaireau2.html | 6 +++--- tests/output/custom/category/bar.html | 2 +- tests/output/custom/category/cat1.html | 4 ++-- tests/output/custom/category/misc.html | 4 ++-- tests/output/custom/category/yeah.html | 4 ++-- tests/output/custom/index.html | 4 ++-- tests/output/custom/index2.html | 6 +++--- tests/output/custom/oh-yeah.html | 2 +- tests/output/custom/pages/this-is-a-test-page.html | 2 +- tests/output/custom/tag/bar.html | 2 +- tests/output/custom/tag/foobar.html | 4 ++-- tests/output/custom/tag/oh.html | 2 +- tests/output/custom/tag/yeah.html | 2 +- tests/output/custom/this-is-a-super-article.html | 4 ++-- tests/output/custom/unbelievable.html | 4 ++-- 26 files changed, 54 insertions(+), 54 deletions(-) diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index 0e4e31f0..80a12212 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -46,8 +46,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    diff --git a/tests/output/basic/category/cat1.html b/tests/output/basic/category/cat1.html index bc149fc6..b8ae397e 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -43,8 +43,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    Other articles

    diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index 6a088793..86cf5470 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -69,8 +69,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index bc5418a7..fc05c4b3 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,8 +1,8 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> -<p><a href="unbelievable.html">a root-relative link to unbelievable</a> -<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +<p><a href="/unbelievable.html">a root-relative link to unbelievable</a> +<a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> @@ -24,6 +24,6 @@ YEAH !</p> <img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> -<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> -<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index 645c5890..f3a1a6f4 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -2,8 +2,8 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> -<p><a href="unbelievable.html">a root-relative link to unbelievable</a> -<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +<p><a href="/unbelievable.html">a root-relative link to unbelievable</a> +<a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> This is a super article !2010-12-02T10:14:00ZAlexis Métaireautag:,2010-12-02:this-is-a-super-article.html<p>Some content here !</p> @@ -25,6 +25,6 @@ YEAH !</p> <img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> -<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> -<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/feeds/cat1.atom.xml b/tests/output/basic/feeds/cat1.atom.xml index 3d8100fd..2fa534aa 100644 --- a/tests/output/basic/feeds/cat1.atom.xml +++ b/tests/output/basic/feeds/cat1.atom.xml @@ -1,7 +1,7 @@ A Pelican Blog/2011-04-20T00:00:00ZA markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> -<p><a href="unbelievable.html">a root-relative link to unbelievable</a> -<a href="unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> +<p><a href="/unbelievable.html">a root-relative link to unbelievable</a> +<a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> Article 22011-02-17T00:00:00Ztag:,2011-02-17:article-2.html<p>Article 2</p> Article 32011-02-17T00:00:00Ztag:,2011-02-17:article-3.html<p>Article 3</p> \ No newline at end of file diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml index 8e5477ba..40ad44c5 100644 --- a/tests/output/basic/feeds/misc.atom.xml +++ b/tests/output/basic/feeds/misc.atom.xml @@ -1,6 +1,6 @@ A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> -<p><a class="reference external" href="a-markdown-powered-article.html">a root-relative link to markdown-article</a> -<a class="reference external" href="a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +<p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> +<a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 9c00402e..97bb5256 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -69,8 +69,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    read more @@ -214,8 +214,8 @@ YEAH !

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index 95bc7b85..36a1703c 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -46,8 +46,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    diff --git a/tests/output/custom/a-markdown-powered-article.html b/tests/output/custom/a-markdown-powered-article.html index 52d0e5f9..49c0d422 100644 --- a/tests/output/custom/a-markdown-powered-article.html +++ b/tests/output/custom/a-markdown-powered-article.html @@ -53,8 +53,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    Comments !

    diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index 5a36c27e..eb39ae57 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -50,8 +50,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    There are comments.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    There are comments.

    Other articles

    diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index e456805b..a87c85af 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -62,7 +62,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text
    read more @@ -142,8 +142,8 @@ as well as inline markup.

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/category/bar.html b/tests/output/custom/category/bar.html index d291b9df..253d64ea 100644 --- a/tests/output/custom/category/bar.html +++ b/tests/output/custom/category/bar.html @@ -55,7 +55,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/category/cat1.html b/tests/output/custom/category/cat1.html index 9316faf0..8c265d41 100644 --- a/tests/output/custom/category/cat1.html +++ b/tests/output/custom/category/cat1.html @@ -50,8 +50,8 @@

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    There are comments.

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    There are comments.

    Other articles

    diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index 6609ce25..24a53791 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -79,8 +79,8 @@

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/category/yeah.html b/tests/output/custom/category/yeah.html index 587e2f97..c39e1a86 100644 --- a/tests/output/custom/category/yeah.html +++ b/tests/output/custom/category/yeah.html @@ -53,8 +53,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html
    index 7b7cb84b..eab96fa1 100644
    --- a/tests/output/custom/index.html
    +++ b/tests/output/custom/index.html
    @@ -79,8 +79,8 @@
             

    In cat1.

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    read more

    There are comments.

    diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 8e308821..5269ed70 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -113,7 +113,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more @@ -140,8 +140,8 @@ YEAH !

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    read more

    There are comments.

    diff --git a/tests/output/custom/oh-yeah.html b/tests/output/custom/oh-yeah.html index aafcc69d..cb30a7d6 100644 --- a/tests/output/custom/oh-yeah.html +++ b/tests/output/custom/oh-yeah.html @@ -58,7 +58,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text diff --git a/tests/output/custom/pages/this-is-a-test-page.html b/tests/output/custom/pages/this-is-a-test-page.html index 6cb1c582..5df98726 100644 --- a/tests/output/custom/pages/this-is-a-test-page.html +++ b/tests/output/custom/pages/this-is-a-test-page.html @@ -38,7 +38,7 @@

    This is a test page

    Just an image.

    -alternate text +alternate text
    diff --git a/tests/output/custom/tag/bar.html b/tests/output/custom/tag/bar.html index 319f9595..85bc5a07 100644 --- a/tests/output/custom/tag/bar.html +++ b/tests/output/custom/tag/bar.html @@ -137,7 +137,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more diff --git a/tests/output/custom/tag/foobar.html b/tests/output/custom/tag/foobar.html index c8653686..b7a257e4 100644 --- a/tests/output/custom/tag/foobar.html +++ b/tests/output/custom/tag/foobar.html @@ -53,8 +53,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/tag/oh.html b/tests/output/custom/tag/oh.html
    index ddec0f41..451b1031 100644
    --- a/tests/output/custom/tag/oh.html
    +++ b/tests/output/custom/tag/oh.html
    @@ -55,7 +55,7 @@
     

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/tag/yeah.html b/tests/output/custom/tag/yeah.html index a000affd..151eb64c 100644 --- a/tests/output/custom/tag/yeah.html +++ b/tests/output/custom/tag/yeah.html @@ -55,7 +55,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/tests/output/custom/this-is-a-super-article.html b/tests/output/custom/this-is-a-super-article.html index 0f1e198b..98d22351 100644 --- a/tests/output/custom/this-is-a-super-article.html +++ b/tests/output/custom/this-is-a-super-article.html @@ -56,8 +56,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/tests/output/custom/unbelievable.html b/tests/output/custom/unbelievable.html
    index f22a05a2..691f28f6 100644
    --- a/tests/output/custom/unbelievable.html
    +++ b/tests/output/custom/unbelievable.html
    @@ -53,8 +53,8 @@
             

    In misc.

    Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    From 81cb774a8e807453a82921aa31f2f1325b6a3d23 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Sat, 1 Dec 2012 21:35:15 +0100 Subject: [PATCH 0212/1975] add docs for cross-site linking --- docs/getting_started.rst | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 467363de..bc3d2bbe 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -226,6 +226,50 @@ If you want to exclude any pages from being linked to or listed in the menu then add a ``status: hidden`` attribute to its metadata. This is useful for things like making error pages that fit the generated theme of your site. +Linking to internal content +--------------------------- + +Since Pelican 3.1, you now have the ability to do cross-site linking. + +To link to an internal content, you will have to use the following syntax: +``|filename|path/to/file``. + +For example, you may want to add links between "article1" and "article2" given +the structure:: + + website/ + ├── content + │   ├── article1.rst + │   └── cat/ + │      └── article2.md + └── pelican.conf.py + +In this example, ``article1.rst`` could look like:: + + Title: The first article + Date: 2012-12-01 + + See below cross-site links examples in restructured text. + + `a root-relative link <|filename|/cat/article2.md>`_ + `a file-relative link <|filename|cat/article2.md>`_ + +and ``article2.md``:: + + Title: The second article + Date: 2012-12-01 + + See below cross-site links examples in markdown. + + [a root-relative link](|filename|/article1.rst) + [a file-relative link](|filename|../article1.rst) + +.. note:: + + You can use the same syntax to link to internal pages or even static + content (like images) which would be available in a directory listed in + ``settings["STATIC_PATHS"]``. + Importing an existing blog -------------------------- From 891a66ad8bd0913c064f176db3dba405f83b7aaa Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Sun, 2 Dec 2012 13:11:47 -0500 Subject: [PATCH 0213/1975] Updated documentation to reflect addition of new markdown types. --- docs/getting_started.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index bc3d2bbe..7b44034c 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -162,10 +162,10 @@ Pelican implements an extension of reStructuredText to enable support for the This will be turned into :abbr:`HTML (HyperText Markup Language)`. -You can also use Markdown syntax (with a file ending in ``.md``). -Markdown generation will not work until you explicitly install the ``Markdown`` -package, which can be done via ``pip install Markdown``. Metadata syntax for -Markdown posts should follow this pattern:: +You can also use Markdown syntax (with a file ending in ``.md``, ``.markdown``, +or ``.mkd``). Markdown generation will not work until you explicitly install the +``Markdown`` package, which can be done via ``pip install Markdown``. Metadata +syntax for Markdown posts should follow this pattern:: Title: My super title Date: 2010-12-03 10:20 From 49f481e399af45bf12f53afd129bd6a873dc2f27 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Sun, 28 Oct 2012 07:37:53 -0700 Subject: [PATCH 0214/1975] Add asciidoc reader support http://www.methods.co.nz/asciidoc/index.html Processes files ending in .asc with asciidoc. Extra arguments can be passed by using the ASCIIDOC_OPTIONS config setting --- docs/changelog.rst | 1 + docs/getting_started.rst | 4 ++ docs/index.rst | 3 +- docs/internals.rst | 10 ++--- docs/settings.rst | 2 + pelican/readers.py | 36 ++++++++++++++++ tests/content/article_with_asc_extension.asc | 12 ++++++ tests/content/article_with_asc_options.asc | 9 ++++ tests/test_readers.py | 43 ++++++++++++++++++++ 9 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 tests/content/article_with_asc_extension.asc create mode 100644 tests/content/article_with_asc_options.asc diff --git a/docs/changelog.rst b/docs/changelog.rst index f60c6e47..f25ee3d9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,6 +24,7 @@ Release history * Add the gzip_cache plugin which compresses common text files into a ``.gz`` file within the same directory as the original file to prevent the server (e.g. Nginx) from compressing files during an HTTP call. +* Add AsciiDoc support 3.0 (2012-08-08) ================== diff --git a/docs/getting_started.rst b/docs/getting_started.rst index bc3d2bbe..8959f536 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -42,6 +42,10 @@ Markdown library as well:: $ pip install Markdown +If you want to use AsciiDoc you need to install it from `source +`_ or use your operating +system's package manager. + Upgrading --------- diff --git a/docs/index.rst b/docs/index.rst index fd99b449..8206727c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ Pelican Pelican is a static site generator, written in Python_. * Write your weblog entries directly with your editor of choice (vim!) - in reStructuredText_ or Markdown_ + in reStructuredText_, Markdown_ or AsciiDoc_ * Includes a simple CLI tool to (re)generate the weblog * Easy to interface with DVCSes and web hooks * Completely static output is easy to host anywhere @@ -74,6 +74,7 @@ A French version of the documentation is available at :doc:`fr/index`. .. _Python: http://www.python.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ +.. _AsciiDoc: http://www.methods.co.nz/asciidoc/index.html .. _Jinja2: http://jinja.pocoo.org/ .. _`Pelican documentation`: http://docs.getpelican.com/latest/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html diff --git a/docs/internals.rst b/docs/internals.rst index a6264476..280e14d7 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -12,8 +12,8 @@ original author wrote with some software design information. Overall structure ================= -What Pelican does is take a list of files and process them into some -sort of output. Usually, the input files are reStructuredText and Markdown +What Pelican does is take a list of files and process them into some sort of +output. Usually, the input files are reStructuredText, Markdown and AsciiDoc files, and the output is a blog, but both input and output can be anything you want. @@ -23,9 +23,9 @@ The logic is separated into different classes and concepts: on. Since those operations are commonly used, the object is created once and then passed to the generators. -* **Readers** are used to read from various formats (Markdown and - reStructuredText for now, but the system is extensible). Given a file, they return - metadata (author, tags, category, etc.) and content (HTML-formatted). +* **Readers** are used to read from various formats (AsciiDoc, Markdown and + reStructuredText for now, but the system is extensible). Given a file, they + return metadata (author, tags, category, etc.) and content (HTML-formatted). * **Generators** generate the different outputs. For instance, Pelican comes with ``ArticlesGenerator`` and ``PageGenerator``. Given a configuration, they can do diff --git a/docs/settings.rst b/docs/settings.rst index a7cf107b..7d73afe0 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -121,6 +121,8 @@ Setting name (default value) What doe This templates need to use ``DIRECT_TEMPLATES`` setting `MARKDOWN_EXTENSIONS` (``['toc',]``) A list of any Markdown extensions you want to use. +`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to asciidoc, see the `manpage + `_ ===================================================================== ===================================================================== .. [#] Default is the system locale. diff --git a/pelican/readers.py b/pelican/readers.py index 42995688..f04b4a03 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -13,6 +13,11 @@ try: from markdown import Markdown except ImportError: Markdown = False # NOQA +try: + from asciidocapi import AsciiDocAPI + asciidoc = True +except ImportError: + asciidoc = False import re from pelican.contents import Category, Tag, Author @@ -162,6 +167,37 @@ class HtmlReader(Reader): return content, metadata +class AsciiDocReader(Reader): + enabled = bool(asciidoc) + file_extensions = ['asc'] + default_options = ["--no-header-footer", "-a newline=\\n"] + + def read(self, filename): + """Parse content and metadata of asciidoc files""" + from cStringIO import StringIO + text = StringIO(pelican_open(filename)) + content = StringIO() + ad = AsciiDocAPI() + + options = self.settings.get('ASCIIDOC_OPTIONS', []) + if isinstance(options, (str, unicode)): + options = [m.strip() for m in options.split(',')] + options = self.default_options + options + for o in options: + ad.options(*o.split()) + + ad.execute(text, content, backend="html4") + content = content.getvalue() + + metadata = {} + for name, value in ad.asciidoc.document.attributes.items(): + name = name.lower() + metadata[name] = self.process_metadata(name, value) + if 'doctitle' in metadata: + metadata['title'] = metadata['doctitle'] + return content, metadata + + _EXTENSIONS = {} for cls in Reader.__subclasses__(): diff --git a/tests/content/article_with_asc_extension.asc b/tests/content/article_with_asc_extension.asc new file mode 100644 index 00000000..9ce2166c --- /dev/null +++ b/tests/content/article_with_asc_extension.asc @@ -0,0 +1,12 @@ +Test AsciiDoc File Header +========================= +:Author: Author O. Article +:Email: +:Date: 2011-09-15 09:05 +:Category: Blog +:Tags: Linux, Python, Pelican + +Used for pelican test +--------------------- + +The quick brown fox jumped over the lazy dog's back. diff --git a/tests/content/article_with_asc_options.asc b/tests/content/article_with_asc_options.asc new file mode 100644 index 00000000..bafb3a4a --- /dev/null +++ b/tests/content/article_with_asc_options.asc @@ -0,0 +1,9 @@ +Test AsciiDoc File Header +========================= + +Used for pelican test +--------------------- + +version {revision} + +The quick brown fox jumped over the lazy dog's back. diff --git a/tests/test_readers.py b/tests/test_readers.py index 406027c1..c9d22c18 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -109,3 +109,46 @@ class MdReaderTest(unittest.TestCase): '

    Level2

    ' self.assertEqual(content, expected) + +class AdReaderTest(unittest.TestCase): + + @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") + def test_article_with_asc_extension(self): + # test to ensure the asc extension is being processed by the correct reader + reader = readers.AsciiDocReader({}) + content, metadata = reader.read(_filename('article_with_asc_extension.asc')) + expected = '
    \n

    Used for pelican test

    \n'\ + '

    The quick brown fox jumped over the lazy dog’s back.

    \n' + self.assertEqual(content, expected) + expected = { + 'category': 'Blog', + 'author': 'Author O. Article', + 'title': 'Test AsciiDoc File Header', + 'date': datetime.datetime(2011, 9, 15, 9, 5), + 'tags': ['Linux', 'Python', 'Pelican'], + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + + expected = { + 'category': 'Blog', + 'author': 'Author O. Article', + 'title': 'Test AsciiDoc File Header', + 'date': datetime.datetime(2011, 9, 15, 9, 5), + 'tags': ['Linux', 'Python', 'Pelican'], + } + + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") + def test_article_with_asc_options(self): + # test to ensure the ASCIIDOC_OPTIONS is being used + reader = readers.AsciiDocReader(dict(ASCIIDOC_OPTIONS=["-a revision=1.0.42"])) + content, metadata = reader.read(_filename('article_with_asc_options.asc')) + expected = '
    \n

    Used for pelican test

    \n'\ + '

    version 1.0.42

    \n'\ + '

    The quick brown fox jumped over the lazy dog’s back.

    \n' + self.assertEqual(content, expected) From a0049f9fcddf967d036a88fcf17169982f3fc993 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sun, 2 Dec 2012 16:10:11 -0800 Subject: [PATCH 0215/1975] Strip tags from title in simple index. Fixes #612 This fix was applied previously to the relevant places in both the "simple" and "notmyidea" themes, but the simple theme's index.html file was apparently neglected. --- pelican/themes/simple/templates/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pelican/themes/simple/templates/index.html b/pelican/themes/simple/templates/index.html index dfdb0b45..5bb94dfc 100644 --- a/pelican/themes/simple/templates/index.html +++ b/pelican/themes/simple/templates/index.html @@ -1,14 +1,14 @@ {% extends "base.html" %} -{% block content %} +{% block content %}
    {% block content_title %}

    All articles

    {% endblock %}
      -{% for article in articles_page.object_list %} -
    1. -

      {{ article.title }}

      +{% for article in articles_page.object_list %} +
    2. +

      {{ article.title }}

      {{ article.locale_date }} {% if article.author %}
      By {{ article.author }}
      {% endif %} From debd6fb3b4a472c80a8fc7924eddf6e79856e725 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 28 Nov 2012 00:29:30 +0100 Subject: [PATCH 0216/1975] add FILENAME_METADATA setting to extract metadata from filename FILENAME_METADATA default to '(?P\d{4}-\d{2}-\d{2}).*' which will allow to extract date metadata from the filename. --- pelican/readers.py | 14 +++++++++++++- pelican/settings.py | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/pelican/readers.py b/pelican/readers.py index f04b4a03..ad2b0f74 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +import os +import re try: import docutils import docutils.core @@ -207,8 +209,9 @@ for cls in Reader.__subclasses__(): def read_file(filename, fmt=None, settings=None): """Return a reader object using the given format.""" + base, ext = os.path.splitext(os.path.basename(filename)) if not fmt: - fmt = filename.split('.')[-1] + fmt = ext[1:] if fmt not in _EXTENSIONS: raise TypeError('Pelican does not know how to parse %s' % filename) @@ -230,4 +233,13 @@ def read_file(filename, fmt=None, settings=None): content = typogrify(content) metadata['title'] = typogrify(metadata['title']) + filename_metadata = settings and settings.get('FILENAME_METADATA') + if filename_metadata: + match = re.match(filename_metadata, base) + if match: + for k, v in match.groupdict().iteritems(): + if k not in metadata: + k = k.lower() # metadata must be lowercase + metadata[k] = reader.process_metadata(k, v) + return content, metadata diff --git a/pelican/settings.py b/pelican/settings.py index d2c0cef5..a98f3538 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -5,6 +5,7 @@ import inspect import os import locale import logging +import re from os.path import isabs @@ -60,7 +61,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'TAG_CLOUD_STEPS': 4, 'TAG_CLOUD_MAX_ITEMS': 100, 'DIRECT_TEMPLATES': ('index', 'tags', 'categories', 'archives'), - 'EXTRA_TEMPLATES_PATHS' : [], + 'EXTRA_TEMPLATES_PATHS': [], 'PAGINATED_DIRECT_TEMPLATES': ('index', ), 'PELICAN_CLASS': 'pelican.Pelican', 'DEFAULT_DATE_FORMAT': '%a %d %B %Y', @@ -70,6 +71,7 @@ _DEFAULT_CONFIG = {'PATH': '.', 'DEFAULT_PAGINATION': False, 'DEFAULT_ORPHANS': 0, 'DEFAULT_METADATA': (), + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*', 'FILES_TO_COPY': (), 'DEFAULT_STATUS': 'published', 'ARTICLE_PERMALINK_STRUCTURE': '', @@ -205,4 +207,12 @@ def configure_settings(settings): " falling back to the default extension " + _DEFAULT_CONFIG['OUTPUT_SOURCES_EXTENSION']) + filename_metadata = settings.get('FILENAME_METADATA') + if filename_metadata and not isinstance(filename_metadata, basestring): + logger.error("Detected misconfiguration with FILENAME_METADATA" + " setting (must be string or compiled pattern), falling" + "back to the default") + settings['FILENAME_METADATA'] = \ + _DEFAULT_CONFIG['FILENAME_METADATA'] + return settings From 3a25f82c4fc95c4654a7d85eb0fdd85e39cfb904 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Wed, 28 Nov 2012 01:01:15 +0100 Subject: [PATCH 0217/1975] update docs/settings.rst for both DEFAULT_METADATA and FILENAME_METADATA --- docs/settings.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/settings.rst b/docs/settings.rst index 7d73afe0..2ce44dfb 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -50,6 +50,16 @@ Setting name (default value) What doe If tuple object, it will instead generate the default datetime object by passing the tuple to the datetime.datetime constructor. +`DEFAULT_METADATA` (``()``) The default metadata you want to use for all articles + and pages. +`FILENAME_METADATA` (``'(?P\d{4}-\d{2}-\d{2}).*'``) The regexp that will be used to extract any metadata + from the filename. All named groups that are matched + will be set in the metadata object. + The default value will only extract the date from + the filename. + For example, if you would like to extract both the + date and the slug, you could set something like: + ``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before generating new files. `FILES_TO_COPY` (``()``) A list of files (or directories) to copy from the source (inside the From dfab8ed5b96a03ac35394acc3123ca0b79eb552e Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 01:12:59 +0100 Subject: [PATCH 0218/1975] test the "metadata from filename" feature --- pelican/readers.py | 2 +- ...2012-11-29_rst_w_filename_meta#foo-bar.rst | 6 ++ .../2012-11-30_md_w_filename_meta#foo-bar.md | 6 ++ tests/test_readers.py | 93 +++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst create mode 100644 tests/content/2012-11-30_md_w_filename_meta#foo-bar.md diff --git a/pelican/readers.py b/pelican/readers.py index ad2b0f74..74cec02f 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -228,7 +228,7 @@ def read_file(filename, fmt=None, settings=None): content, metadata = reader.read(filename) # eventually filter the content with typogrify if asked so - if settings and settings['TYPOGRIFY']: + if settings and settings.get('TYPOGRIFY'): from typogrify.filters import typogrify content = typogrify(content) metadata['title'] = typogrify(metadata['title']) diff --git a/tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst b/tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst new file mode 100644 index 00000000..43f05a15 --- /dev/null +++ b/tests/content/2012-11-29_rst_w_filename_meta#foo-bar.rst @@ -0,0 +1,6 @@ + +Rst with filename metadata +########################## + +:category: yeah +:author: Alexis Métaireau diff --git a/tests/content/2012-11-30_md_w_filename_meta#foo-bar.md b/tests/content/2012-11-30_md_w_filename_meta#foo-bar.md new file mode 100644 index 00000000..cdccfc8a --- /dev/null +++ b/tests/content/2012-11-30_md_w_filename_meta#foo-bar.md @@ -0,0 +1,6 @@ +category: yeah +author: Alexis Métaireau + +Markdown with filename metadata +=============================== + diff --git a/tests/test_readers.py b/tests/test_readers.py index c9d22c18..dcfee809 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -34,6 +34,50 @@ class RstReaderTest(unittest.TestCase): for key, value in expected.items(): self.assertEquals(value, metadata[key], key) + def test_article_with_filename_metadata(self): + content, metadata = readers.read_file( + _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + settings={}) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'Rst with filename metadata', + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'Rst with filename metadata', + 'date': datetime.datetime(2012, 11, 29), + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-29_rst_w_filename_meta#foo-bar.rst'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2})_' \ + '_(?P.*)' \ + '#(?P.*)-(?P.*)' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'Rst with filename metadata', + 'date': datetime.datetime(2012, 11, 29), + 'slug': 'article_with_filename_metadata', + 'mymeta': 'foo', + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + def test_article_metadata_key_lowercase(self): """Keys of metadata should be lowercase.""" reader = readers.RstReader({}) @@ -80,6 +124,13 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) + expected = { + 'category': 'test', + 'title': 'Test md File', + } + for key, value in metadata.items(): + self.assertEquals(value, expected[key], key) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_mkd_extension(self): # test to ensure the mkd extension is being processed by the correct reader @@ -110,6 +161,48 @@ class MdReaderTest(unittest.TestCase): self.assertEqual(content, expected) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") + def test_article_with_filename_metadata(self): + content, metadata = readers.read_file( + _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + settings={}) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + } + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2}).*' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'date': datetime.datetime(2012, 11, 30), + } + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + + content, metadata = readers.read_file( + _filename('2012-11-30_md_w_filename_meta#foo-bar.md'), + settings={ + 'FILENAME_METADATA': '(?P\d{4}-\d{2}-\d{2})' + '_(?P.*)' + '#(?P.*)-(?P.*)' + }) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'date': datetime.datetime(2012, 11, 30), + 'slug': 'md_w_filename_meta', + 'mymeta': 'foo', + } + for key, value in expected.items(): + self.assertEquals(value, metadata[key], key) + class AdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed") From 92b9ccb08a077675984986c4f36fedf73c0e803b Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 01:29:11 +0100 Subject: [PATCH 0219/1975] fix failing TestArticlesGenerator.test_generate_context test new file have been added to the content directory so articles_expected needs to be updated --- tests/test_generators.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_generators.py b/tests/test_generators.py index 7abaf687..90b19227 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -73,6 +73,7 @@ class TestArticlesGenerator(unittest.TestCase): [u'Article title', 'published', 'Default', 'article'], [u'Article with template', 'published', 'Default', 'custom'], [u'Test md File', 'published', 'test', 'article'], + [u'Rst with filename metadata', 'published', u'yeah', 'article'], [u'Test Markdown extensions', 'published', u'Default', 'article'], [u'This is a super article !', 'published', 'Yeah', 'article'], [u'This is an article with category !', 'published', 'yeah', 'article'], From fc13ae8e7605db6cac1f3e7dfac5aa9777d088b0 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 01:48:28 +0100 Subject: [PATCH 0220/1975] add new file to functional test content to showcase FILENAME_METADATA and update functional tests output --- .../content/2012-11-30_filename-metadata.rst | 4 + tests/output/basic/archives.html | 2 + tests/output/basic/category/misc.html | 40 ++++-- tests/output/basic/feeds/all-en.atom.xml | 3 +- tests/output/basic/feeds/all.atom.xml | 3 +- tests/output/basic/feeds/misc.atom.xml | 3 +- .../basic/filename_metadata-example.html | 66 ++++++++++ tests/output/basic/index.html | 40 ++++-- tests/output/custom/archives.html | 2 + .../custom/author/alexis-metaireau.html | 2 +- .../custom/author/alexis-metaireau2.html | 55 ++++----- .../custom/author/alexis-metaireau3.html | 115 +++++++++++++++++ tests/output/custom/category/misc.html | 43 +++++-- tests/output/custom/feeds/all-en.atom.xml | 3 +- tests/output/custom/feeds/all.atom.xml | 3 +- tests/output/custom/feeds/all.rss.xml | 3 +- tests/output/custom/feeds/misc.atom.xml | 3 +- tests/output/custom/feeds/misc.rss.xml | 3 +- .../custom/filename_metadata-example.html | 116 ++++++++++++++++++ tests/output/custom/index.html | 70 +++++------ tests/output/custom/index2.html | 55 ++++----- tests/output/custom/index3.html | 115 +++++++++++++++++ 22 files changed, 622 insertions(+), 127 deletions(-) create mode 100644 samples/content/2012-11-30_filename-metadata.rst create mode 100644 tests/output/basic/filename_metadata-example.html create mode 100644 tests/output/custom/author/alexis-metaireau3.html create mode 100644 tests/output/custom/filename_metadata-example.html create mode 100644 tests/output/custom/index3.html diff --git a/samples/content/2012-11-30_filename-metadata.rst b/samples/content/2012-11-30_filename-metadata.rst new file mode 100644 index 00000000..b048103d --- /dev/null +++ b/samples/content/2012-11-30_filename-metadata.rst @@ -0,0 +1,4 @@ +FILENAME_METADATA example +######################### + +Some cool stuff! diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index 0bccff9b..cb06dfa1 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -33,6 +33,8 @@

      Archives for A Pelican Blog

      +
      Fri 30 November 2012
      +
      FILENAME_METADATA example
      Wed 29 February 2012
      Second article
      Wed 20 April 2011
      diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index 86cf5470..2d62b852 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -34,8 +34,32 @@ +
      +

      Other articles

      +
      +
        + + + +
      1. +
        +

        Second article

        +
        + +
        +
        Wed 29 February 2012 @@ -44,14 +68,12 @@

        tags: foobarbaz

        Translations: fr -

        This is some article, in english

        -
        - -
        -

        Other articles

        -
        -
          - +

      This is some article, in english

      + + read more +
    + +
  • diff --git a/tests/output/basic/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml index fc05c4b3..54c87905 100644 --- a/tests/output/basic/feeds/all-en.atom.xml +++ b/tests/output/basic/feeds/all-en.atom.xml @@ -1,5 +1,6 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-11-30T00:00:00ZFILENAME_METADATA example2012-11-30T00:00:00Ztag:,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="/unbelievable.html">a root-relative link to unbelievable</a> <a href="/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00Ztag:,2011-02-17:article-1.html<p>Article 1</p> diff --git a/tests/output/basic/feeds/all.atom.xml b/tests/output/basic/feeds/all.atom.xml index f3a1a6f4..3081adc6 100644 --- a/tests/output/basic/feeds/all.atom.xml +++ b/tests/output/basic/feeds/all.atom.xml @@ -1,5 +1,6 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-11-30T00:00:00ZFILENAME_METADATA example2012-11-30T00:00:00Ztag:,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00Ztag:,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00Ztag:,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="/unbelievable.html">a root-relative link to unbelievable</a> diff --git a/tests/output/basic/feeds/misc.atom.xml b/tests/output/basic/feeds/misc.atom.xml index 40ad44c5..e71bd151 100644 --- a/tests/output/basic/feeds/misc.atom.xml +++ b/tests/output/basic/feeds/misc.atom.xml @@ -1,5 +1,6 @@ -A Pelican Blog/2012-02-29T00:00:00ZSecond article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> +A Pelican Blog/2012-11-30T00:00:00ZFILENAME_METADATA example2012-11-30T00:00:00Ztag:,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00Ztag:,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> diff --git a/tests/output/basic/filename_metadata-example.html b/tests/output/basic/filename_metadata-example.html new file mode 100644 index 00000000..b7ae95a7 --- /dev/null +++ b/tests/output/basic/filename_metadata-example.html @@ -0,0 +1,66 @@ + + + + FILENAME_METADATA example + + + + + + + + + + + + + + +
    + +
    +
    +
    + + + + + \ No newline at end of file diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 97bb5256..488d1b08 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -34,8 +34,32 @@ +
    +

    Other articles

    +
    +
      + + + +
    1. +
      +

      Second article

      +
      + +
      +
      Wed 29 February 2012 @@ -44,14 +68,12 @@

      tags: foobarbaz

      Translations: fr -

      This is some article, in english

      -
      - -
      -

      Other articles

      -
      -
        - +

        This is some article, in english

        + + read more + +
  • +
  • diff --git a/tests/output/custom/archives.html b/tests/output/custom/archives.html index 44bc876e..632387a4 100644 --- a/tests/output/custom/archives.html +++ b/tests/output/custom/archives.html @@ -37,6 +37,8 @@

    Archives for Alexis' log

    +
    Fri 30 November 2012
    +
    FILENAME_METADATA example
    Wed 29 February 2012
    Second article
    Wed 20 April 2011
    diff --git a/tests/output/custom/author/alexis-metaireau.html b/tests/output/custom/author/alexis-metaireau.html index eb39ae57..8bb0dd1c 100644 --- a/tests/output/custom/author/alexis-metaireau.html +++ b/tests/output/custom/author/alexis-metaireau.html @@ -134,7 +134,7 @@
  • - Page 1 / 2 + Page 1 / 3 »

    diff --git a/tests/output/custom/author/alexis-metaireau2.html b/tests/output/custom/author/alexis-metaireau2.html index a87c85af..59926d8c 100644 --- a/tests/output/custom/author/alexis-metaireau2.html +++ b/tests/output/custom/author/alexis-metaireau2.html @@ -39,6 +39,31 @@
      +
    1. + + +
    2. - - - -

    « - Page 2 / 2 + Page 2 / 3 + »

    diff --git a/tests/output/custom/author/alexis-metaireau3.html b/tests/output/custom/author/alexis-metaireau3.html new file mode 100644 index 00000000..5f2ecbb1 --- /dev/null +++ b/tests/output/custom/author/alexis-metaireau3.html @@ -0,0 +1,115 @@ + + + + Alexis' log - Alexis Métaireau + + + + + + + + + + + + + + + +Fork me on GitHub + + + + + + +
    +
      +
    1. +
    +

    + « + Page 3 / 3 +

    +
    +
    +
    +

    blogroll

    + +
    + +
    + + + + + + \ No newline at end of file diff --git a/tests/output/custom/category/misc.html b/tests/output/custom/category/misc.html index 24a53791..33acbd70 100644 --- a/tests/output/custom/category/misc.html +++ b/tests/output/custom/category/misc.html @@ -38,8 +38,35 @@ +
    +

    Other articles

    +
    +
      + + + +
    1. - -
      -

      Other articles

      -
      -
        - +

        This is some article, in english

        + + read more +

        There are comments.

        + +
      1. diff --git a/tests/output/custom/feeds/all-en.atom.xml b/tests/output/custom/feeds/all-en.atom.xml index f8eb3219..5c8f9241 100644 --- a/tests/output/custom/feeds/all-en.atom.xml +++ b/tests/output/custom/feeds/all-en.atom.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/2012-11-30T00:00:00+01:00FILENAME_METADATA example2012-11-30T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a> <a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Article 12011-02-17T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2011-02-17:article-1.html<p>Article 1</p> diff --git a/tests/output/custom/feeds/all.atom.xml b/tests/output/custom/feeds/all.atom.xml index b009d135..ae5fe30c 100644 --- a/tests/output/custom/feeds/all.atom.xml +++ b/tests/output/custom/feeds/all.atom.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/2012-03-02T14:01:01+01:00Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> +Alexis' loghttp://blog.notmyidea.org/2012-11-30T00:00:00+01:00FILENAME_METADATA example2012-11-30T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Trop bien !2012-03-02T14:01:01+01:00Alexis Métaireautag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html<p>Et voila du contenu en français</p> Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> Deuxième article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article-fr.html<p>Ceci est un article, en français.</p> A markdown powered article2011-04-20T00:00:00+02:00Alexis Métaireautag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html<p>You're mutually oblivious.</p> diff --git a/tests/output/custom/feeds/all.rss.xml b/tests/output/custom/feeds/all.rss.xml index 786cb097..0ce2c837 100644 --- a/tests/output/custom/feeds/all.rss.xml +++ b/tests/output/custom/feeds/all.rss.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/Fri, 02 Mar 2012 14:01:01 +0100Trop bien !http://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> +Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> +Alexis MétaireauFri, 30 Nov 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.htmlTrop bien !http://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> Alexis MétaireauFri, 02 Mar 2012 14:01:01 +0100tag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazDeuxième articlehttp://blog.notmyidea.org/second-article-fr.html<p>Ceci est un article, en français.</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article-fr.htmlfoobarbazA markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p> diff --git a/tests/output/custom/feeds/misc.atom.xml b/tests/output/custom/feeds/misc.atom.xml index dbf8bbfd..45c996f3 100644 --- a/tests/output/custom/feeds/misc.atom.xml +++ b/tests/output/custom/feeds/misc.atom.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/2012-02-29T00:00:00+01:00Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/2012-11-30T00:00:00+01:00FILENAME_METADATA example2012-11-30T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html<p>Some cool stuff!</p> +Second article2012-02-29T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2012-02-29:second-article.html<p>This is some article, in english</p> Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> diff --git a/tests/output/custom/feeds/misc.rss.xml b/tests/output/custom/feeds/misc.rss.xml index bbc5a48e..a0fa290d 100644 --- a/tests/output/custom/feeds/misc.rss.xml +++ b/tests/output/custom/feeds/misc.rss.xml @@ -1,5 +1,6 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 29 Feb 2012 00:00:00 +0100Second articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> +Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> +Alexis MétaireauFri, 30 Nov 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> diff --git a/tests/output/custom/filename_metadata-example.html b/tests/output/custom/filename_metadata-example.html new file mode 100644 index 00000000..8f6353cb --- /dev/null +++ b/tests/output/custom/filename_metadata-example.html @@ -0,0 +1,116 @@ + + + + FILENAME_METADATA example + + + + + + + + + + + + + + + +Fork me on GitHub + + +
        +
        +
        +

        + FILENAME_METADATA example

        +
        + +
        +

        Some cool stuff!

        + +
        +
        +

        Comments !

        +
        + +
        + +
        +
        +
        +
        +

        blogroll

        + +
        + +
        + + + + + + \ No newline at end of file diff --git a/tests/output/custom/index.html b/tests/output/custom/index.html index eab96fa1..cc905735 100644 --- a/tests/output/custom/index.html +++ b/tests/output/custom/index.html @@ -38,8 +38,35 @@ +
        +

        Other articles

        +
        +
          + + + +
        1. - -
          -

          Other articles

          -
          -
            - +

            This is some article, in english

            + + read more +

            There are comments.

            +
      2. +
      3. - - - -

      - Page 1 / 2 + Page 1 / 3 »

      diff --git a/tests/output/custom/index2.html b/tests/output/custom/index2.html index 5269ed70..f0d2f948 100644 --- a/tests/output/custom/index2.html +++ b/tests/output/custom/index2.html @@ -39,6 +39,31 @@
        +
      1. + + +
      2. - - - -

      « - Page 2 / 2 + Page 2 / 3 + »

      diff --git a/tests/output/custom/index3.html b/tests/output/custom/index3.html new file mode 100644 index 00000000..60f8633d --- /dev/null +++ b/tests/output/custom/index3.html @@ -0,0 +1,115 @@ + + + + Alexis' log + + + + + + + + + + + + + + + +Fork me on GitHub + + + + + + +
      +
        +
      1. +
      +

      + « + Page 3 / 3 +

      +
      +
      +
      +

      blogroll

      + +
      + +
      + + + + + + \ No newline at end of file From 070fa1ff9dcb7603e0c555168f27bb057694a6b2 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 02:19:38 +0100 Subject: [PATCH 0221/1975] add more docs about FILENAME_METADATA --- docs/changelog.rst | 2 ++ docs/getting_started.rst | 29 ++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f25ee3d9..ab3a4233 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,8 @@ Release history file within the same directory as the original file to prevent the server (e.g. Nginx) from compressing files during an HTTP call. * Add AsciiDoc support +* Add ``FILENAME_METADATA`` new setting which adds support for metadata + extraction from the filename. 3.0 (2012-08-08) ================== diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 73378fc4..6be7fbb2 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -181,15 +181,26 @@ syntax for Markdown posts should follow this pattern:: This is the content of my super blog post. -Note that, aside from the title, none of this metadata is mandatory: if the date -is not specified, Pelican will rely on the file's "mtime" timestamp, and the -category can be determined by the directory in which the file resides. For -example, a file located at ``python/foobar/myfoobar.rst`` will have a category of -``foobar``. If you would like to organize your files in other ways where the -name of the subfolder would not be a good category name, you can set the -setting ``USE_FOLDER_AS_CATEGORY`` to ``False``. If summary isn't given, setting -``SUMMARY_MAX_LENGTH`` determines how many words from the beginning of an article -are used as the summary. +Note that, aside from the title, none of this metadata is mandatory: if the +date is not specified, Pelican can rely on the file's "mtime" timestamp through +the ``DEFAULT_DATE`` setting, and the category can be determined by the +directory in which the file resides. For example, a file located at +``python/foobar/myfoobar.rst`` will have a category of ``foobar``. If you would +like to organize your files in other ways where the name of the subfolder would +not be a good category name, you can set the setting ``USE_FOLDER_AS_CATEGORY`` +to ``False``. If summary isn't given, setting ``SUMMARY_MAX_LENGTH`` determines +how many words from the beginning of an article are used as the summary. + +You can also extract any metadata from the filename through a regexp to be set +in the ``FILENAME_METADATA`` setting. +All named groups that are matched will be set in the metadata object. The +default value for the ``FILENAME_METADATA`` setting will only extract the date +from the filename. For example, if you would like to extract both the date and +the slug, you could set something like: +``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. + +Please note that the metadata available inside your files takes precedence over +the metadata extracted from the filename. Generate your blog ------------------ From f86e1128f0b535efc8e20f1da2d1c045991051b7 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 09:48:30 +0100 Subject: [PATCH 0222/1975] docfix: fix example of FILENAME_METADATA regexp --- docs/getting_started.rst | 2 +- docs/settings.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 6be7fbb2..b0b5bf92 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -197,7 +197,7 @@ All named groups that are matched will be set in the metadata object. The default value for the ``FILENAME_METADATA`` setting will only extract the date from the filename. For example, if you would like to extract both the date and the slug, you could set something like: -``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. +``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'``. Please note that the metadata available inside your files takes precedence over the metadata extracted from the filename. diff --git a/docs/settings.rst b/docs/settings.rst index 2ce44dfb..fc019757 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -59,7 +59,7 @@ Setting name (default value) What doe the filename. For example, if you would like to extract both the date and the slug, you could set something like: - ``'(?P\d{4}-\d{2}-\d{2})_(?.*)'``. + ``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'``. `DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before generating new files. `FILES_TO_COPY` (``()``) A list of files (or directories) to copy from the source (inside the From 6236e8f66ba262731563599ecfdc5be0a2d7addf Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 3 Dec 2012 12:59:31 -0800 Subject: [PATCH 0223/1975] Updated changelog to include recent changes --- docs/changelog.rst | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index ab3a4233..a68ed53d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,28 +5,31 @@ Release history ================ * Improve handling of links to intra-site resources -* Ensure WordPress import adds paragraphs in for all types of line endings - in post content. +* Ensure WordPress import adds paragraphs for all types of line endings + in post content * Decode HTML entities within WordPress post titles on import -* Improved appearance of LinkedIn icon in default theme +* Improve appearance of LinkedIn icon in default theme * Add GitHub and Google+ social icons support in default theme * Optimize social icons * Add ``FEED_ALL_ATOM`` and ``FEED_ALL_RSS`` to generate feeds containing all posts regardless of their language * Split ``TRANSLATION_FEED`` into ``TRANSLATION_FEED_ATOM`` and ``TRANSLATION_FEED_RSS`` -* The different feeds can now be enabled/disabled individually +* Different feeds can now be enabled/disabled individually * Allow for blank author: if ``AUTHOR`` setting is not set, author won't - default to ``${USER}`` anymore and a post won't contain any author - information if the post author is empty. -* LESS and Webassets support removed from Pelican core in favor of a Webassets - plugin. -* The ``DEFAULT_DATE`` setting now defaults to None, which means that articles - won't be generated anymore unless a date metadata is specified. -* Add the gzip_cache plugin which compresses common text files into a ``.gz`` - file within the same directory as the original file to prevent the server - (e.g. Nginx) from compressing files during an HTTP call. -* Add AsciiDoc support -* Add ``FILENAME_METADATA`` new setting which adds support for metadata - extraction from the filename. + default to ``${USER}`` anymore, and a post won't contain any author + information if the post author is empty +* Move LESS and Webassets support from Pelican core to plugin +* The ``DEFAULT_DATE`` setting now defaults to ``None``, which means that + articles won't be generated unless date metadata is specified +* Add ``FILENAME_METADATA`` setting to support metadata extraction from filename +* Add ``gzip_cache`` plugin to compress common text files into a ``.gz`` + file within the same directory as the original file, preventing the server + (e.g. Nginx) from having to compress files during an HTTP call +* Add support for AsciiDoc-formatted content +* Add ``USE_FOLDER_AS_CATEGORY`` setting so that feature can be toggled on/off +* Support arbitrary Jinja template files +* Restore basic functional tests +* New signals: ``generator_init``, ``get_generators``, and + ``article_generate_preread`` 3.0 (2012-08-08) ================== From 8bb86d3e5d5e7fa6b95e6143c35a37c559c460f8 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Mon, 3 Dec 2012 22:35:08 +0100 Subject: [PATCH 0224/1975] revert #523 we don't need a new MARKDOWN_EXTENSIONS setting because the equivalent setting MD_EXTENSIONS already exists. --- docs/fr/configuration.rst | 3 --- docs/settings.rst | 2 -- pelican/readers.py | 7 +------ pelican/settings.py | 1 - tests/test_readers.py | 6 +++--- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index e3fb8542..5388dae3 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -163,6 +163,3 @@ SITEURL : STATIC_PATHS : Les chemins statiques que vous voulez avoir accès sur le chemin de sortie "statique" ; - -MARKDOWN_EXTENSIONS : - Liste des extentions Markdown que vous souhaitez utiliser ; diff --git a/docs/settings.rst b/docs/settings.rst index fc019757..f629a4d6 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -129,8 +129,6 @@ Setting name (default value) What doe Can be used to separate templates from the theme. Example: projects, resume, profile ... This templates need to use ``DIRECT_TEMPLATES`` setting - -`MARKDOWN_EXTENSIONS` (``['toc',]``) A list of any Markdown extensions you want to use. `ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to asciidoc, see the `manpage `_ ===================================================================== ===================================================================== diff --git a/pelican/readers.py b/pelican/readers.py index 74cec02f..4dc041ae 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -136,13 +136,8 @@ class MarkdownReader(Reader): def read(self, filename): """Parse content and metadata of markdown files""" - markdown_extensions = self.settings.get('MARKDOWN_EXTENSIONS', []) - if isinstance(markdown_extensions, (str, unicode)): - markdown_extensions = [m.strip() for m in - markdown_extensions.split(',')] text = pelican_open(filename) - md = Markdown(extensions=set( - self.extensions + markdown_extensions + ['meta'])) + md = Markdown(extensions=set(self.extensions + ['meta'])) content = md.convert(text) metadata = {} diff --git a/pelican/settings.py b/pelican/settings.py index a98f3538..692fc983 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -78,7 +78,6 @@ _DEFAULT_CONFIG = {'PATH': '.', 'TYPOGRIFY': False, 'SUMMARY_MAX_LENGTH': 50, 'PLUGINS': [], - 'MARKDOWN_EXTENSIONS': ['toc', ], 'TEMPLATE_PAGES': {} } diff --git a/tests/test_readers.py b/tests/test_readers.py index dcfee809..937a98e3 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -145,9 +145,9 @@ class MdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.Markdown, "markdown isn't installed") def test_article_with_markdown_markup_extension(self): # test to ensure the markdown markup extension is being processed as expected - reader = readers.MarkdownReader({}) - reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc', ])) - content, metadata = reader.read(_filename('article_with_markdown_markup_extensions.md')) + content, metadata = readers.read_file( + _filename('article_with_markdown_markup_extensions.md'), + settings={'MD_EXTENSIONS': ['toc', 'codehilite', 'extra']}) expected = '
      \n'\ '
        \n'\ '
      • Level1
          \n'\ From f604cc4df88e0c3e1e1ddb91aa1df2b0b6f21af5 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Mon, 3 Dec 2012 22:56:05 +0100 Subject: [PATCH 0225/1975] update functional tests to test TEMPLATE_PAGES feature closes #614: cannot reproduce this issue. --- samples/content/pages/jinja2_template.html | 6 ++ samples/pelican.conf.py | 3 + tests/output/custom/jinja2_template.html | 82 ++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 samples/content/pages/jinja2_template.html create mode 100644 tests/output/custom/jinja2_template.html diff --git a/samples/content/pages/jinja2_template.html b/samples/content/pages/jinja2_template.html new file mode 100644 index 00000000..1b0dc4e4 --- /dev/null +++ b/samples/content/pages/jinja2_template.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block content %} + +Some text + +{% endblock %} diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index ce51c0fd..0ac4cd2c 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -35,6 +35,9 @@ STATIC_PATHS = ["pictures", ] # A list of files to copy from the source to the destination FILES_TO_COPY = (('extra/robots.txt', 'robots.txt'),) +# custom page generated with a jinja2 template +TEMPLATE_PAGES = {'pages/jinja2_template.html': 'jinja2_template.html'} + # foobar will not be used, because it's not in caps. All configuration keys # have to be in caps foobar = "barbaz" diff --git a/tests/output/custom/jinja2_template.html b/tests/output/custom/jinja2_template.html new file mode 100644 index 00000000..2def2d4e --- /dev/null +++ b/tests/output/custom/jinja2_template.html @@ -0,0 +1,82 @@ + + + + Alexis' log + + + + + + + + + + + + + + + +Fork me on GitHub + + + +Some text + +
          +
          +

          blogroll

          + +
          + +
          + + + + + + \ No newline at end of file From 21e808782268cdfafe4f05a3d10152b86778d4eb Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 4 Dec 2012 00:48:29 +0100 Subject: [PATCH 0226/1975] fix weird implementation for extension removal this leads to raising exception when slug was not used to generate the url --- pelican/contents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/contents.py b/pelican/contents.py index 522892ba..d675a2ad 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -277,7 +277,7 @@ class URLWrapper(object): return value else: if get_page_name: - return unicode(value[:value.find('{slug}') + len('{slug}')]).format(**self.as_dict()) + return unicode(os.path.splitext(value)[0]).format(**self.as_dict()) else: return unicode(value).format(**self.as_dict()) From 89fd11d5829de860f78a836ff57e9104093115f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:21:57 +0100 Subject: [PATCH 0227/1975] tagging 3.1 --- docs/changelog.rst | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a68ed53d..7c0675f9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,7 +1,7 @@ Release history ############### -3.1 (XXXX-XX-XX) +3.1 (2012-12-04) ================ * Improve handling of links to intra-site resources @@ -32,7 +32,7 @@ Release history ``article_generate_preread`` 3.0 (2012-08-08) -================== +================ * Refactored the way URLs are handled * Improved the English documentation diff --git a/setup.py b/setup.py index 97c8ca64..26121423 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( version="3.1", url='http://getpelican.com/', author='Alexis Metaireau', - author_email='alexis@notmyidea.org', + author_email='authors@getpelican.com', description="A tool to generate a static blog from reStructuredText or "\ "Markdown input files.", long_description=open('README.rst').read(), From be2a3f4030e9f5f1f4b2f6d657c9f18347d6af9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:27:16 +0100 Subject: [PATCH 0228/1975] bump version number --- docs/changelog.rst | 5 +++++ pelican/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7c0675f9..05454e17 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Release history ############### +3.2 (XXXX-XX-XX) +================ + +* ??? + 3.1 (2012-12-04) ================ diff --git a/pelican/__init__.py b/pelican/__init__.py index a175e2a8..6a7ee708 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -17,7 +17,7 @@ from pelican.utils import (clean_output_dir, files_changed, file_changed, from pelican.writers import Writer __major__ = 3 -__minor__ = 0 +__minor__ = 2 __version__ = "{0}.{1}".format(__major__, __minor__) diff --git a/setup.py b/setup.py index 26121423..326a3195 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ entry_points = { setup( name="pelican", - version="3.1", + version="3.2", url='http://getpelican.com/', author='Alexis Metaireau', author_email='authors@getpelican.com', From a07b56c02bfa5ddac8de359e215d9571ee2ba96c Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 3 Dec 2012 16:31:55 -0800 Subject: [PATCH 0229/1975] Doc fixes and improvements --- docs/faq.rst | 36 ++++++++-------- docs/getting_started.rst | 50 ++++++++++++----------- docs/index.rst | 2 +- docs/plugins.rst | 88 ++++++++++++++++++++-------------------- docs/settings.rst | 75 ++++++++++++++++------------------ 5 files changed, 127 insertions(+), 124 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 735fe9d0..a8617b30 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -1,7 +1,7 @@ Frequently Asked Questions (FAQ) ################################ -Here is a summary of the frequently asked questions for Pelican. +Here are some frequently asked questions about Pelican. What's the best way to communicate a problem, question, or suggestion? ====================================================================== @@ -21,7 +21,8 @@ How can I help? ================ There are several ways to help out. First, you can use Pelican and report any -suggestions or problems you might have via IRC or the `issue tracker `_. +suggestions or problems you might have via IRC or the `issue tracker +`_. If you want to contribute, please fork `the git repository `_, create a new feature branch, make @@ -57,13 +58,14 @@ I want to use Markdown, but I got an error. =========================================== Markdown is not a hard dependency for Pelican, so you will need to explicitly -install it. You can do so by typing:: +install it. You can do so by typing the following, including ``sudo`` if +required:: - $ (sudo) pip install markdown + (sudo) pip install markdown -In case you don't have pip installed, consider installing it via:: +If you don't have pip installed, consider installing the pip installer via:: - $ (sudo) easy_install pip + (sudo) easy_install pip Can I use arbitrary meta-data in my templates? ============================================== @@ -87,15 +89,15 @@ want to have its own template. :template: template_name -Then just make sure to have the template installed in to your theme as -``template_name.html``. +Then just make sure your theme contains the relevant template file (e.g. +``template_name.html``). What if I want to disable feed generation? ========================================== To disable all feed generation, all feed settings should be set to ``None``. -Since other feed settings already defaults to ``None``, you only need to set -the following settings:: +All but two feed settings already default to ``None``, so if you want to disable +all feed generation, you only need to specify the following settings:: FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None @@ -129,13 +131,13 @@ setting names). Here is an exact list of the renamed setting names:: CATEGORY_FEED -> CATEGORY_FEED_ATOM Starting in 3.1, the new feed ``FEED_ALL_ATOM`` has been introduced: this -feed will aggregate all posts regardless of their language. It is generated to -``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to ``None``. -The following FEED setting has also been renamed:: +feed will aggregate all posts regardless of their language. This setting +generates ``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to +``None``. The following feed setting has also been renamed:: TRANSLATION_FEED -> TRANSLATION_FEED_ATOM -Older 2.x themes that referenced the old setting names may not link properly. -In order to rectify this, please update your theme for compatibility with 3.0+ -by changing the relevant values in your template files. For an example of -complete feed headers and usage please check out the ``simple`` theme. +Older themes that referenced the old setting names may not link properly. +In order to rectify this, please update your theme for compatibility by changing +the relevant values in your template files. For an example of complete feed +headers and usage please check out the ``simple`` theme. diff --git a/docs/getting_started.rst b/docs/getting_started.rst index b0b5bf92..3e527611 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -161,7 +161,7 @@ following syntax (give your file the ``.rst`` extension):: :author: Alexis Metaireau :summary: Short version for index and feeds -Pelican implements an extension of reStructuredText to enable support for the +Pelican implements an extension to reStructuredText to enable support for the ``abbr`` HTML tag. To use it, write something like this in your post:: This will be turned into :abbr:`HTML (HyperText Markup Language)`. @@ -188,16 +188,17 @@ directory in which the file resides. For example, a file located at ``python/foobar/myfoobar.rst`` will have a category of ``foobar``. If you would like to organize your files in other ways where the name of the subfolder would not be a good category name, you can set the setting ``USE_FOLDER_AS_CATEGORY`` -to ``False``. If summary isn't given, setting ``SUMMARY_MAX_LENGTH`` determines -how many words from the beginning of an article are used as the summary. +to ``False``. If there is no summary metadata for a given post, the +``SUMMARY_MAX_LENGTH`` setting can be used to specify how many words from the +beginning of an article are used as the summary. -You can also extract any metadata from the filename through a regexp to be set -in the ``FILENAME_METADATA`` setting. +You can also extract any metadata from the filename through a regular +expression to be set in the ``FILENAME_METADATA`` setting. All named groups that are matched will be set in the metadata object. The default value for the ``FILENAME_METADATA`` setting will only extract the date from the filename. For example, if you would like to extract both the date and the slug, you could set something like: -``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'``. +``'(?P\d{4}-\d{2}-\d{2})_(?P.*)'`` Please note that the metadata available inside your files takes precedence over the metadata extracted from the filename. @@ -205,7 +206,7 @@ the metadata extracted from the filename. Generate your blog ------------------ -The ``make`` shortcut commands mentioned in the ``Kickstart a blog`` section +The ``make`` shortcut commands mentioned in the *Kickstart a blog* section are mostly wrappers around the ``pelican`` command that generates the HTML from the content. The ``pelican`` command can also be run directly:: @@ -231,11 +232,11 @@ run the ``pelican`` command with the ``-r`` or ``--autoreload`` option. Pages ----- -If you create a folder named ``pages``, itself in the content folder, all the +If you create a folder named ``pages`` inside the content folder, all the files in it will be used to generate static pages. -Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to -the menu. +Then, use the ``DISPLAY_PAGES_ON_MENU`` setting to add all those pages to +the primary navigation menu. If you want to exclude any pages from being linked to or listed in the menu then add a ``status: hidden`` attribute to its metadata. This is useful for @@ -244,9 +245,13 @@ things like making error pages that fit the generated theme of your site. Linking to internal content --------------------------- -Since Pelican 3.1, you now have the ability to do cross-site linking. +From Pelican 3.1 onwards, it is now possible to specify intra-site links to +files in the *source content* hierarchy instead of files in the *generated* +hierarchy. This makes it easier to link from the current post to other posts +and images that may be sitting alongside the current post (instead of having +to determine where those resources will be placed after site generation). -To link to an internal content, you will have to use the following syntax: +To link to internal content, use the following syntax: ``|filename|path/to/file``. For example, you may want to add links between "article1" and "article2" given @@ -264,20 +269,20 @@ In this example, ``article1.rst`` could look like:: Title: The first article Date: 2012-12-01 - See below cross-site links examples in restructured text. + See below intra-site link examples in reStructuredText format. - `a root-relative link <|filename|/cat/article2.md>`_ - `a file-relative link <|filename|cat/article2.md>`_ + `a link relative to content root <|filename|/cat/article2.md>`_ + `a link relative to current file <|filename|cat/article2.md>`_ and ``article2.md``:: Title: The second article Date: 2012-12-01 - See below cross-site links examples in markdown. + See below intra-site link examples in Markdown format. - [a root-relative link](|filename|/article1.rst) - [a file-relative link](|filename|../article1.rst) + [a link relative to content root](|filename|/article1.rst) + [a link relative to current file](|filename|../article1.rst) .. note:: @@ -334,13 +339,12 @@ then instead ensure that the translated article titles are identical, since the slug will be auto-generated from the article title. Syntax highlighting ---------------------- +------------------- Pelican is able to provide colorized syntax highlighting for your code blocks. -To do so, you have to use the following conventions (you need to put this in -your content files). +To do so, you have to use the following conventions inside your content files. -For RestructuredText, use the code-block directive:: +For reStructuredText, use the code-block directive:: .. code-block:: identifier @@ -373,7 +377,7 @@ anything special to see what's happening with the generated files. You can either use your browser to open the files on your disk:: - $ firefox output/index.html + firefox output/index.html Or run a simple web server using Python:: diff --git a/docs/index.rst b/docs/index.rst index 8206727c..ebe1ace6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ Pelican Pelican is a static site generator, written in Python_. * Write your weblog entries directly with your editor of choice (vim!) - in reStructuredText_, Markdown_ or AsciiDoc_ + in reStructuredText_, Markdown_, or AsciiDoc_ * Includes a simple CLI tool to (re)generate the weblog * Easy to interface with DVCSes and web hooks * Completely static output is easy to host anywhere diff --git a/docs/plugins.rst b/docs/plugins.rst index c6b18200..6555e647 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -3,25 +3,25 @@ Plugins ####### -Since version 3.0, Pelican manages plugins. Plugins are a way to add features -to Pelican without having to directly hack Pelican code. +Beginning with version 3.0, Pelican supports plugins. Plugins are a way to add +features to Pelican without having to directly modify the Pelican core. -Pelican is shipped with a set of core plugins, but you can easily implement -your own (and this page describes how). +Pelican is shipped with a set of bundled plugins, but you can easily implement +your own. This page describes how to use and create plugins. How to use plugins ================== -To load plugins, you have to specify them in your settings file. You have two -ways to do so. -Either by specifying strings with the path to the callables:: +To load plugins, you have to specify them in your settings file. There are two +ways to do so. The first method is to specify strings with the path to the +callables:: PLUGINS = ['pelican.plugins.gravatar',] -Or by importing them and adding them to the list:: +Alternatively, another method is to import them and add them to the list:: from pelican.plugins import gravatar - PLUGINS = [gravatar, ] + PLUGINS = [gravatar,] If your plugins are not in an importable path, you can specify a ``PLUGIN_PATH`` in the settings:: @@ -33,7 +33,7 @@ How to create plugins ===================== Plugins are based on the concept of signals. Pelican sends signals, and plugins -subscribe to those signals. The list of signals are defined in a following +subscribe to those signals. The list of signals are defined in a subsequent section. The only rule to follow for plugins is to define a ``register`` callable, in @@ -75,13 +75,13 @@ pages_generate_context pages_generator, metadata pages_generator_init pages_generator invoked in the PagesGenerator.__init__ ============================= ============================ =========================================================================== -The list is currently small, don't hesitate to add signals and make a pull +The list is currently small, so don't hesitate to add signals and make a pull request if you need them! .. note:: - The signal ``content_object_init`` can send different type of object as - argument. If you want to register only one type of object then you will + The signal ``content_object_init`` can send a different type of object as + the argument. If you want to register only one type of object then you will need to specify the sender when you are connecting to the signal. :: @@ -122,30 +122,30 @@ Plugin descriptions Asset management ---------------- -This plugin allows you to use the `webassets`_ module to manage assets such as +This plugin allows you to use the `Webassets`_ module to manage assets such as CSS and JS files. The module must first be installed:: pip install webassets -The `webassets` module allows you to perform a number of useful asset management +The Webassets module allows you to perform a number of useful asset management functions, including: -* CSS minifier (`cssmin`, `yuicompressor`, ...) -* CSS compiler (`less`, `sass`, ...) -* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...) +* CSS minifier (``cssmin``, ``yuicompressor``, ...) +* CSS compiler (``less``, ``sass``, ...) +* JS minifier (``uglifyjs``, ``yuicompressor``, ``closure``, ...) Others filters include gzip compression, integration of images in CSS via data -URIs, and more. `webassets` can also append a version identifier to your asset +URIs, and more. Webassets can also append a version identifier to your asset URL to convince browsers to download new versions of your assets when you use -far-future expires headers. Please refer to the `webassets documentation`_ for +far-future expires headers. Please refer to the `Webassets documentation`_ for more information. -When using with Pelican, `webassets` is configured to process assets in the -``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by -including one or more template tags. The jinja variable ``{{ ASSET_URL }}`` to -use in the templates is configured to be relative to the ``theme/`` url. -Hence, it must be used with the ``{{ SITEURL }}`` variable which allows to -have relative urls. For example... +When used with Pelican, Webassets is configured to process assets in the +``OUTPUT_PATH/theme`` directory. You can use Webassets in your templates by +including one or more template tags. The Jinja variable ``{{ ASSET_URL }}`` can +be used in templates and is relative to the ``theme/`` url. The +``{{ ASSET_URL }}`` variable should be used in conjunction with the +``{{ SITEURL }}`` variable in order to generate URLs properly. For example: .. code-block:: jinja @@ -153,7 +153,7 @@ have relative urls. For example... {% endassets %} -... will produce a minified css file with a version identifier: +... will produce a minified css file with a version identifier that looks like: .. code-block:: html @@ -182,29 +182,29 @@ The above will produce a minified and gzipped JS file: -Pelican's debug mode is propagated to `webassets` to disable asset packaging +Pelican's debug mode is propagated to Webassets to disable asset packaging and instead work with the uncompressed assets. However, this also means that the LESS and SASS files are not compiled. This should be fixed in a future -version of `webassets` (cf. the related `bug report +version of Webassets (cf. the related `bug report `_). -.. _webassets: https://github.com/miracle2k/webassets -.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html +.. _Webassets: https://github.com/miracle2k/webassets +.. _Webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html GitHub activity --------------- -This plugin makes use of the ``feedparser`` library that you'll need to +This plugin makes use of the `feedparser`_ library that you'll need to install. Set the ``GITHUB_ACTIVITY_FEED`` parameter to your GitHub activity feed. -For example, my setting would look like:: +For example, to track Pelican project activity, the setting would be:: - GITHUB_ACTIVITY_FEED = 'https://github.com/kpanic.atom' + GITHUB_ACTIVITY_FEED = 'https://github.com/getpelican.atom' -On the templates side, you just have to iterate over the ``github_activity`` -variable, as in the example:: +On the template side, you just have to iterate over the ``github_activity`` +variable, as in this example:: {% if GITHUB_ACTIVITY_FEED %} {% endif %} - - -``github_activity`` is a list of lists. The first element is the title +``github_activity`` is a list of lists. The first element is the title, and the second element is the raw HTML from GitHub. +.. _feedparser: https://crate.io/packages/feedparser/ + Global license -------------- -This plugin allows you to define a LICENSE setting and adds the contents of that +This plugin allows you to define a ``LICENSE`` setting and adds the contents of that license variable to the article's context, making that variable available to use from within your theme's templates. @@ -235,7 +235,7 @@ Gravatar This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and makes the variable available within the article's context. You can add -AUTHOR_EMAIL to your settings file to define the default author's email +``AUTHOR_EMAIL`` to your settings file to define the default author's email address. Obviously, that email address must be associated with a Gravatar account. @@ -249,7 +249,7 @@ the ``author_gravatar`` variable is added to the article's context. Gzip cache ---------- -Certain web servers (e.g., Nginx) can use a static cache of gzip compressed +Certain web servers (e.g., Nginx) can use a static cache of gzip-compressed files to prevent the server from compressing files during an HTTP call. Since compression occurs at another time, these compressed files can be compressed at a higher compression level for increased optimization. @@ -303,7 +303,7 @@ The sitemap plugin generates plain-text or XML sitemaps. You can use the ``SITEMAP`` variable in your settings file to configure the behavior of the plugin. -The ``SITEMAP`` variable must be a Python dictionary, it can contain three keys: +The ``SITEMAP`` variable must be a Python dictionary and can contain three keys: - ``format``, which sets the output format of the plugin (``xml`` or ``txt``) @@ -336,7 +336,7 @@ default value. The sitemap is saved in ``/sitemap.``. .. note:: - ``priorities`` and ``changefreqs`` are informations for search engines. + ``priorities`` and ``changefreqs`` are information for search engines. They are only used in the XML sitemaps. For more information: diff --git a/docs/settings.rst b/docs/settings.rst index f629a4d6..baf9f60c 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -16,8 +16,8 @@ False, None, etc.), dictionaries, or tuples should *not* be enclosed in quotation marks. All other values (i.e., strings) *must* be enclosed in quotation marks. -Unless otherwise specified, settings that refer to paths can be either absolute or relative to the -configuration file. +Unless otherwise specified, settings that refer to paths can be either absolute +or relative to the configuration file. The settings you define in the configuration file will be passed to the templates, which allows you to use your settings to add site-wide content. @@ -31,12 +31,11 @@ Basic settings Setting name (default value) What does it do? ===================================================================== ===================================================================== `AUTHOR` Default author (put your name) -`DATE_FORMATS` (``{}``) If you do manage multiple languages, you can - set the date formatting here. See "Date format and locales" - section below for details. -`USE_FOLDER_AS_CATEGORY` (``True``) When you don't specify a category in your post metadata and set this - setting to ``True`` and organize your articles in subfolders, the - subfolder will become the category of your post. If set to ``False`` +`DATE_FORMATS` (``{}``) If you manage multiple languages, you can set the date formatting + here. See the "Date format and locales" section below for details. +`USE_FOLDER_AS_CATEGORY` (``True``) When you don't specify a category in your post metadata, set this + setting to ``True``, and organize your articles in subfolders, the + subfolder will become the category of your post. If set to ``False``, ``DEFAULT_CATEGORY`` will be used as a fallback. `DEFAULT_CATEGORY` (``'misc'``) The default category to fall back on. `DEFAULT_DATE_FORMAT` (``'%a %d %B %Y'``) The default date format you want to use. @@ -44,12 +43,12 @@ Setting name (default value) What doe template. Templates may or not honor this setting. `DEFAULT_DATE` (``None``) The default date you want to use. - If 'fs', Pelican will use the file system + If ``fs``, Pelican will use the file system timestamp information (mtime) if it can't get date information from the metadata. - If tuple object, it will instead generate the - default datetime object by passing the tuple to - the datetime.datetime constructor. + If set to a tuple object, the default datetime object will instead + be generated by passing the tuple to the + ``datetime.datetime`` constructor. `DEFAULT_METADATA` (``()``) The default metadata you want to use for all articles and pages. `FILENAME_METADATA` (``'(?P\d{4}-\d{2}-\d{2}).*'``) The regexp that will be used to extract any metadata @@ -83,11 +82,10 @@ Setting name (default value) What doe `PAGE_EXCLUDES` (``()``) A list of directories to exclude when looking for pages. `ARTICLE_DIR` (``''``) Directory to look at for articles, relative to `PATH`. `ARTICLE_EXCLUDES`: (``('pages',)``) A list of directories to exclude when looking for articles. -`PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions - of your documents. You will need to install - `rst2pdf`. +`PDF_GENERATOR` (``False``) Set to ``True`` if you want PDF versions of your documents to be. + generated. You will need to install ``rst2pdf``. `OUTPUT_SOURCES` (``False``) Set to True if you want to copy the articles and pages in their - original format (e.g. Markdown or ReStructeredText) to the + original format (e.g. Markdown or reStructuredText) to the specified OUTPUT_PATH. `OUTPUT_SOURCES_EXTENSION` (``.text``) Controls the extension that will be used by the SourcesGenerator. Defaults to ``.text``. If not a valid string the default value @@ -106,10 +104,10 @@ Setting name (default value) What doe the blog entries. See :ref:`template_pages`. `STATIC_PATHS` (``['images']``) The static paths you want to have accessible on the output path "static". By default, - Pelican will copy the 'images' folder to the + Pelican will copy the "images" folder to the output folder. `TIMEZONE` The timezone used in the date information, to - generate Atom and RSS feeds. See the "timezone" + generate Atom and RSS feeds. See the *Timezone* section below for more info. `TYPOGRIFY` (``False``) If set to True, several typographical improvements will be incorporated into the generated HTML via the `Typogrify @@ -117,19 +115,19 @@ Setting name (default value) What doe library, which can be installed via: ``pip install typogrify`` `DIRECT_TEMPLATES` (``('index', 'tags', 'categories', 'archives')``) List of templates that are used directly to render content. Typically direct templates are used to generate - index pages for collections of content e.g. tags and - category index pages. + index pages for collections of content (e.g. tags and + category index pages). `PAGINATED_DIRECT_TEMPLATES` (``('index',)``) Provides the direct templates that should be paginated. `SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will be the default length in words of the text created. This only applies if your content does not otherwise - specify a summary. Setting to None will cause the summary + specify a summary. Setting to ``None`` will cause the summary to be a copy of the original content. -`EXTRA_TEMPLATES_PATHS` (``[]``) A list of paths you want Jinja2 to look for the templates. +`EXTRA_TEMPLATES_PATHS` (``[]``) A list of paths you want Jinja2 to search for templates. Can be used to separate templates from the theme. Example: projects, resume, profile ... - This templates need to use ``DIRECT_TEMPLATES`` setting -`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to asciidoc, see the `manpage + These templates need to use ``DIRECT_TEMPLATES`` setting. +`ASCIIDOC_OPTIONS` (``[]``) A list of options to pass to AsciiDoc. See the `manpage `_ ===================================================================== ===================================================================== @@ -145,13 +143,13 @@ when testing locally, and absolute URLs are reliable and most useful when publishing. One method of supporting both is to have one Pelican configuration file for local development and another for publishing. To see an example of this type of setup, use the ``pelican-quickstart`` script as described at the top of -the :doc:`Getting Started` page, which will produce two separate +the :doc:`Getting Started ` page, which will produce two separate configuration files for local development and publishing, respectively. You can customize the URLs and locations where files will be saved. The URLs and SAVE_AS variables use Python's format strings. These variables allow you to place -your articles in a location such as '{slug}/index.html' and link to them as -'{slug}' for clean URLs. These settings give you the flexibility to place your +your articles in a location such as ``{slug}/index.html`` and link to them as +``{slug}`` for clean URLs. These settings give you the flexibility to place your articles and pages anywhere you want. .. note:: @@ -175,8 +173,8 @@ Example usage: * ARTICLE_URL = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'`` * ARTICLE_SAVE_AS = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'`` -This would save your articles in something like '/posts/2011/Aug/07/sample-post/index.html', -and the URL to this would be '/posts/2011/Aug/07/sample-post/'. +This would save your articles in something like ``/posts/2011/Aug/07/sample-post/index.html``, +and the URL to this would be ``/posts/2011/Aug/07/sample-post/``. ==================================================== ===================================================== Setting name (default value) What does it do? @@ -206,7 +204,7 @@ Setting name (default value) What does it do? .. note:: - When any of `*_SAVE_AS` is set to False, files will not be created. + When any of the `*_SAVE_AS` settings is set to False, files will not be created. Timezone -------- @@ -283,12 +281,12 @@ If you want to generate custom pages besides your blog entries, you can point any Jinja2 template file with a path pointing to the file and the destination path for the generated file. -For instance, if you have a blog with three static pages, for a list of books, -your resume and a contact page, you could have:: +For instance, if you have a blog with three static pages — a list of books, +your resume, and a contact page — you could have:: TEMPLATE_PAGES = {'src/books.html': 'dest/books.html', - 'src/resume.html': 'dest/resume.html', - 'src/contact.html': 'dest/contact.html'} + 'src/resume.html': 'dest/resume.html', + 'src/contact.html': 'dest/contact.html'} Feed settings ============= @@ -326,8 +324,7 @@ Setting name (default value) What does it do? quantity is unrestricted by default. ================================================ ===================================================== -If you don't want to generate some or any of these feeds, set ``None`` to the -variables above. +If you don't want to generate some or any of these feeds, set the above variables to ``None``. .. [2] %s is the name of the category. @@ -399,7 +396,7 @@ N matches `TAG_CLOUD_STEPS` -1). Translations ============ -Pelican offers a way to translate articles. See the Getting Started section for +Pelican offers a way to translate articles. See the :doc:`Getting Started ` section for more information. ===================================================== ===================================================== @@ -467,7 +464,7 @@ Following are example ways to specify your preferred theme:: # Specify a customized theme, via absolute path THEME = "~/projects/mysite/themes/mycustomtheme" -The built-in `notmyidea` theme can make good use of the following settings. Feel +The built-in ``notmyidea`` theme can make good use of the following settings. Feel free to use them in your themes as well. ======================= ======================================================= @@ -496,7 +493,7 @@ Setting name What does it do ? if you want this button to appear. ======================= ======================================================= -In addition, you can use the "wide" version of the `notmyidea` theme by +In addition, you can use the "wide" version of the ``notmyidea`` theme by adding the following to your configuration:: CSS_FILE = "wide.css" From f92c0cb69dad13491f93872af79d3a14ec6a1e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:43:19 +0100 Subject: [PATCH 0230/1975] update the version scheme to support micro versions --- pelican/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 6a7ee708..e2ea7f76 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -18,7 +18,8 @@ from pelican.writers import Writer __major__ = 3 __minor__ = 2 -__version__ = "{0}.{1}".format(__major__, __minor__) +__micro__ = 0 +__version__ = "{0}.{1}.{2}".format(__major__, __minor__, __micro__) logger = logging.getLogger(__name__) From 625afa0621866d1bbc29ade89551b096d4362838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 4 Dec 2012 01:53:52 +0100 Subject: [PATCH 0231/1975] add the changelog to the text on PyPI --- MANIFEST.in | 2 +- setup.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index bec6d1a3..2f2ea824 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include *.rst global-include *.py recursive-include pelican *.html *.css *png *.in -include LICENSE THANKS +include LICENSE THANKS docs/changelog.rst recursive-include tests * recursive-exclude tests *.pyc diff --git a/setup.py b/setup.py index 326a3195..15ddebd6 100755 --- a/setup.py +++ b/setup.py @@ -18,15 +18,20 @@ entry_points = { ] } + +README = open('README.rst').read() +CHANGELOG = open('docs/changelog.rst').read() + + setup( name="pelican", version="3.2", url='http://getpelican.com/', author='Alexis Metaireau', author_email='authors@getpelican.com', - description="A tool to generate a static blog from reStructuredText or "\ + description="A tool to generate a static blog from reStructuredText or " "Markdown input files.", - long_description=open('README.rst').read(), + long_description=README + '\n' + CHANGELOG, packages=['pelican', 'pelican.tools', 'pelican.plugins'], include_package_data=True, install_requires=requires, From 9f66333d7726513138b9d839b853ba54e8fc308b Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Tue, 4 Dec 2012 02:08:13 +0100 Subject: [PATCH 0232/1975] fix rst issue --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 05454e17..ea476ca8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,7 @@ Release history 3.2 (XXXX-XX-XX) ================ -* ??? +* [...] 3.1 (2012-12-04) ================ From 694f318614ef6f8ccccf273ecf9ff5cb33ac99c3 Mon Sep 17 00:00:00 2001 From: Roman Skvazh Date: Thu, 6 Dec 2012 21:15:25 +0400 Subject: [PATCH 0233/1975] Update docs/plugins.rst Change yuicompressor to yui_js and yui_css --- docs/plugins.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 6555e647..d9964287 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -130,9 +130,9 @@ CSS and JS files. The module must first be installed:: The Webassets module allows you to perform a number of useful asset management functions, including: -* CSS minifier (``cssmin``, ``yuicompressor``, ...) +* CSS minifier (``cssmin``, ``yui_css``, ...) * CSS compiler (``less``, ``sass``, ...) -* JS minifier (``uglifyjs``, ``yuicompressor``, ``closure``, ...) +* JS minifier (``uglifyjs``, ``yui_js``, ``closure``, ...) Others filters include gzip compression, integration of images in CSS via data URIs, and more. Webassets can also append a version identifier to your asset From a5772bf3d6e0563b109dc1f2cb19743cf6a19aef Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 7 Dec 2012 00:10:30 +0100 Subject: [PATCH 0234/1975] allow override page url and save_as values directly from the metadata this is similar to the template override implemented in #404 --- pelican/contents.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pelican/contents.py b/pelican/contents.py index d675a2ad..77ee70f8 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -44,6 +44,8 @@ class Page(object): # set metadata as attributes for key, value in local_metadata.items(): + if key in ('save_as', 'url'): + key = 'override_' + key setattr(self, key.lower(), value) # also keep track of the metadata attributes available @@ -128,6 +130,8 @@ class Page(object): return self.settings[fq_key].format(**self.url_format) def get_url_setting(self, key): + if hasattr(self, 'override_' + key): + return getattr(self, 'override_' + key) key = key if self.in_default_lang else 'lang_%s' % key return self._expand_settings(key) From 00c7451200fd75056ebecb7cd681bda08b55d70a Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 7 Dec 2012 00:14:00 +0100 Subject: [PATCH 0235/1975] add functional test for save_as/url override and update functional tests output --- samples/content/pages/override_url_saveas.rst | 9 ++ .../basic/a-markdown-powered-article.html | 3 +- tests/output/basic/archives.html | 3 +- tests/output/basic/article-1.html | 3 +- tests/output/basic/article-2.html | 3 +- tests/output/basic/article-3.html | 3 +- .../output/basic/author/alexis-metaireau.html | 3 +- tests/output/basic/categories.html | 3 +- tests/output/basic/category/bar.html | 3 +- tests/output/basic/category/cat1.html | 3 +- tests/output/basic/category/misc.html | 3 +- tests/output/basic/category/yeah.html | 3 +- .../basic/filename_metadata-example.html | 3 +- tests/output/basic/index.html | 3 +- tests/output/basic/oh-yeah.html | 3 +- tests/output/basic/override/index.html | 53 +++++++++++ .../pages/this-is-a-test-hidden-page.html | 3 +- .../basic/pages/this-is-a-test-page.html | 3 +- tests/output/basic/second-article-fr.html | 3 +- tests/output/basic/second-article.html | 3 +- tests/output/basic/tag/bar.html | 3 +- tests/output/basic/tag/baz.html | 3 +- tests/output/basic/tag/foo.html | 3 +- tests/output/basic/tag/foobar.html | 3 +- tests/output/basic/tag/oh.html | 3 +- tests/output/basic/tag/yeah.html | 3 +- .../output/basic/this-is-a-super-article.html | 3 +- tests/output/basic/unbelievable.html | 3 +- .../custom/a-markdown-powered-article.html | 3 +- tests/output/custom/archives.html | 3 +- tests/output/custom/article-1.html | 3 +- tests/output/custom/article-2.html | 3 +- tests/output/custom/article-3.html | 3 +- .../custom/author/alexis-metaireau.html | 3 +- .../custom/author/alexis-metaireau2.html | 3 +- .../custom/author/alexis-metaireau3.html | 3 +- tests/output/custom/categories.html | 3 +- tests/output/custom/category/bar.html | 3 +- tests/output/custom/category/cat1.html | 3 +- tests/output/custom/category/misc.html | 3 +- tests/output/custom/category/yeah.html | 3 +- .../output/custom/drafts/a-draft-article.html | 3 +- .../custom/filename_metadata-example.html | 3 +- tests/output/custom/index.html | 3 +- tests/output/custom/index2.html | 3 +- tests/output/custom/index3.html | 3 +- tests/output/custom/jinja2_template.html | 3 +- tests/output/custom/oh-yeah-fr.html | 3 +- tests/output/custom/oh-yeah.html | 3 +- tests/output/custom/override/index.html | 88 +++++++++++++++++++ .../pages/this-is-a-test-hidden-page.html | 3 +- .../custom/pages/this-is-a-test-page.html | 3 +- tests/output/custom/second-article-fr.html | 3 +- tests/output/custom/second-article.html | 3 +- tests/output/custom/tag/bar.html | 3 +- tests/output/custom/tag/baz.html | 3 +- tests/output/custom/tag/foo.html | 3 +- tests/output/custom/tag/foobar.html | 3 +- tests/output/custom/tag/oh.html | 3 +- tests/output/custom/tag/yeah.html | 3 +- .../custom/this-is-a-super-article.html | 3 +- tests/output/custom/unbelievable.html | 3 +- 62 files changed, 268 insertions(+), 59 deletions(-) create mode 100644 samples/content/pages/override_url_saveas.rst create mode 100644 tests/output/basic/override/index.html create mode 100644 tests/output/custom/override/index.html diff --git a/samples/content/pages/override_url_saveas.rst b/samples/content/pages/override_url_saveas.rst new file mode 100644 index 00000000..8a515f60 --- /dev/null +++ b/samples/content/pages/override_url_saveas.rst @@ -0,0 +1,9 @@ +Override url/save_as +#################### + +:date: 2012-12-07 +:url: override/ +:save_as: override/index.html + +Test page which overrides save_as and url so that this page will be generated +at a custom location. diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index 80a12212..9b9da171 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -22,7 +22,8 @@
      -
      + +
    diff --git a/tests/output/basic/archives.html b/tests/output/basic/archives.html index cb06dfa1..07a62bcc 100644 --- a/tests/output/basic/archives.html +++ b/tests/output/basic/archives.html @@ -54,7 +54,14 @@
    -
    + +
    diff --git a/tests/output/basic/article-1.html b/tests/output/basic/article-1.html index b372d6ca..de3717fa 100644 --- a/tests/output/basic/article-1.html +++ b/tests/output/basic/article-1.html @@ -52,7 +52,14 @@
    -
    + +
    diff --git a/tests/output/basic/article-2.html b/tests/output/basic/article-2.html index 1a18cb47..ebe9b8a7 100644 --- a/tests/output/basic/article-2.html +++ b/tests/output/basic/article-2.html @@ -52,7 +52,14 @@
    -
    + +
    diff --git a/tests/output/basic/article-3.html b/tests/output/basic/article-3.html index 6b83b062..42762c26 100644 --- a/tests/output/basic/article-3.html +++ b/tests/output/basic/article-3.html @@ -52,7 +52,14 @@
    -
    + +
    diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index e6f65a11..c6e75b8b 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -86,7 +86,14 @@ as well as inline markup.

    -
    + +
    diff --git a/tests/output/basic/categories.html b/tests/output/basic/categories.html index f945d04a..8dd4c810 100644 --- a/tests/output/basic/categories.html +++ b/tests/output/basic/categories.html @@ -36,7 +36,14 @@
  • yeah
  • -
    + +
    diff --git a/tests/output/basic/category/bar.html b/tests/output/basic/category/bar.html index 896d9222..d9fcd2a5 100644 --- a/tests/output/basic/category/bar.html +++ b/tests/output/basic/category/bar.html @@ -56,7 +56,14 @@ YEAH !

    -
    + +
    diff --git a/tests/output/basic/category/cat1.html b/tests/output/basic/category/cat1.html index b8ae397e..ad18cd9a 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -119,7 +119,14 @@
    -
    + +
    diff --git a/tests/output/basic/category/misc.html b/tests/output/basic/category/misc.html index 2d62b852..7e8307a0 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -100,7 +100,14 @@
    -
    + +
    diff --git a/tests/output/basic/category/yeah.html b/tests/output/basic/category/yeah.html index 37dfde63..7c6cb721 100644 --- a/tests/output/basic/category/yeah.html +++ b/tests/output/basic/category/yeah.html @@ -62,7 +62,14 @@
    -
    + +
    diff --git a/tests/output/basic/filename_metadata-example.html b/tests/output/basic/filename_metadata-example.html index b7ae95a7..730e9c41 100644 --- a/tests/output/basic/filename_metadata-example.html +++ b/tests/output/basic/filename_metadata-example.html @@ -52,7 +52,14 @@
    -
    + +
    diff --git a/tests/output/basic/index.html b/tests/output/basic/index.html index 488d1b08..f44ffbc9 100644 --- a/tests/output/basic/index.html +++ b/tests/output/basic/index.html @@ -245,7 +245,14 @@ YEAH !

    -
    + +
    diff --git a/tests/output/basic/oh-yeah.html b/tests/output/basic/oh-yeah.html index ab090b58..1900e76c 100644 --- a/tests/output/basic/oh-yeah.html +++ b/tests/output/basic/oh-yeah.html @@ -60,7 +60,14 @@ YEAH !

    -
    + +
    diff --git a/tests/output/basic/pages/this-is-a-test-hidden-page.html b/tests/output/basic/pages/this-is-a-test-hidden-page.html index 655ae272..3447b3a5 100644 --- a/tests/output/basic/pages/this-is-a-test-hidden-page.html +++ b/tests/output/basic/pages/this-is-a-test-hidden-page.html @@ -38,7 +38,14 @@ Anyone can see this page but it's not linked to anywhere!

    -
    + +
    diff --git a/tests/output/basic/pages/this-is-a-test-page.html b/tests/output/basic/pages/this-is-a-test-page.html index 43e2c2d4..c9192c94 100644 --- a/tests/output/basic/pages/this-is-a-test-page.html +++ b/tests/output/basic/pages/this-is-a-test-page.html @@ -38,7 +38,14 @@
    -
    + +
    diff --git a/tests/output/basic/second-article-fr.html b/tests/output/basic/second-article-fr.html index aa30292e..a5abce27 100644 --- a/tests/output/basic/second-article-fr.html +++ b/tests/output/basic/second-article-fr.html @@ -54,7 +54,14 @@
    -
    + +
    diff --git a/tests/output/basic/second-article.html b/tests/output/basic/second-article.html index 7319c87f..f6b42fec 100644 --- a/tests/output/basic/second-article.html +++ b/tests/output/basic/second-article.html @@ -54,7 +54,14 @@
    -
    + +
    diff --git a/tests/output/basic/tag/bar.html b/tests/output/basic/tag/bar.html index 06b012cb..891f5c35 100644 --- a/tests/output/basic/tag/bar.html +++ b/tests/output/basic/tag/bar.html @@ -134,7 +134,14 @@ YEAH !

    -
    + +
    diff --git a/tests/output/basic/tag/baz.html b/tests/output/basic/tag/baz.html index f6c56d4b..ce7c1c62 100644 --- a/tests/output/basic/tag/baz.html +++ b/tests/output/basic/tag/baz.html @@ -78,7 +78,14 @@
    -
    + +
    diff --git a/tests/output/basic/tag/foo.html b/tests/output/basic/tag/foo.html index 4ee92b7d..dffd1768 100644 --- a/tests/output/basic/tag/foo.html +++ b/tests/output/basic/tag/foo.html @@ -104,7 +104,14 @@ as well as inline markup.

    -
    + +
    diff --git a/tests/output/basic/tag/foobar.html b/tests/output/basic/tag/foobar.html index 11f21b6d..108353c2 100644 --- a/tests/output/basic/tag/foobar.html +++ b/tests/output/basic/tag/foobar.html @@ -62,7 +62,14 @@
    -
    + +
    diff --git a/tests/output/basic/tag/oh.html b/tests/output/basic/tag/oh.html index d88192a0..6e1a31ad 100644 --- a/tests/output/basic/tag/oh.html +++ b/tests/output/basic/tag/oh.html @@ -56,7 +56,14 @@ YEAH !

    -
    + +
    diff --git a/tests/output/basic/tag/yeah.html b/tests/output/basic/tag/yeah.html index 8533dbdc..c201b5c0 100644 --- a/tests/output/basic/tag/yeah.html +++ b/tests/output/basic/tag/yeah.html @@ -56,7 +56,14 @@ YEAH !

    -
    + +
    diff --git a/tests/output/basic/this-is-a-super-article.html b/tests/output/basic/this-is-a-super-article.html index 0188c07e..e098e2cf 100644 --- a/tests/output/basic/this-is-a-super-article.html +++ b/tests/output/basic/this-is-a-super-article.html @@ -66,7 +66,14 @@
    -
    + +
    diff --git a/tests/output/basic/unbelievable.html b/tests/output/basic/unbelievable.html index 36a1703c..a56096d9 100644 --- a/tests/output/basic/unbelievable.html +++ b/tests/output/basic/unbelievable.html @@ -54,7 +54,14 @@
    -
    + +
    From a7a71da6df64de5b1ce7f92d133a68f14d6ba8f8 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Feb 2013 15:57:25 +0100 Subject: [PATCH 0317/1975] Fix a test in the asciidoc reader, and add asciidoc to travis so that the related tests will not be skipped. --- .travis.yml | 3 ++- pelican/readers.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b292101..569ea7b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,9 @@ python: - "3.2" before_install: - sudo apt-get update -qq - - sudo apt-get install -qq ruby-sass + - sudo apt-get install -qq --no-install-recommends asciidoc ruby-sass install: + - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then ln -s /usr/share/asciidoc/asciidocapi.py ~/virtualenv/python2.7/lib/python2.7/site-packages/; fi - pip install nose mock --use-mirrors - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --use-mirrors unittest2; else pip install --use-mirrors unittest2py3k; fi - pip install . --use-mirrors diff --git a/pelican/readers.py b/pelican/readers.py index 99dc6e54..1623fb7f 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -285,7 +285,8 @@ class AsciiDocReader(Reader): def read(self, source_path): """Parse content and metadata of asciidoc files""" from cStringIO import StringIO - text = StringIO(pelican_open(source_path)) + with pelican_open(source_path) as source: + text = StringIO(source) content = StringIO() ad = AsciiDocAPI() From 824edb88238f7a7799ac1219c2994d0ac763094f Mon Sep 17 00:00:00 2001 From: Richard Duivenvoorde Date: Thu, 21 Feb 2013 12:38:51 +0100 Subject: [PATCH 0318/1975] rsync additions - adding / otherwise you will endup with output on remote - adding --cvs-exclude (to not sync cvs stuff) --- pelican/tools/templates/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index b15f48ae..c16fd7c0 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -61,7 +61,7 @@ ssh_upload: publish scp -P $$(SSH_PORT) -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR) rsync_upload: publish - rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR) $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) + rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude dropbox_upload: publish cp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR) From a13e31a76b46a37c78461ab7201098de9fa189a5 Mon Sep 17 00:00:00 2001 From: Richard Duivenvoorde Date: Thu, 21 Feb 2013 12:43:42 +0100 Subject: [PATCH 0319/1975] adding a stopsever target for make --- pelican/tools/templates/Makefile.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index c16fd7c0..35c41bb7 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -28,6 +28,7 @@ help: @echo ' make publish generate using production settings ' @echo ' make serve serve site at http://localhost:8000' @echo ' make devserver start/restart develop_server.sh ' + @echo ' make stopserver stop local server ' @echo ' ssh_upload upload the web site via SSH ' @echo ' rsync_upload upload the web site via rsync+ssh ' @echo ' dropbox_upload upload the web site via Dropbox ' @@ -54,6 +55,11 @@ serve: devserver: $$(BASEDIR)/develop_server.sh restart +stopserver: +_ kill -9 `cat pelican.pid` +_ kill -9 `cat srv.pid` +_ @echo 'Stopped Pelican and SimpleHTTPServer processes running in background. + publish: $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(PUBLISHCONF) $$(PELICANOPTS) From 60ae7aa667e5143079c59da3f2ff0beb981ca50d Mon Sep 17 00:00:00 2001 From: yegle Date: Sun, 17 Feb 2013 10:44:14 -0500 Subject: [PATCH 0320/1975] Fix: hashlib.md5 funcition only accepts bytes as input --- pelican/plugins/gravatar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pelican/plugins/gravatar.py b/pelican/plugins/gravatar.py index a4d11456..2b8520df 100644 --- a/pelican/plugins/gravatar.py +++ b/pelican/plugins/gravatar.py @@ -1,4 +1,5 @@ import hashlib +import six from pelican import signals """ @@ -33,8 +34,9 @@ def add_gravatar(generator, metadata): #then add gravatar url if 'email' in metadata.keys(): + email_bytes = six.b(metadata['email']).lower() gravatar_url = "http://www.gravatar.com/avatar/" + \ - hashlib.md5(metadata['email'].lower()).hexdigest() + hashlib.md5(email_bytes).hexdigest() metadata["author_gravatar"] = gravatar_url From 205792e9d4fb974491cf4465cda5c866414e5d25 Mon Sep 17 00:00:00 2001 From: Andrew Spiers Date: Fri, 15 Feb 2013 00:43:47 +1100 Subject: [PATCH 0321/1975] string types have no decode method in py3 --- pelican/tools/pelican_quickstart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/pelican_quickstart.py b/pelican/tools/pelican_quickstart.py index 9f25f2fe..6d4264d3 100755 --- a/pelican/tools/pelican_quickstart.py +++ b/pelican/tools/pelican_quickstart.py @@ -47,7 +47,7 @@ else: def decoding_strings(f): def wrapper(*args, **kwargs): out = f(*args, **kwargs) - if isinstance(out, six.string_types): + if isinstance(out, six.string_types) and not six.PY3: # todo: make encoding configurable? return out.decode(sys.stdin.encoding) return out From 4a63695ae2cc871bd2849bc718b7bb2dfc6bc44c Mon Sep 17 00:00:00 2001 From: nfletton Date: Sat, 9 Feb 2013 17:23:59 -0700 Subject: [PATCH 0322/1975] Fixed pagination link error when _SAVE_AS setting used. The unit test for this scenario was passing as it was testing for an incorrect 'page_name' variable being set. --- pelican/generators.py | 4 ++-- tests/test_generators.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index ede0b7b3..e3ebf994 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -259,8 +259,8 @@ class ArticlesGenerator(Generator): continue write(save_as, self.get_template(template), - self.context, blog=True, paginated=paginated, - page_name=template) + self.context, blog=True, paginated=paginated, + page_name=os.path.splitext(save_as)[0]) def generate_tags(self, write): """Generate Tags pages.""" diff --git a/tests/test_generators.py b/tests/test_generators.py index 7a6e67fb..48c7bf91 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -140,7 +140,7 @@ class TestArticlesGenerator(unittest.TestCase): generator.generate_direct_templates(write) write.assert_called_with("archives/index.html", generator.get_template("archives"), settings, - blog=True, paginated={}, page_name='archives') + blog=True, paginated={}, page_name='archives/index') def test_direct_templates_save_as_false(self): From 44351aaf3126ea54508aef0db92ad4f556dc4e34 Mon Sep 17 00:00:00 2001 From: dave mankoff Date: Sat, 9 Feb 2013 18:01:40 -0500 Subject: [PATCH 0323/1975] delete output directory properly --- pelican/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index f57d2af7..0e3db788 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -224,7 +224,9 @@ def parse_arguments(): parser.add_argument('-d', '--delete-output-directory', dest='delete_outputdir', - action='store_true', help='Delete the output directory.') + action='store_true', + default=None, + help='Delete the output directory.') parser.add_argument('-v', '--verbose', action='store_const', const=logging.INFO, dest='verbosity', From ccef2a6f13b495b507d8b595c5c0b9083d7d0fac Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 23 Jan 2013 18:35:25 -0600 Subject: [PATCH 0324/1975] Settings file is pelicanconf.py now. --- pelican/plugins/related_posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/plugins/related_posts.py b/pelican/plugins/related_posts.py index c2765c3c..29c39435 100644 --- a/pelican/plugins/related_posts.py +++ b/pelican/plugins/related_posts.py @@ -13,7 +13,7 @@ To enable, add from pelican.plugins import related_posts PLUGINS = [related_posts] -to your settings.py. +to your settings's file pelicanconf.py . Usage ----- From 11bdb437d2c773096c06c0f62a37d2e9ed2e778b Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 24 Jan 2013 19:57:22 -0600 Subject: [PATCH 0325/1975] added unique filtering and config limit param I hacked some code from other modules and some quick googling, first time with py so this may need to be cleaned up. The functionality is to have a config var in pythonconfig.py and to remove the duplicates `sorted(set())` --- pelican/plugins/related_posts.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/pelican/plugins/related_posts.py b/pelican/plugins/related_posts.py index 29c39435..dc52de9a 100644 --- a/pelican/plugins/related_posts.py +++ b/pelican/plugins/related_posts.py @@ -13,14 +13,21 @@ To enable, add from pelican.plugins import related_posts PLUGINS = [related_posts] -to your settings's file pelicanconf.py . +to your pelicanconf.py. + +Control the number of entries with in the config file with: + +RELATED_POSTS = { + 'numentries': 6, +} + Usage ----- {% if article.related_posts %} {% endif %} @@ -40,12 +47,24 @@ def add_related_posts(generator, metadata): if len(related_posts) < 1: return + + metadata["related_posts"] = sorted(set(related_posts)) relation_score = dict(list(zip(set(related_posts), list(map(related_posts.count, set(related_posts)))))) ranked_related = sorted(relation_score, key=relation_score.get) + + #Load the confg file and get the number of entries specified there + settings = generator.settings + config = settings.get('RELATED_POSTS', {}) - metadata["related_posts"] = ranked_related[:5] + #check if the related_posts var is set in the pythonconfig.py + if not isinstance(config, dict): + info("realted_links plugin: Using default number of related links ("+numentries+")") + else: + numentries = config.get('numentries', 5) + + metadata["related_posts"] = ranked_related[:numentries] def register(): From 6f5d8eae9637533a65ac768982175fe65edf2e5f Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 29 Jan 2013 22:08:47 -0600 Subject: [PATCH 0326/1975] Relative URL issues with the related post examples I noted that if you set the `ARTICLE_URL` site variable to have some depth and just create relative links, they will not link correctly. by prefacing the link with `{{ SITEURL}}/` it seems to ensure proper links are created and works with the `make devserver` mode --- docs/plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.rst b/docs/plugins.rst index 77b114cf..3537f16b 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -302,7 +302,7 @@ For example:: {% if article.related_posts %} {% endif %} From 92e9f3b31378e4a3d12d5d2c2933b50d7f4c64f1 Mon Sep 17 00:00:00 2001 From: Joseph Reagle Date: Wed, 23 Jan 2013 12:38:29 -0500 Subject: [PATCH 0327/1975] bom detection and removal --- pelican/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pelican/utils.py b/pelican/utils.py index a761917a..8f9afcc0 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -14,7 +14,7 @@ import fnmatch from collections import defaultdict, Hashable from functools import partial -from codecs import open +from codecs import open, BOM_UTF8 from datetime import datetime from itertools import groupby from jinja2 import Markup @@ -192,7 +192,10 @@ class pelican_open(object): self.filename = filename def __enter__(self): - return open(self.filename, encoding='utf-8').read() + content = open(self.filename, encoding='utf-8').read() + if content[0] == BOM_UTF8.decode('utf8'): + content = content[1:] + return content def __exit__(self, exc_type, exc_value, traceback): pass From 9ed4e77049d15428cf25b14ebd9118f38a0b26a7 Mon Sep 17 00:00:00 2001 From: Joseph Reagle Date: Wed, 23 Jan 2013 12:34:12 -0500 Subject: [PATCH 0328/1975] improve spacing of p and nested lists --- pelican/themes/notmyidea/static/css/main.css | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index 29cce82c..ae8fe3d6 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -65,7 +65,8 @@ h1 a:hover { } /* Paragraphs */ -p {margin-bottom: 1.143em;} +p { margin-top: 1em; + margin-bottom: 1em;} strong, b {font-weight: bold;} em, i {font-style: italic;} @@ -73,12 +74,12 @@ em, i {font-style: italic;} /* Lists */ ul { list-style: outside disc; - margin: 1em 0 1.5em 1.5em; + margin: 0.5em 0 0 1.5em; } ol { list-style: outside decimal; - margin: 1em 0 1.5em 1.5em; + margin: 0.5em 0 0 1.5em; } .post-info { @@ -88,6 +89,7 @@ ol { } .post-info p{ + margin-top: 1px; margin-bottom: 1px; } From 168d713df8f58fb8030443f9f0ea71b798284da5 Mon Sep 17 00:00:00 2001 From: Joseph Reagle Date: Wed, 23 Jan 2013 12:46:41 -0500 Subject: [PATCH 0329/1975] ul/li have no top/bottom margins, but list do --- pelican/themes/notmyidea/static/css/main.css | 6 ++++-- tests/output/basic/theme/css/main.css | 10 +++++++--- tests/output/custom/theme/css/main.css | 10 +++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css index ae8fe3d6..0295f6b2 100644 --- a/pelican/themes/notmyidea/static/css/main.css +++ b/pelican/themes/notmyidea/static/css/main.css @@ -74,14 +74,16 @@ em, i {font-style: italic;} /* Lists */ ul { list-style: outside disc; - margin: 0.5em 0 0 1.5em; + margin: 0em 0 0 1.5em; } ol { list-style: outside decimal; - margin: 0.5em 0 0 1.5em; + margin: 0em 0 0 1.5em; } +li { margin-top: 0.5em;} + .post-info { float:right; margin:10px; diff --git a/tests/output/basic/theme/css/main.css b/tests/output/basic/theme/css/main.css index 29cce82c..0295f6b2 100644 --- a/tests/output/basic/theme/css/main.css +++ b/tests/output/basic/theme/css/main.css @@ -65,7 +65,8 @@ h1 a:hover { } /* Paragraphs */ -p {margin-bottom: 1.143em;} +p { margin-top: 1em; + margin-bottom: 1em;} strong, b {font-weight: bold;} em, i {font-style: italic;} @@ -73,14 +74,16 @@ em, i {font-style: italic;} /* Lists */ ul { list-style: outside disc; - margin: 1em 0 1.5em 1.5em; + margin: 0em 0 0 1.5em; } ol { list-style: outside decimal; - margin: 1em 0 1.5em 1.5em; + margin: 0em 0 0 1.5em; } +li { margin-top: 0.5em;} + .post-info { float:right; margin:10px; @@ -88,6 +91,7 @@ ol { } .post-info p{ + margin-top: 1px; margin-bottom: 1px; } diff --git a/tests/output/custom/theme/css/main.css b/tests/output/custom/theme/css/main.css index 29cce82c..0295f6b2 100644 --- a/tests/output/custom/theme/css/main.css +++ b/tests/output/custom/theme/css/main.css @@ -65,7 +65,8 @@ h1 a:hover { } /* Paragraphs */ -p {margin-bottom: 1.143em;} +p { margin-top: 1em; + margin-bottom: 1em;} strong, b {font-weight: bold;} em, i {font-style: italic;} @@ -73,14 +74,16 @@ em, i {font-style: italic;} /* Lists */ ul { list-style: outside disc; - margin: 1em 0 1.5em 1.5em; + margin: 0em 0 0 1.5em; } ol { list-style: outside decimal; - margin: 1em 0 1.5em 1.5em; + margin: 0em 0 0 1.5em; } +li { margin-top: 0.5em;} + .post-info { float:right; margin:10px; @@ -88,6 +91,7 @@ ol { } .post-info p{ + margin-top: 1px; margin-bottom: 1px; } From 7cafcf6c24e25608f112989c7ffdfb282dbfeffd Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 14 Jan 2013 19:33:03 -0600 Subject: [PATCH 0330/1975] Fix the tag cloud example --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 7280f105..5babedbd 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -386,7 +386,7 @@ The default theme does not support tag clouds, but it is pretty easy to add:: From 4f6467ce08628a72ecf1373b2fe660bb819a635f Mon Sep 17 00:00:00 2001 From: Leroy Jiang Date: Sat, 5 Jan 2013 16:22:32 +0800 Subject: [PATCH 0331/1975] add disqus_url to comment js block --- pelican/themes/notmyidea/templates/article.html | 3 ++- tests/output/custom/a-markdown-powered-article.html | 1 + tests/output/custom/article-1.html | 1 + tests/output/custom/article-2.html | 1 + tests/output/custom/article-3.html | 1 + tests/output/custom/drafts/a-draft-article.html | 12 ------------ tests/output/custom/filename_metadata-example.html | 1 + tests/output/custom/oh-yeah-fr.html | 1 + tests/output/custom/oh-yeah.html | 1 + tests/output/custom/second-article-fr.html | 1 + tests/output/custom/second-article.html | 1 + tests/output/custom/this-is-a-super-article.html | 1 + tests/output/custom/unbelievable.html | 1 + 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pelican/themes/notmyidea/templates/article.html b/pelican/themes/notmyidea/templates/article.html index 737d3789..516fd3b5 100644 --- a/pelican/themes/notmyidea/templates/article.html +++ b/pelican/themes/notmyidea/templates/article.html @@ -14,12 +14,13 @@ {% include 'article_infos.html' %} {{ article.content }} - {% if DISQUS_SITENAME %} + {% if DISQUS_SITENAME and SITEURL and article.status != "draft" %}

    Comments !

    -
    diff --git a/tests/output/custom/filename_metadata-example.html b/tests/output/custom/filename_metadata-example.html index af05059b..432a1cdf 100644 --- a/tests/output/custom/filename_metadata-example.html +++ b/tests/output/custom/filename_metadata-example.html @@ -61,6 +61,7 @@
    +

    You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    diff --git a/pelican/tests/output/basic/archives.html b/pelican/tests/output/basic/archives.html index 06b3e6e6..c941849e 100644 --- a/pelican/tests/output/basic/archives.html +++ b/pelican/tests/output/basic/archives.html @@ -3,31 +3,31 @@ A Pelican Blog - + + + +
    @@ -35,23 +35,23 @@
    Fri 30 November 2012
    -
    FILENAME_METADATA example
    +
    FILENAME_METADATA example
    Wed 29 February 2012
    -
    Second article
    +
    Second article
    Wed 20 April 2011
    -
    A markdown powered article
    +
    A markdown powered article
    Thu 17 February 2011
    -
    Article 1
    +
    Article 1
    Thu 17 February 2011
    -
    Article 2
    +
    Article 2
    Thu 17 February 2011
    -
    Article 3
    +
    Article 3
    Thu 02 December 2010
    -
    This is a super article !
    +
    This is a super article !
    Wed 20 October 2010
    -
    Oh yeah !
    +
    Oh yeah !
    Fri 15 October 2010
    -
    Unbelievable !
    +
    Unbelievable !
    diff --git a/pelican/tests/output/basic/article-1.html b/pelican/tests/output/basic/article-1.html index fb425644..a86bcbd0 100644 --- a/pelican/tests/output/basic/article-1.html +++ b/pelican/tests/output/basic/article-1.html @@ -3,38 +3,38 @@ Article 1 - + + + +

    Article 1

    diff --git a/pelican/tests/output/basic/article-2.html b/pelican/tests/output/basic/article-2.html index 39d55c6b..da74685d 100644 --- a/pelican/tests/output/basic/article-2.html +++ b/pelican/tests/output/basic/article-2.html @@ -3,38 +3,38 @@ Article 2 - + + + +

    Article 2

    diff --git a/pelican/tests/output/basic/article-3.html b/pelican/tests/output/basic/article-3.html index e7e59440..03641539 100644 --- a/pelican/tests/output/basic/article-3.html +++ b/pelican/tests/output/basic/article-3.html @@ -3,38 +3,38 @@ Article 3 - + + + +

    Article 3

    diff --git a/pelican/tests/output/basic/author/alexis-metaireau.html b/pelican/tests/output/basic/author/alexis-metaireau.html index 8b83c8a6..9c47c7a0 100644 --- a/pelican/tests/output/basic/author/alexis-metaireau.html +++ b/pelican/tests/output/basic/author/alexis-metaireau.html @@ -3,31 +3,31 @@ A Pelican Blog - Alexis Métaireau - + + + + @@ -35,17 +35,17 @@

    Multi-line metadata should be supported as well as inline markup.

    - read more + read more diff --git a/pelican/tests/output/basic/categories.html b/pelican/tests/output/basic/categories.html index cdcbb04f..8f6d9f41 100644 --- a/pelican/tests/output/basic/categories.html +++ b/pelican/tests/output/basic/categories.html @@ -3,38 +3,38 @@ A Pelican Blog - + + + +

    Article 1

    - read more + read more @@ -78,7 +78,7 @@
  • Article 2

    - read more + read more @@ -100,7 +100,7 @@
  • Article 3

    - read more + read more diff --git a/pelican/tests/output/basic/category/misc.html b/pelican/tests/output/basic/category/misc.html index cdf2a437..f966bf89 100644 --- a/pelican/tests/output/basic/category/misc.html +++ b/pelican/tests/output/basic/category/misc.html @@ -3,31 +3,31 @@ A Pelican Blog - misc - + + + + @@ -35,13 +35,13 @@

    This is some article, in english

    - read more + read more @@ -79,7 +79,7 @@
  • Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    - read more + read more diff --git a/pelican/tests/output/basic/category/yeah.html b/pelican/tests/output/basic/category/yeah.html index fc108e93..bce27b13 100644 --- a/pelican/tests/output/basic/category/yeah.html +++ b/pelican/tests/output/basic/category/yeah.html @@ -3,31 +3,31 @@ A Pelican Blog - yeah - + + + + @@ -35,17 +35,17 @@

    Some cool stuff!

    diff --git a/pelican/tests/output/basic/index.html b/pelican/tests/output/basic/index.html index 657ea233..d109f535 100644 --- a/pelican/tests/output/basic/index.html +++ b/pelican/tests/output/basic/index.html @@ -3,31 +3,31 @@ A Pelican Blog - + + + + @@ -35,13 +35,13 @@

    This is some article, in english

    - read more + read more @@ -79,7 +79,7 @@
  • You're mutually oblivious.

    -

    a root-relative link to unbelievable -a file-relative link to unbelievable

    - read more +

    a root-relative link to unbelievable +a file-relative link to unbelievable

    + read more @@ -102,7 +102,7 @@
  • Article 1

    - read more + read more @@ -124,7 +124,7 @@
  • Article 2

    - read more + read more @@ -146,7 +146,7 @@
  • Article 3

    - read more + read more @@ -168,7 +168,7 @@
  • Multi-line metadata should be supported as well as inline markup.

    - read more + read more @@ -194,7 +194,7 @@ as well as inline markup.

  • Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -216,7 +216,7 @@ YEAH !

    alternate text
    - read more + read more @@ -224,7 +224,7 @@ YEAH !

  • Or completely awesome. Depends the needs.

    -

    a root-relative link to markdown-article -a file-relative link to markdown-article

    +

    a root-relative link to markdown-article +a file-relative link to markdown-article

    - read more + read more diff --git a/pelican/tests/output/basic/oh-yeah.html b/pelican/tests/output/basic/oh-yeah.html index 761ae0ff..82b90905 100644 --- a/pelican/tests/output/basic/oh-yeah.html +++ b/pelican/tests/output/basic/oh-yeah.html @@ -3,38 +3,38 @@ Oh yeah ! - + + + +

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! diff --git a/pelican/tests/output/basic/override/index.html b/pelican/tests/output/basic/override/index.html index 20995de3..82c1e184 100644 --- a/pelican/tests/output/basic/override/index.html +++ b/pelican/tests/output/basic/override/index.html @@ -3,31 +3,31 @@ Override url/save_as - + + + +

    diff --git a/pelican/tests/output/basic/pages/this-is-a-test-hidden-page.html b/pelican/tests/output/basic/pages/this-is-a-test-hidden-page.html index 6f1f71ee..06e4bcc1 100644 --- a/pelican/tests/output/basic/pages/this-is-a-test-hidden-page.html +++ b/pelican/tests/output/basic/pages/this-is-a-test-hidden-page.html @@ -3,31 +3,31 @@ This is a test hidden page - + + + + diff --git a/pelican/tests/output/basic/pages/this-is-a-test-page.html b/pelican/tests/output/basic/pages/this-is-a-test-page.html index ce9ffd2c..c40fc879 100644 --- a/pelican/tests/output/basic/pages/this-is-a-test-page.html +++ b/pelican/tests/output/basic/pages/this-is-a-test-page.html @@ -3,31 +3,31 @@ This is a test page - + + + + diff --git a/pelican/tests/output/basic/second-article-fr.html b/pelican/tests/output/basic/second-article-fr.html index 67c206af..6b3f422e 100644 --- a/pelican/tests/output/basic/second-article-fr.html +++ b/pelican/tests/output/basic/second-article-fr.html @@ -3,38 +3,38 @@ Deuxième article - + + + +

    Ceci est un article, en français.

    diff --git a/pelican/tests/output/basic/second-article.html b/pelican/tests/output/basic/second-article.html index e779e0da..657e1e5d 100644 --- a/pelican/tests/output/basic/second-article.html +++ b/pelican/tests/output/basic/second-article.html @@ -3,38 +3,38 @@ Second article - + + + +

    This is some article, in english

    diff --git a/pelican/tests/output/basic/tag/bar.html b/pelican/tests/output/basic/tag/bar.html index 6d4138f2..725cd165 100644 --- a/pelican/tests/output/basic/tag/bar.html +++ b/pelican/tests/output/basic/tag/bar.html @@ -3,31 +3,31 @@ A Pelican Blog - bar - + + + + @@ -35,15 +35,15 @@

    Multi-line metadata should be supported as well as inline markup.

    - read more + read more @@ -83,7 +83,7 @@ as well as inline markup.

  • Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! @@ -105,7 +105,7 @@ YEAH !

    alternate text
    - read more + read more diff --git a/pelican/tests/output/basic/tag/baz.html b/pelican/tests/output/basic/tag/baz.html index dd44e38a..6a8baa42 100644 --- a/pelican/tests/output/basic/tag/baz.html +++ b/pelican/tests/output/basic/tag/baz.html @@ -3,31 +3,31 @@ A Pelican Blog - baz - + + + + @@ -35,15 +35,15 @@
    Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> diff --git a/pelican/tests/output/custom/feeds/all.atom.xml b/pelican/tests/output/custom/feeds/all.atom.xml index ae5fe30c..3187c2aa 100644 --- a/pelican/tests/output/custom/feeds/all.atom.xml +++ b/pelican/tests/output/custom/feeds/all.atom.xml @@ -12,8 +12,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() @@ -24,7 +24,7 @@ <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> diff --git a/pelican/tests/output/custom/feeds/all.rss.xml b/pelican/tests/output/custom/feeds/all.rss.xml index 89176ac0..8d07bec7 100644 --- a/pelican/tests/output/custom/feeds/all.rss.xml +++ b/pelican/tests/output/custom/feeds/all.rss.xml @@ -12,8 +12,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() @@ -24,7 +24,7 @@ <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> diff --git a/pelican/tests/output/custom/feeds/bar.atom.xml b/pelican/tests/output/custom/feeds/bar.atom.xml index 9945f938..99b7cc45 100644 --- a/pelican/tests/output/custom/feeds/bar.atom.xml +++ b/pelican/tests/output/custom/feeds/bar.atom.xml @@ -3,6 +3,6 @@ <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div>
    \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/bar.rss.xml b/pelican/tests/output/custom/feeds/bar.rss.xml index 148411be..94bd93f2 100644 --- a/pelican/tests/output/custom/feeds/bar.rss.xml +++ b/pelican/tests/output/custom/feeds/bar.rss.xml @@ -3,6 +3,6 @@ <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> </div> Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeah \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/yeah.atom.xml b/pelican/tests/output/custom/feeds/yeah.atom.xml index d2307359..1a152174 100644 --- a/pelican/tests/output/custom/feeds/yeah.atom.xml +++ b/pelican/tests/output/custom/feeds/yeah.atom.xml @@ -3,8 +3,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() diff --git a/pelican/tests/output/custom/feeds/yeah.rss.xml b/pelican/tests/output/custom/feeds/yeah.rss.xml index b252c26a..85f93686 100644 --- a/pelican/tests/output/custom/feeds/yeah.rss.xml +++ b/pelican/tests/output/custom/feeds/yeah.rss.xml @@ -3,8 +3,8 @@ <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> -<img alt="alternate text" src="http://blog.notmyidea.org/static/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi.jpg" style="width: 600px; height: 450px;" /> +<img alt="alternate text" src="http://blog.notmyidea.org/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" /> <pre class="literal-block"> &gt;&gt;&gt; from ipdb import set_trace &gt;&gt;&gt; set_trace() diff --git a/pelican/tests/output/custom/index2.html b/pelican/tests/output/custom/index2.html index 8ed54b6e..b8e2ac1a 100644 --- a/pelican/tests/output/custom/index2.html +++ b/pelican/tests/output/custom/index2.html @@ -132,7 +132,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more diff --git a/pelican/tests/output/custom/oh-yeah.html b/pelican/tests/output/custom/oh-yeah.html index f9f1f1fb..2f6ca309 100644 --- a/pelican/tests/output/custom/oh-yeah.html +++ b/pelican/tests/output/custom/oh-yeah.html @@ -52,7 +52,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text diff --git a/pelican/tests/output/custom/pages/this-is-a-test-page.html b/pelican/tests/output/custom/pages/this-is-a-test-page.html index 571211d9..b4cb678c 100644 --- a/pelican/tests/output/custom/pages/this-is-a-test-page.html +++ b/pelican/tests/output/custom/pages/this-is-a-test-page.html @@ -32,7 +32,7 @@

    This is a test page

    Just an image.

    -alternate text +alternate text
    diff --git a/pelican/tests/output/custom/static/pictures/Fat_Cat.jpg b/pelican/tests/output/custom/pictures/Fat_Cat.jpg similarity index 100% rename from pelican/tests/output/custom/static/pictures/Fat_Cat.jpg rename to pelican/tests/output/custom/pictures/Fat_Cat.jpg diff --git a/pelican/tests/output/custom/static/pictures/Sushi.jpg b/pelican/tests/output/custom/pictures/Sushi.jpg similarity index 100% rename from pelican/tests/output/custom/static/pictures/Sushi.jpg rename to pelican/tests/output/custom/pictures/Sushi.jpg diff --git a/pelican/tests/output/custom/static/pictures/Sushi_Macro.jpg b/pelican/tests/output/custom/pictures/Sushi_Macro.jpg similarity index 100% rename from pelican/tests/output/custom/static/pictures/Sushi_Macro.jpg rename to pelican/tests/output/custom/pictures/Sushi_Macro.jpg diff --git a/pelican/tests/output/custom/robots.txt b/pelican/tests/output/custom/robots.txt index ae5b0d05..19a6e299 100644 --- a/pelican/tests/output/custom/robots.txt +++ b/pelican/tests/output/custom/robots.txt @@ -1,2 +1,2 @@ User-agent: * -Disallow: /static/pictures +Disallow: /pictures diff --git a/pelican/tests/output/custom/tag/bar.html b/pelican/tests/output/custom/tag/bar.html index 2fed02c2..d1805e50 100644 --- a/pelican/tests/output/custom/tag/bar.html +++ b/pelican/tests/output/custom/tag/bar.html @@ -104,7 +104,7 @@ as well as inline markup.

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text read more diff --git a/pelican/tests/output/custom/tag/foobar.html b/pelican/tests/output/custom/tag/foobar.html index 71c2d430..2c50c8ae 100644 --- a/pelican/tests/output/custom/tag/foobar.html +++ b/pelican/tests/output/custom/tag/foobar.html @@ -47,8 +47,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/pelican/tests/output/custom/tag/oh.html b/pelican/tests/output/custom/tag/oh.html
    index 361b1fd2..b798964e 100644
    --- a/pelican/tests/output/custom/tag/oh.html
    +++ b/pelican/tests/output/custom/tag/oh.html
    @@ -49,7 +49,7 @@
     

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/pelican/tests/output/custom/tag/yeah.html b/pelican/tests/output/custom/tag/yeah.html index 9bbd214b..54ad93c6 100644 --- a/pelican/tests/output/custom/tag/yeah.html +++ b/pelican/tests/output/custom/tag/yeah.html @@ -49,7 +49,7 @@

    Why not ?

    After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !

    -alternate text +alternate text

    There are comments.

    diff --git a/pelican/tests/output/custom/this-is-a-super-article.html b/pelican/tests/output/custom/this-is-a-super-article.html index 000bd555..1fdd8897 100644 --- a/pelican/tests/output/custom/this-is-a-super-article.html +++ b/pelican/tests/output/custom/this-is-a-super-article.html @@ -50,8 +50,8 @@

    This is a simple title

    And here comes the cool stuff.

    -alternate text -alternate text +alternate text +alternate text
     >>> from ipdb import set_trace
     >>> set_trace()
    diff --git a/samples/content/extra/robots.txt b/samples/content/extra/robots.txt
    index ae5b0d05..19a6e299 100644
    --- a/samples/content/extra/robots.txt
    +++ b/samples/content/extra/robots.txt
    @@ -1,2 +1,2 @@
     User-agent: *
    -Disallow: /static/pictures
    +Disallow: /pictures
    diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py
    index ad2042fd..4d5cd06d 100755
    --- a/samples/pelican.conf.py
    +++ b/samples/pelican.conf.py
    @@ -37,9 +37,6 @@ DEFAULT_METADATA = (('yeah', 'it is'),)
     # path-specific metadata
     EXTRA_PATH_METADATA = {
         'extra/robots.txt': {'path': 'robots.txt'},
    -    'pictures/Fat_Cat.jpg': {'path': 'static/pictures/Fat_Cat.jpg'},
    -    'pictures/Sushi.jpg': {'path': 'static/pictures/Sushi.jpg'},
    -    'pictures/Sushi_Macro.jpg': {'path': 'static/pictures/Sushi_Macro.jpg'},
         }
     
     # static paths will be copied without parsing their contents
    
    From 8f295f7a037e0d512181946b9b87636f4a853e26 Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Sun, 16 Jun 2013 08:53:45 -0700
    Subject: [PATCH 0516/1975] PyPI now has CDN; Travis shouldn't use mirrors
    
    Now that PyPI utilizes a CDN, the "--use-mirrors" setting slows down the
    install process and has essentially been deprecated.
    ---
     .travis.yml | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index 1ff512b6..918fd3f9 100644
    --- a/.travis.yml
    +++ b/.travis.yml
    @@ -8,7 +8,7 @@ before_install:
      - sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8
     install:
         - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then ln -s /usr/share/asciidoc/asciidocapi.py ~/virtualenv/python2.7/lib/python2.7/site-packages/; fi
    -    - pip install mock --use-mirrors
    -    - pip install . --use-mirrors
    -    - pip install --use-mirrors Markdown
    +    - pip install mock
    +    - pip install .
    +    - pip install Markdown
     script: python -m unittest discover
    
    From 0d1866b393e79a76ab2b416eb22ac6a924b3849b Mon Sep 17 00:00:00 2001
    From: "W. Trevor King" 
    Date: Sat, 5 Jan 2013 11:39:06 -0500
    Subject: [PATCH 0517/1975] Pelican.run: Use keyword arguments when
     initializing generators
    
    This makes it easier to add new arguments to Generator subclasses.
    ---
     pelican/__init__.py | 12 ++++++------
     1 file changed, 6 insertions(+), 6 deletions(-)
    
    diff --git a/pelican/__init__.py b/pelican/__init__.py
    index 7f406c4f..78a16e27 100644
    --- a/pelican/__init__.py
    +++ b/pelican/__init__.py
    @@ -157,12 +157,12 @@ class Pelican(object):
             context['localsiteurl'] = self.settings['SITEURL']  # share
             generators = [
                 cls(
    -                context,
    -                self.settings,
    -                self.path,
    -                self.theme,
    -                self.output_path,
    -                self.markup,
    +                context=context,
    +                settings=self.settings,
    +                path=self.path,
    +                theme=self.theme,
    +                output_path=self.output_path,
    +                markup=self.markup,
                 ) for cls in self.get_generator_classes()
             ]
     
    
    From 6e527e7416cc51b07c4a83b41f050bcf12618fdc Mon Sep 17 00:00:00 2001
    From: "W. Trevor King" 
    Date: Sat, 5 Jan 2013 14:23:02 -0500
    Subject: [PATCH 0518/1975] test_generators: Use keyword arguments to
     initialize Generators
    
    ---
     pelican/tests/test_generators.py | 54 +++++++++++++++++++-------------
     1 file changed, 33 insertions(+), 21 deletions(-)
    
    diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py
    index f5ed6b85..54f4a232 100644
    --- a/pelican/tests/test_generators.py
    +++ b/pelican/tests/test_generators.py
    @@ -33,8 +33,10 @@ class TestArticlesGenerator(unittest.TestCase):
                 settings = get_settings(filenames={})
                 settings['DEFAULT_CATEGORY'] = 'Default'
                 settings['DEFAULT_DATE'] = (1970, 1, 1)
    -            self.generator = ArticlesGenerator(settings.copy(), settings,
    -                CONTENT_DIR, settings['THEME'], None,  settings['MARKUP'])
    +            self.generator = ArticlesGenerator(
    +                context=settings.copy(), settings=settings,
    +                path=CONTENT_DIR, theme=settings['THEME'],
    +                output_path=None, markup=settings['MARKUP'])
                 self.generator.generate_context()
             return self.generator
     
    @@ -52,16 +54,19 @@ class TestArticlesGenerator(unittest.TestCase):
     
         def test_generate_feeds(self):
             settings = get_settings()
    -        generator = ArticlesGenerator(settings, settings, None,
    -                settings['THEME'], None, settings['MARKUP'])
    +        generator = ArticlesGenerator(
    +            context=settings, settings=settings,
    +            path=None, theme=settings['THEME'],
    +            output_path=None, markup=settings['MARKUP'])
             writer = MagicMock()
             generator.generate_feeds(writer)
             writer.write_feed.assert_called_with([], settings,
                                                  'feeds/all.atom.xml')
     
             generator = ArticlesGenerator(
    -            settings, get_settings(FEED_ALL_ATOM=None), None,
    -            settings['THEME'], None, None)
    +            context=settings, settings=get_settings(FEED_ALL_ATOM=None),
    +            path=None, theme=settings['THEME'],
    +            output_path=None, markup=None)
             writer = MagicMock()
             generator.generate_feeds(writer)
             self.assertFalse(writer.write_feed.called)
    @@ -122,8 +127,9 @@ class TestArticlesGenerator(unittest.TestCase):
             settings['USE_FOLDER_AS_CATEGORY'] = False
             settings['filenames'] = {}
             generator = ArticlesGenerator(
    -            settings.copy(), settings, CONTENT_DIR, DEFAULT_CONFIG['THEME'],
    -            None, DEFAULT_CONFIG['MARKUP'])
    +            context=settings.copy(), settings=settings,
    +            path=CONTENT_DIR, theme=DEFAULT_CONFIG['THEME'],
    +            output_path=None, markup=DEFAULT_CONFIG['MARKUP'])
             generator.generate_context()
             # test for name
             # categories are grouped by slug; if two categories have the same slug
    @@ -143,9 +149,10 @@ class TestArticlesGenerator(unittest.TestCase):
         def test_direct_templates_save_as_default(self):
     
             settings = get_settings(filenames={})
    -        generator = ArticlesGenerator(settings, settings, None,
    -                                      settings['THEME'], None,
    -                                      settings['MARKUP'])
    +        generator = ArticlesGenerator(
    +            context=settings, settings=settings,
    +            path=None, theme=settings['THEME'],
    +            output_path=None, markup=settings['MARKUP'])
             write = MagicMock()
             generator.generate_direct_templates(write)
             write.assert_called_with("archives.html",
    @@ -157,9 +164,10 @@ class TestArticlesGenerator(unittest.TestCase):
             settings = get_settings()
             settings['DIRECT_TEMPLATES'] = ['archives']
             settings['ARCHIVES_SAVE_AS'] = 'archives/index.html'
    -        generator = ArticlesGenerator(settings, settings, None,
    -                                      settings['THEME'], None,
    -                                      settings['MARKUP'])
    +        generator = ArticlesGenerator(
    +            context=settings, settings=settings,
    +            path=None, theme=settings['THEME'],
    +            output_path=None, markup=settings['MARKUP'])
             write = MagicMock()
             generator.generate_direct_templates(write)
             write.assert_called_with("archives/index.html",
    @@ -171,9 +179,10 @@ class TestArticlesGenerator(unittest.TestCase):
             settings = get_settings()
             settings['DIRECT_TEMPLATES'] = ['archives']
             settings['ARCHIVES_SAVE_AS'] = 'archives/index.html'
    -        generator = ArticlesGenerator(settings, settings, None,
    -                                      settings['THEME'], None,
    -                                      settings['MARKUP'])
    +        generator = ArticlesGenerator(
    +            context=settings, settings=settings,
    +            path=None, theme=settings['THEME'],
    +            output_path=None, markup=settings['MARKUP'])
             write = MagicMock()
             generator.generate_direct_templates(write)
             write.assert_called_count == 0
    @@ -215,8 +224,9 @@ class TestPageGenerator(unittest.TestCase):
             settings['DEFAULT_DATE'] = (1970, 1, 1)
     
             generator = PagesGenerator(
    -            settings.copy(), settings, CUR_DIR, settings['THEME'], None,
    -            settings['MARKUP'])
    +            context=settings.copy(), settings=settings,
    +            path=CUR_DIR, theme=settings['THEME'],
    +            output_path=None, markup=settings['MARKUP'])
             generator.generate_context()
             pages = self.distill_pages(generator.pages)
             hidden_pages = self.distill_pages(generator.hidden_pages)
    @@ -258,8 +268,10 @@ class TestTemplatePagesGenerator(unittest.TestCase):
                     'template/source.html': 'generated/file.html'
                     }
     
    -        generator = TemplatePagesGenerator({'foo': 'bar'}, settings,
    -                self.temp_content, '', self.temp_output, None)
    +        generator = TemplatePagesGenerator(
    +            context={'foo': 'bar'}, settings=settings,
    +            path=self.temp_content, theme='',
    +            output_path=self.temp_output, markup=None)
     
             # create a dummy template file
             template_dir = os.path.join(self.temp_content, 'template')
    
    From 12dd35ef360e30f7fb5cc107069cacbe5c43595b Mon Sep 17 00:00:00 2001
    From: "W. Trevor King" 
    Date: Sat, 5 Jan 2013 11:41:33 -0500
    Subject: [PATCH 0519/1975] generators: Remove wonky argument handling from
     Generator.__init__
    
    ---
     pelican/generators.py | 12 ++++++++----
     1 file changed, 8 insertions(+), 4 deletions(-)
    
    diff --git a/pelican/generators.py b/pelican/generators.py
    index a01281dc..3ebcb648 100644
    --- a/pelican/generators.py
    +++ b/pelican/generators.py
    @@ -31,10 +31,14 @@ logger = logging.getLogger(__name__)
     class Generator(object):
         """Baseclass generator"""
     
    -    def __init__(self, *args, **kwargs):
    -        for idx, item in enumerate(('context', 'settings', 'path', 'theme',
    -                'output_path', 'markup')):
    -            setattr(self, item, args[idx])
    +    def __init__(self, context, settings, path, theme, output_path, markup,
    +                 **kwargs):
    +        self.context = context
    +        self.settings = settings
    +        self.path = path
    +        self.theme = theme
    +        self.output_path = output_path
    +        self.markup = markup
     
             for arg, value in kwargs.items():
                 setattr(self, arg, value)
    
    From 39dd4a025581cfa3b4d6256a3b8f327b26372e1d Mon Sep 17 00:00:00 2001
    From: Kyle Machulis 
    Date: Fri, 14 Jun 2013 12:12:19 -0700
    Subject: [PATCH 0520/1975] Changed meta tag "contents" attribute to "content",
     to conform to HTML spec. Fixes #918
    
    ---
     docs/getting_started.rst                          | 10 +++++-----
     pelican/readers.py                                | 15 ++++++++++++---
     pelican/tests/content/article_with_keywords.html  |  2 +-
     pelican/tests/content/article_with_metadata.html  | 12 ++++++------
     .../article_with_metadata_and_contents.html       | 15 +++++++++++++++
     .../content/article_with_uppercase_metadata.html  |  2 +-
     pelican/tests/test_readers.py                     | 15 +++++++++++++++
     7 files changed, 55 insertions(+), 16 deletions(-)
     create mode 100644 pelican/tests/content/article_with_metadata_and_contents.html
    
    diff --git a/docs/getting_started.rst b/docs/getting_started.rst
    index 383acdc4..1e31f26d 100644
    --- a/docs/getting_started.rst
    +++ b/docs/getting_started.rst
    @@ -265,11 +265,11 @@ interprets the HTML in a very straightforward manner, reading metadata from
         
             
                 My super title
    -            
    -            
    -            
    -            
    -            
    +            
    +            
    +            
    +            
    +            
             
             
                 This is the content of my super blog post.
    diff --git a/pelican/readers.py b/pelican/readers.py
    index bd9f5914..fb2ccfc4 100644
    --- a/pelican/readers.py
    +++ b/pelican/readers.py
    @@ -5,6 +5,7 @@ import datetime
     import logging
     import os
     import re
    +import logging
     try:
         import docutils
         import docutils.core
    @@ -47,6 +48,8 @@ METADATA_PROCESSORS = {
         'author': Author,
     }
     
    +logger = logging.getLogger(__name__)
    +
     
     class Reader(object):
         enabled = True
    @@ -199,7 +202,7 @@ class HTMLReader(Reader):
         enabled = True
     
         class _HTMLParser(HTMLParser):
    -        def __init__(self, settings):
    +        def __init__(self, settings, filename):
                 HTMLParser.__init__(self)
                 self.body = ''
                 self.metadata = {}
    @@ -207,6 +210,8 @@ class HTMLReader(Reader):
     
                 self._data_buffer = ''
     
    +            self._filename = filename
    +
                 self._in_top_level = True
                 self._in_head = False
                 self._in_title = False
    @@ -275,7 +280,11 @@ class HTMLReader(Reader):
     
             def _handle_meta_tag(self, attrs):
                 name = self._attr_value(attrs, 'name').lower()
    -            contents = self._attr_value(attrs, 'contents', '')
    +            contents = self._attr_value(attrs, 'content', '')
    +            if not contents:
    +                contents = self._attr_value(attrs, 'contents', '')
    +                if contents:
    +                    logger.warning("Meta tag attribute 'contents' used in file %s, should be changed to 'content'", self._filename)
     
                 if name == 'keywords':
                     name = 'tags'
    @@ -288,7 +297,7 @@ class HTMLReader(Reader):
         def read(self, filename):
             """Parse content and metadata of HTML files"""
             with pelican_open(filename) as content:
    -            parser = self._HTMLParser(self.settings)
    +            parser = self._HTMLParser(self.settings, filename)
                 parser.feed(content)
                 parser.close()
     
    diff --git a/pelican/tests/content/article_with_keywords.html b/pelican/tests/content/article_with_keywords.html
    index c869f514..0744c754 100644
    --- a/pelican/tests/content/article_with_keywords.html
    +++ b/pelican/tests/content/article_with_keywords.html
    @@ -1,6 +1,6 @@
     
         
             This is a super article !
    -        
    +        
         
     
    diff --git a/pelican/tests/content/article_with_metadata.html b/pelican/tests/content/article_with_metadata.html
    index b108ac8a..b501ea29 100644
    --- a/pelican/tests/content/article_with_metadata.html
    +++ b/pelican/tests/content/article_with_metadata.html
    @@ -1,12 +1,12 @@
     
         
             This is a super article !
    -        
    -        
    -        
    -        
    -        
    -        
    +        
    +        
    +        
    +        
    +        
    +        
         
         
             Multi-line metadata should be supported
    diff --git a/pelican/tests/content/article_with_metadata_and_contents.html b/pelican/tests/content/article_with_metadata_and_contents.html
    new file mode 100644
    index 00000000..b108ac8a
    --- /dev/null
    +++ b/pelican/tests/content/article_with_metadata_and_contents.html
    @@ -0,0 +1,15 @@
    +
    +    
    +        This is a super article !
    +        
    +        
    +        
    +        
    +        
    +        
    +    
    +    
    +        Multi-line metadata should be supported
    +        as well as inline markup.
    +    
    +
    diff --git a/pelican/tests/content/article_with_uppercase_metadata.html b/pelican/tests/content/article_with_uppercase_metadata.html
    index 4fe5a9ee..b4cedf39 100644
    --- a/pelican/tests/content/article_with_uppercase_metadata.html
    +++ b/pelican/tests/content/article_with_uppercase_metadata.html
    @@ -1,6 +1,6 @@
     
         
             This is a super article !
    -        
    +        
         
     
    diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py
    index 14d42325..c67b8a1f 100644
    --- a/pelican/tests/test_readers.py
    +++ b/pelican/tests/test_readers.py
    @@ -350,6 +350,21 @@ class HTMLReaderTest(ReaderTest):
             for key, value in expected.items():
                 self.assertEqual(value, page.metadata[key], key)
     
    +    def test_article_with_metadata_and_contents_attrib(self):
    +        page = self.read_file(path='article_with_metadata_and_contents.html')
    +        expected = {
    +            'category': 'yeah',
    +            'author': 'Alexis Métaireau',
    +            'title': 'This is a super article !',
    +            'summary': 'Summary and stuff',
    +            'date': datetime.datetime(2010, 12, 2, 10, 14),
    +            'tags': ['foo', 'bar', 'foobar'],
    +            'custom_field': 'http://notmyidea.org',
    +        }
    +        for key, value in expected.items():
    +            self.assertEqual(value, page.metadata[key], key)
    +
    +
         def test_article_with_null_attributes(self):
             page = self.read_file(path='article_with_null_attributes.html')
     
    
    From d8c9fb31d0d1a0f5f3f5319dbabbf50e36fd255b Mon Sep 17 00:00:00 2001
    From: Danilo Bargen 
    Date: Thu, 20 Jun 2013 00:13:57 +0200
    Subject: [PATCH 0521/1975] Better duck typing in isinstance check
    
    ---
     pelican/__init__.py | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/pelican/__init__.py b/pelican/__init__.py
    index 78a16e27..1739aae3 100644
    --- a/pelican/__init__.py
    +++ b/pelican/__init__.py
    @@ -9,6 +9,7 @@ import time
     import logging
     import argparse
     import locale
    +import collections
     
     from pelican import signals
     
    @@ -205,7 +206,7 @@ class Pelican(object):
             for pair in signals.get_generators.send(self):
                 (funct, value) = pair
     
    -            if not isinstance(value, (tuple, list)):
    +            if not isinstance(value, collections.Iterable):
                     value = (value, )
     
                 for v in value:
    
    From dd9f55c8bb0979d230c42cd28bb8b6fbe6d41d98 Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Sat, 22 Jun 2013 12:28:37 -0700
    Subject: [PATCH 0522/1975] Clean up minor text formatting, spelling, grammar
    
    ---
     pelican/utils.py | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/pelican/utils.py b/pelican/utils.py
    index 9ba234a5..fea7b953 100644
    --- a/pelican/utils.py
    +++ b/pelican/utils.py
    @@ -67,11 +67,11 @@ def strftime(date, date_format):
     
     class DateFormatter(object):
         '''A date formatter object used as a jinja filter
    -    
    -    Uses the `strftime` implementation and makes sure jinja uses the locale 
    +
    +    Uses the `strftime` implementation and makes sure jinja uses the locale
         defined in LOCALE setting
         '''
    -    
    +
         def __init__(self):
             self.locale = locale.setlocale(locale.LC_TIME)
     
    @@ -216,7 +216,7 @@ def get_date(string):
     
     
     class pelican_open(object):
    -    """Open a file and return it's content"""
    +    """Open a file and return its content"""
         def __init__(self, filename):
             self.filename = filename
     
    @@ -236,7 +236,7 @@ def slugify(value):
         Normalizes string, converts to lowercase, removes non-alpha characters,
         and converts spaces to hyphens.
     
    -    Took from django sources.
    +    Took from Django sources.
         """
         # TODO Maybe steal again from current Django 1.5dev
         value = Markup(value).striptags()
    
    From e9fec3b1dc32cf9df20fc9774a63065bc14ddad8 Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Mon, 24 Jun 2013 13:05:00 -0700
    Subject: [PATCH 0523/1975] Remove "clean" task from "make html"; fixes #637
    
    This change removes the "clean" task from the "html" and "regenerate"
    tasks in the default Makefile generated by pelican-quickstart. The
    previous behavior ignored whether the DELETE_OUTPUT_DIRECTORY
    setting was set to True or not and deleted everything in the output
    directory every time the "make html" or "make regenerate" task was run.
    In addition to violating the Principle of Least Astonishment, there was
    also the potential for data loss if the user wasn't careful when
    defining the output directory location in the Makefile.
    
    The new behavior therefore relies primarily on the
    DELETE_OUTPUT_DIRECTORY setting to control if and when the output
    directory is cleaned. The default settings and Makefile generated by the
    pelican-quickstart command, for example, no longer clean the output
    directory when the "make html" task is run. If the user wants to change
    this behavior and have the output directory cleaned on every "make html"
    run, the recommended method would be to set DELETE_OUTPUT_DIRECTORY to
    True in pelicanconf.py. Alternatively, the user can manually run "make
    clean", with the caveat that the output directory and its contents will
    be entirely destroyed, including any otherwise to-be-retained files or
    folders specified in the OUTPUT_RETENTION setting. It is for that reason
    that relying on the DELETE_OUTPUT_DIRECTORY setting is instead
    recommended.
    
    As before, DELETE_OUTPUT_DIRECTORY is set to True in the publishconf.py
    settings file generated by the pelican-quickstart script. This way, any
    potentially old and irrelevant files will be automatically removed
    before the latest version of the site is transferred to the production
    server environment.
    
    In summary, this change allows for the sanest possible default settings,
    while still allowing end users to customize output cleaning to their
    preferred behavior with a minimum of confusion.
    ---
     pelican/tools/templates/Makefile.in | 6 ++----
     1 file changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
    index 221568aa..8890db6f 100644
    --- a/pelican/tools/templates/Makefile.in
    +++ b/pelican/tools/templates/Makefile.in
    @@ -40,15 +40,13 @@ help:
     	@echo '                                                                       '
     
     
    -html: clean $$(OUTPUTDIR)/index.html
    -
    -$$(OUTPUTDIR)/%.html:
    +html:
     	$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
     
     clean:
     	[ ! -d $$(OUTPUTDIR) ] || find $$(OUTPUTDIR) -mindepth 1 -delete
     
    -regenerate: clean
    +regenerate:
     	$$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
     
     serve:
    
    From bf0a50880d35f803ec5c929bfe60b026accf9307 Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Mon, 24 Jun 2013 13:40:32 -0700
    Subject: [PATCH 0524/1975] Revert "make clean" behavior to rm -rf. Fixes #773
    
    The change to the "make clean" task in 764a2cf from "rm -rf" to instead
    relying on GNU "find" appears to have broken cross-platform portability,
    likely causing problems on *BSD and other platforms. This commit reverts
    that change back to the previous "rm -rf" behavior.
    ---
     pelican/tools/templates/Makefile.in | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
    index 8890db6f..4bc764ca 100644
    --- a/pelican/tools/templates/Makefile.in
    +++ b/pelican/tools/templates/Makefile.in
    @@ -44,7 +44,7 @@ html:
     	$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
     
     clean:
    -	[ ! -d $$(OUTPUTDIR) ] || find $$(OUTPUTDIR) -mindepth 1 -delete
    +	[ ! -d $$(OUTPUTDIR) ] || rm -rf $$(OUTPUTDIR)
     
     regenerate:
     	$$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)
    
    From 6f36b0a2460a41eabb1edd0bd70318c52ddadd47 Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Sun, 23 Jun 2013 11:44:53 -0700
    Subject: [PATCH 0525/1975] Keep certain files when cleaning output; fix #574
    
    If DELETE_OUTPUT_DIRECTORY is set to True, all files and directories are
    deleted from the output directory. There are, however, several reasons
    one might want to retain certain files/directories and avoid their
    deletion from the output directory. One such use case is version control
    system data: a versioned output directory can facilitate deployment via
    Heroku and/or allow the user to easily revert to a prior version of the
    site without having to rely on regeneration via Pelican.
    
    This change introduces the OUTPUT_RETENTION setting, a tuple of
    filenames that will be preserved when the clean_output_dir function in
    pelican.utils is run. Setting OUTPUT_RETENTION = (".hg", ".git") would,
    for example, prevent the relevant VCS data from being deleted when the
    output directory is cleaned.
    ---
     docs/settings.rst           |  3 +++
     pelican/__init__.py         |  3 ++-
     pelican/settings.py         |  1 +
     pelican/tests/test_utils.py |  9 ++++++---
     pelican/utils.py            | 11 +++++++----
     5 files changed, 19 insertions(+), 8 deletions(-)
    
    diff --git a/docs/settings.rst b/docs/settings.rst
    index ffcddc7a..97662cce 100644
    --- a/docs/settings.rst
    +++ b/docs/settings.rst
    @@ -72,6 +72,9 @@ Setting name (default value)                                            What doe
                                                                             generating new files. This can be useful in preventing older,
                                                                             unnecessary files from persisting in your output. However, **this is
                                                                             a destructive setting and should be handled with extreme care.**
    +`OUTPUT_RETENTION` (``()``)                                             A tuple of filenames that should be retained and not deleted from the
    +                                                                        output directory. One use case would be the preservation of version
    +                                                                        control data. For example: ``(".hg", ".git", ".bzr")``
     `JINJA_EXTENSIONS` (``[]``)                                             A list of any Jinja2 extensions you want to use.
     `JINJA_FILTERS` (``{}``)                                                A list of custom Jinja2 filters you want to use.
                                                                             The dictionary should map the filtername to the filter function.
    diff --git a/pelican/__init__.py b/pelican/__init__.py
    index 1739aae3..53216421 100644
    --- a/pelican/__init__.py
    +++ b/pelican/__init__.py
    @@ -49,6 +49,7 @@ class Pelican(object):
             self.markup = settings['MARKUP']
             self.ignore_files = settings['IGNORE_FILES']
             self.delete_outputdir = settings['DELETE_OUTPUT_DIRECTORY']
    +        self.output_retention = settings['OUTPUT_RETENTION']
     
             self.init_path()
             self.init_plugins()
    @@ -175,7 +176,7 @@ class Pelican(object):
             # explicitely asked
             if (self.delete_outputdir and not
                     os.path.realpath(self.path).startswith(self.output_path)):
    -            clean_output_dir(self.output_path)
    +            clean_output_dir(self.output_path, self.output_retention)
     
             writer = self.get_writer()
     
    diff --git a/pelican/settings.py b/pelican/settings.py
    index c6cc6c3c..1c9b48c3 100644
    --- a/pelican/settings.py
    +++ b/pelican/settings.py
    @@ -54,6 +54,7 @@ DEFAULT_CONFIG = {
         'NEWEST_FIRST_ARCHIVES': True,
         'REVERSE_CATEGORY_ORDER': False,
         'DELETE_OUTPUT_DIRECTORY': False,
    +    'OUTPUT_RETENTION': (),
         'ARTICLE_URL': '{slug}.html',
         'ARTICLE_SAVE_AS': '{slug}.html',
         'ARTICLE_LANG_URL': '{slug}-{lang}.html',
    diff --git a/pelican/tests/test_utils.py b/pelican/tests/test_utils.py
    index 0713e5ed..ab35d991 100644
    --- a/pelican/tests/test_utils.py
    +++ b/pelican/tests/test_utils.py
    @@ -193,28 +193,31 @@ class TestUtils(LoggedTestCase):
                 shutil.rmtree(empty_path, True)
     
         def test_clean_output_dir(self):
    +        retention = ()
             test_directory = os.path.join(os.path.dirname(__file__),
                                           'clean_output')
             content = os.path.join(os.path.dirname(__file__), 'content')
             shutil.copytree(content, test_directory)
    -        utils.clean_output_dir(test_directory)
    +        utils.clean_output_dir(test_directory, retention)
             self.assertTrue(os.path.isdir(test_directory))
             self.assertListEqual([], os.listdir(test_directory))
             shutil.rmtree(test_directory)
     
         def test_clean_output_dir_not_there(self):
    +        retention = ()
             test_directory = os.path.join(os.path.dirname(__file__),
                                           'does_not_exist')
    -        utils.clean_output_dir(test_directory)
    +        utils.clean_output_dir(test_directory, retention)
             self.assertFalse(os.path.exists(test_directory))
     
         def test_clean_output_dir_is_file(self):
    +        retention = ()
             test_directory = os.path.join(os.path.dirname(__file__),
                                           'this_is_a_file')
             f = open(test_directory, 'w')
             f.write('')
             f.close()
    -        utils.clean_output_dir(test_directory)
    +        utils.clean_output_dir(test_directory, retention)
             self.assertFalse(os.path.exists(test_directory))
     
         def test_strftime(self):
    diff --git a/pelican/utils.py b/pelican/utils.py
    index fea7b953..2c70ae8c 100644
    --- a/pelican/utils.py
    +++ b/pelican/utils.py
    @@ -298,8 +298,8 @@ def copy(path, source, destination, destination_path=None, overwrite=False):
             logger.warning('skipped copy %s to %s' % (source_, destination_))
     
     
    -def clean_output_dir(path):
    -    """Remove all the files from the output directory"""
    +def clean_output_dir(path, retention):
    +    """Remove all files from output directory except those in retention list"""
     
         if not os.path.exists(path):
             logger.debug("Directory already removed: %s" % path)
    @@ -312,10 +312,13 @@ def clean_output_dir(path):
                 logger.error("Unable to delete file %s; %s" % (path, str(e)))
             return
     
    -    # remove all the existing content from the output folder
    +    # remove existing content from output folder unless in retention list
         for filename in os.listdir(path):
             file = os.path.join(path, filename)
    -        if os.path.isdir(file):
    +        if any(filename == retain for retain in retention):
    +            logger.debug("Skipping deletion; %s is on retention list: %s" \
    +                         % (filename, file))
    +        elif os.path.isdir(file):
                 try:
                     shutil.rmtree(file)
                     logger.debug("Deleted directory %s" % file)
    
    From 7d37cfa7485e3a8cb1f8e0ac6001be66fb553bbc Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Tue, 25 Jun 2013 19:17:40 -0700
    Subject: [PATCH 0526/1975] Missing -s flag added to command on tips doc page
    
    ---
     docs/tips.rst | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/docs/tips.rst b/docs/tips.rst
    index 64695db0..e29f73d2 100644
    --- a/docs/tips.rst
    +++ b/docs/tips.rst
    @@ -26,7 +26,7 @@ For example, if the sources of your Pelican site are contained in a GitHub
     repository, and if you want to publish your Pelican site as Project Pages of
     this repository, you can then use the following::
     
    -    $ pelican content -o output pelicanconf.py
    +    $ pelican content -o output -s pelicanconf.py
         $ ghp-import output
         $ git push origin gh-pages
     
    
    From 12fd53c27e133ed4e79c2f5a85ea8fb038c23b12 Mon Sep 17 00:00:00 2001
    From: bas smit 
    Date: Wed, 26 Jun 2013 13:25:20 +0200
    Subject: [PATCH 0527/1975] Add debug target to the template makefile
    
    If the DEBUG variable is set (e.g. DEBUG=1 make target) debugging will
    be enabled by using pelicans -D flag.
    ---
     pelican/tools/templates/Makefile.in | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
    index 221568aa..fd553550 100644
    --- a/pelican/tools/templates/Makefile.in
    +++ b/pelican/tools/templates/Makefile.in
    @@ -20,6 +20,11 @@ S3_BUCKET=$s3_bucket
     
     DROPBOX_DIR=$dropbox_dir
     
    +DEBUG ?= 0
    +ifeq ($(DEBUG), 1)
    +	PELICANOPTS += -D
    +endif 
    +
     help:
     	@echo 'Makefile for a pelican Web site                                        '
     	@echo '                                                                       '
    
    From 0d63b4520a302d5fb8e249c1d98c0043c566315b Mon Sep 17 00:00:00 2001
    From: bas smit 
    Date: Wed, 26 Jun 2013 13:58:35 +0200
    Subject: [PATCH 0528/1975] Add info about debugging to the help output of the
     makefile
    
    ---
     pelican/tools/templates/Makefile.in | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in
    index fd553550..80cf4737 100644
    --- a/pelican/tools/templates/Makefile.in
    +++ b/pelican/tools/templates/Makefile.in
    @@ -43,7 +43,8 @@ help:
     	@echo '   s3_upload                        upload the web site via S3         '
     	@echo '   github                           upload the web site via gh-pages   '
     	@echo '                                                                       '
    -
    +	@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
    +	@echo '                                                                       '
     
     html: clean $$(OUTPUTDIR)/index.html
     
    
    From 5d000ca2904e84c12c255a7b930fc9c38639c580 Mon Sep 17 00:00:00 2001
    From: Justin Mayer 
    Date: Wed, 26 Jun 2013 06:39:09 -0700
    Subject: [PATCH 0529/1975] Add more missing -s flags to tips doc page
    
    ---
     docs/tips.rst | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/docs/tips.rst b/docs/tips.rst
    index e29f73d2..430d6488 100644
    --- a/docs/tips.rst
    +++ b/docs/tips.rst
    @@ -49,7 +49,7 @@ To publish a Pelican site as User Pages you need to *push* the content of the
     
     Again, you can take advantage of ``ghp-import``::
     
    -    $ pelican content -o output pelicanconf.py
    +    $ pelican content -o output -s pelicanconf.py
         $ ghp-import output
         $ git push git@github.com:elemoine/elemoine.github.com.git gh-pages:master
     
    @@ -71,7 +71,7 @@ To automatically update your Pelican site on each commit you can create
     a post-commit hook. For example, you can add the following to
     ``.git/hooks/post-commit``::
     
    -    pelican pelican content -o output pelicanconf.py && ghp-import output && git push origin gh-pages
    +    pelican pelican content -o output -s pelicanconf.py && ghp-import output && git push origin gh-pages
     
     Tip #2:
     
    
    From 931d57160602db2b12d06d4c2a2124504addbd93 Mon Sep 17 00:00:00 2001
    From: Danilo Bargen 
    Date: Fri, 28 Jun 2013 00:53:26 +0200
    Subject: [PATCH 0530/1975] More explicit settings docs concerning list
     templates
    
    I think the author list and tag list are so common that they should be
    listed explicitly in the settings.
    ---
     docs/settings.rst | 8 ++++++--
     1 file changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/docs/settings.rst b/docs/settings.rst
    index 97662cce..1444e174 100644
    --- a/docs/settings.rst
    +++ b/docs/settings.rst
    @@ -237,12 +237,16 @@ Setting name (default value)                            What does it do?
                                                             use the default language.
     `PAGE_LANG_SAVE_AS` (``'pages/{slug}-{lang}.html'``)    The location we will save the page which doesn't
                                                             use the default language.
    -`AUTHOR_URL` (``'author/{slug}.html'``)                 The URL to use for an author.
    -`AUTHOR_SAVE_AS` (``'author/{slug}.html'``)             The location to save an author.
     `CATEGORY_URL` (``'category/{slug}.html'``)             The URL to use for a category.
     `CATEGORY_SAVE_AS` (``'category/{slug}.html'``)         The location to save a category.
     `TAG_URL` (``'tag/{slug}.html'``)                       The URL to use for a tag.
     `TAG_SAVE_AS` (``'tag/{slug}.html'``)                   The location to save the tag page.
    +`TAGS_URL` (``'tag/{slug}.html'``)                      The URL to use for the tag list.
    +`TAGS_SAVE_AS` (``'tags.html'``)                        The location to save the tag list.
    +`AUTHOR_URL` (``'author/{slug}.html'``)                 The URL to use for an author.
    +`AUTHOR_SAVE_AS` (``'author/{slug}.html'``)             The location to save an author.
    +`AUTHORS_URL` (``'authors.html'``)                      The URL to use for the author list.
    +`AUTHORS_SAVE_AS` (``'authors.html'``)                  The location to save the author list.
     `_SAVE_AS`                        The location to save content generated from direct
                                                             templates. Where  is the
                                                             upper case template name.
    
    From 298151237e9f418aabcf4d70333dc3550a519914 Mon Sep 17 00:00:00 2001
    From: Andrew Ma 
    Date: Wed, 3 Jul 2013 22:36:52 -0700
    Subject: [PATCH 0531/1975] Adding stackoverflow to social icons
    
    ---
     pelican/themes/notmyidea/static/css/main.css      |   1 +
     .../static/images/icons/stackoverflow.png         | Bin 0 -> 916 bytes
     2 files changed, 1 insertion(+)
     create mode 100644 pelican/themes/notmyidea/static/images/icons/stackoverflow.png
    
    diff --git a/pelican/themes/notmyidea/static/css/main.css b/pelican/themes/notmyidea/static/css/main.css
    index 7f4ca363..fa0bcf1c 100644
    --- a/pelican/themes/notmyidea/static/css/main.css
    +++ b/pelican/themes/notmyidea/static/css/main.css
    @@ -326,6 +326,7 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;}
     		.social a[type$='atom+xml'], .social a[type$='rss+xml'] {background-image: url('../images/icons/rss.png');}
     		.social a[href*='slideshare.net'] {background-image: url('../images/icons/slideshare.png');}
     		.social a[href*='speakerdeck.com'] {background-image: url('../images/icons/speakerdeck.png');}
    +		.social a[href*='stackoverflow.com'] {background-image: url('../images/icons/stackoverflow.png');}
     		.social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');}
     		.social a[href*='vimeo.com'] {background-image: url('../images/icons/vimeo.png');}
     		.social a[href*='youtube.com'] {background-image: url('../images/icons/youtube.png');}
    diff --git a/pelican/themes/notmyidea/static/images/icons/stackoverflow.png b/pelican/themes/notmyidea/static/images/icons/stackoverflow.png
    new file mode 100644
    index 0000000000000000000000000000000000000000..f5b65e9990dbf423ff652b297f1d0172c8c1cf27
    GIT binary patch
    literal 916
    zcmeAS@N?(olHy`uVBq!ia0vp^0w65F1|7sn8f<3~fRJ+vJ~_8MEyP6_>_pwTJhc%)&)Mu9Ed(YG|jmTlZ9
    z@KIPeZ^FK^-?9GB|W>{Q7m)EC+@8;a3mYxk}1?tCE&x6kxKjd-nU)D+_Cb1MZtP
    zf6ioHdF7Ur;v^T%WC`(qYnHY?KFysk()nSxK=;)vJ-w30K5t&s)3ykMV9;LODnQ81ohPJtCw>uw6%3rniLY9y-{G%>&K7poH)Ybf9hcZ
    zPx7%K&0{68BG<3+JpQ`j393DPNr7J)G`t`kgi;Fv5%&IGQ?s!oY8v6HF>egkKm6gM^6?fU09+hB7{`$2g
    z!Dr>|-0l5+On2^2_f4p`m-+THD#}N=VM2Fz(!8K!0$xisQhfv_dG-h{GMTvHCdbLN
    z^XFvvX21P9HE8+fMNXk>uPs~lGBfn^9g#*-%#3?x$4
    ze30#20|W~;m8*zxxBvb3Dl3rX#Piv+IUi
    Date: Fri, 28 Jun 2013 15:09:36 -0700
    Subject: [PATCH 0532/1975] Updating unit tests
    
    ---
     pelican/tests/output/basic/theme/css/main.css     |   1 +
     .../basic/theme/images/icons/stackoverflow.png    | Bin 0 -> 916 bytes
     pelican/tests/output/custom/theme/css/main.css    |   1 +
     .../custom/theme/images/icons/stackoverflow.png   | Bin 0 -> 916 bytes
     4 files changed, 2 insertions(+)
     create mode 100644 pelican/tests/output/basic/theme/images/icons/stackoverflow.png
     create mode 100644 pelican/tests/output/custom/theme/images/icons/stackoverflow.png
    
    diff --git a/pelican/tests/output/basic/theme/css/main.css b/pelican/tests/output/basic/theme/css/main.css
    index 7f4ca363..fa0bcf1c 100644
    --- a/pelican/tests/output/basic/theme/css/main.css
    +++ b/pelican/tests/output/basic/theme/css/main.css
    @@ -326,6 +326,7 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;}
     		.social a[type$='atom+xml'], .social a[type$='rss+xml'] {background-image: url('../images/icons/rss.png');}
     		.social a[href*='slideshare.net'] {background-image: url('../images/icons/slideshare.png');}
     		.social a[href*='speakerdeck.com'] {background-image: url('../images/icons/speakerdeck.png');}
    +		.social a[href*='stackoverflow.com'] {background-image: url('../images/icons/stackoverflow.png');}
     		.social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');}
     		.social a[href*='vimeo.com'] {background-image: url('../images/icons/vimeo.png');}
     		.social a[href*='youtube.com'] {background-image: url('../images/icons/youtube.png');}
    diff --git a/pelican/tests/output/basic/theme/images/icons/stackoverflow.png b/pelican/tests/output/basic/theme/images/icons/stackoverflow.png
    new file mode 100644
    index 0000000000000000000000000000000000000000..f5b65e9990dbf423ff652b297f1d0172c8c1cf27
    GIT binary patch
    literal 916
    zcmeAS@N?(olHy`uVBq!ia0vp^0w65F1|7sn8f<3~fRJ+vJ~_8MEyP6_>_pwTJhc%)&)Mu9Ed(YG|jmTlZ9
    z@KIPeZ^FK^-?9GB|W>{Q7m)EC+@8;a3mYxk}1?tCE&x6kxKjd-nU)D+_Cb1MZtP
    zf6ioHdF7Ur;v^T%WC`(qYnHY?KFysk()nSxK=;)vJ-w30K5t&s)3ykMV9;LODnQ81ohPJtCw>uw6%3rniLY9y-{G%>&K7poH)Ybf9hcZ
    zPx7%K&0{68BG<3+JpQ`j393DPNr7J)G`t`kgi;Fv5%&IGQ?s!oY8v6HF>egkKm6gM^6?fU09+hB7{`$2g
    z!Dr>|-0l5+On2^2_f4p`m-+THD#}N=VM2Fz(!8K!0$xisQhfv_dG-h{GMTvHCdbLN
    z^XFvvX21P9HE8+fMNXk>uPs~lGBfn^9g#*-%#3?x$4
    ze30#20|W~;m8*zxxBvb3Dl3rX#Piv+IUi7sn8f<3~fRJ+vJ~_8MEyP6_>_pwTJhc%)&)Mu9Ed(YG|jmTlZ9
    z@KIPeZ^FK^-?9GB|W>{Q7m)EC+@8;a3mYxk}1?tCE&x6kxKjd-nU)D+_Cb1MZtP
    zf6ioHdF7Ur;v^T%WC`(qYnHY?KFysk()nSxK=;)vJ-w30K5t&s)3ykMV9;LODnQ81ohPJtCw>uw6%3rniLY9y-{G%>&K7poH)Ybf9hcZ
    zPx7%K&0{68BG<3+JpQ`j393DPNr7J)G`t`kgi;Fv5%&IGQ?s!oY8v6HF>egkKm6gM^6?fU09+hB7{`$2g
    z!Dr>|-0l5+On2^2_f4p`m-+THD#}N=VM2Fz(!8K!0$xisQhfv_dG-h{GMTvHCdbLN
    z^XFvvX21P9HE8+fMNXk>uPs~lGBfn^9g#*-%#3?x$4
    ze30#20|W~;m8*zxxBvb3Dl3rX#Piv+IUi
    Date: Fri, 28 Jun 2013 19:59:00 -0700
    Subject: [PATCH 0533/1975] Document how to stop generation of certain pages
    
    The documentation doesn't make it very clear how to prevent certain
    pages from being generated, such as the Authors, Tags, and Categories
    collection pages. This change makes it slightly more obvious how to
    prevent these pages from being generated. Fixes #940.
    ---
     docs/settings.rst | 10 +++++++---
     1 file changed, 7 insertions(+), 3 deletions(-)
    
    diff --git a/docs/settings.rst b/docs/settings.rst
    index 1444e174..78a0ddf7 100644
    --- a/docs/settings.rst
    +++ b/docs/settings.rst
    @@ -138,8 +138,9 @@ Setting name (default value)                                            What doe
                                                                             library, which can be installed via: ``pip install typogrify``
     `DIRECT_TEMPLATES` (``('index', 'tags', 'categories', 'archives')``)    List of templates that are used directly to render
                                                                             content. Typically direct templates are used to generate
    -                                                                        index pages for collections of content (e.g. tags and
    -                                                                        category index pages).
    +                                                                        index pages for collections of content (e.g., tags and
    +                                                                        category index pages). If the tag and category collections
    +                                                                        are not needed, set ``DIRECT_TEMPLATES = ('index', 'archives')``
     `PAGINATED_DIRECT_TEMPLATES` (``('index',)``)                           Provides the direct templates that should be paginated.
     `SUMMARY_MAX_LENGTH` (``50``)                                           When creating a short summary of an article, this will
                                                                             be the default length in words of the text created.
    @@ -261,7 +262,10 @@ Setting name (default value)                            What does it do?
     
     .. note::
     
    -    When any of the `*_SAVE_AS` settings is set to False, files will not be created.
    +    If you do not want one or more of the default pages to be created (e.g.,
    +    you are the only author on your site and thus do not need an Authors page),
    +    set the corresponding ``*_SAVE_AS`` setting to ``False`` to prevent the
    +    relevant page from being generated.
     
     Timezone
     --------
    
    From 39518e15efc6535ef654b0e9e526239db62d7ac8 Mon Sep 17 00:00:00 2001
    From: Andy Pearce 
    Date: Fri, 14 Jun 2013 15:54:06 +0100
    Subject: [PATCH 0534/1975] Allow text substitutions when generating slugs
    
    The `slugify()` function used by Pelican is in general very good at
    coming up with something both readable and URL-safe. However, there are
    a few specific cases where it causes conflicts. One that I've run into
    is using the strings `C++` and `C` as tags, both of which transform to
    the slug `c`. This commit adds an optional `SLUG_SUBSTITUTIONS` setting
    which is a list of 2-tuples of substitutions to be carried out
    case-insensitively just prior to stripping out non-alphanumeric
    characters. This allows cases like `C++` to be transformed to `CPP` or
    similar. This can also improve the readability of slugs.
    ---
     docs/settings.rst           |  4 ++++
     pelican/contents.py         |  3 ++-
     pelican/settings.py         |  1 +
     pelican/tests/test_utils.py | 11 +++++++++++
     pelican/urlwrappers.py      | 11 ++++++-----
     pelican/utils.py            |  8 +++++---
     6 files changed, 29 insertions(+), 9 deletions(-)
    
    diff --git a/docs/settings.rst b/docs/settings.rst
    index 78a0ddf7..61ccc2b2 100644
    --- a/docs/settings.rst
    +++ b/docs/settings.rst
    @@ -258,6 +258,10 @@ Setting name (default value)                            What does it do?
                                                             posts.
     `DAY_ARCHIVE_SAVE_AS` (False)                           The location to save per-day archives of your
                                                             posts.
    +`SLUG_SUBSTITUTIONS`  (``()``)                          Substitutions to make prior to stripping out
    +                                                        non-alphanumerics when generating slugs. Specified
    +                                                        as a list of 2-tuples of ``(from, to)`` which are
    +                                                        applied in order.
     ====================================================    =====================================================
     
     .. note::
    diff --git a/pelican/contents.py b/pelican/contents.py
    index 1b604f19..d56335dd 100644
    --- a/pelican/contents.py
    +++ b/pelican/contents.py
    @@ -86,7 +86,8 @@ class Content(object):
     
             # create the slug if not existing, from the title
             if not hasattr(self, 'slug') and hasattr(self, 'title'):
    -            self.slug = slugify(self.title)
    +            self.slug = slugify(self.title,
    +                                settings.get('SLUG_SUBSTITUTIONS', ()))
     
             self.source_path = source_path
     
    diff --git a/pelican/settings.py b/pelican/settings.py
    index 1c9b48c3..01203504 100644
    --- a/pelican/settings.py
    +++ b/pelican/settings.py
    @@ -105,6 +105,7 @@ DEFAULT_CONFIG = {
         'PLUGINS': [],
         'TEMPLATE_PAGES': {},
         'IGNORE_FILES': ['.#*'],
    +    'SLUG_SUBSTITUTIONS': (),
         }
     
     def read_settings(path=None, override=None):
    diff --git a/pelican/tests/test_utils.py b/pelican/tests/test_utils.py
    index ab35d991..0e65003a 100644
    --- a/pelican/tests/test_utils.py
    +++ b/pelican/tests/test_utils.py
    @@ -94,6 +94,17 @@ class TestUtils(LoggedTestCase):
             for value, expected in samples:
                 self.assertEqual(utils.slugify(value), expected)
     
    +    def test_slugify_substitute(self):
    +
    +        samples = (('C++ is based on C', 'cpp-is-based-on-c'),
    +                   ('C+++ test C+ test', 'cpp-test-c-test'),
    +                   ('c++, c#, C#, C++', 'cpp-c-sharp-c-sharp-cpp'),
    +                   ('c++-streams', 'cpp-streams'),)
    +
    +        subs = (('C++', 'CPP'), ('C#', 'C-SHARP'))
    +        for value, expected in samples:
    +            self.assertEqual(utils.slugify(value, subs), expected)
    +
         def test_get_relative_path(self):
     
             samples = ((os.path.join('test', 'test.html'), os.pardir),
    diff --git a/pelican/urlwrappers.py b/pelican/urlwrappers.py
    index b0df61ad..acb8e07d 100644
    --- a/pelican/urlwrappers.py
    +++ b/pelican/urlwrappers.py
    @@ -15,10 +15,10 @@ class URLWrapper(object):
         def __init__(self, name, settings):
             # next 2 lines are redundant with the setter of the name property
             # but are here for clarity
    -        self._name = name
    -        self.slug = slugify(name)
    -        self.name = name
             self.settings = settings
    +        self._name = name
    +        self.slug = slugify(name, self.settings.get('SLUG_SUBSTITUTIONS', ()))
    +        self.name = name
     
         @property
         def name(self):
    @@ -27,7 +27,7 @@ class URLWrapper(object):
         @name.setter
         def name(self, name):
             self._name = name
    -        self.slug = slugify(name)
    +        self.slug = slugify(name, self.settings.get('SLUG_SUBSTITUTIONS', ()))
     
         def as_dict(self):
             d = self.__dict__
    @@ -41,7 +41,8 @@ class URLWrapper(object):
             return self.slug
     
         def _normalize_key(self, key):
    -        return six.text_type(slugify(key))
    +        subs = self.settings.get('SLUG_SUBSTITUTIONS', ())
    +        return six.text_type(slugify(key, subs))
     
         def __eq__(self, other):
             return self._key() == self._normalize_key(other)
    diff --git a/pelican/utils.py b/pelican/utils.py
    index 2c70ae8c..b1524036 100644
    --- a/pelican/utils.py
    +++ b/pelican/utils.py
    @@ -231,7 +231,7 @@ class pelican_open(object):
             pass
     
     
    -def slugify(value):
    +def slugify(value, substitutions=()):
         """
         Normalizes string, converts to lowercase, removes non-alpha characters,
         and converts spaces to hyphens.
    @@ -249,8 +249,10 @@ def slugify(value):
         if isinstance(value, six.binary_type):
             value = value.decode('ascii')
         # still unicode
    -    value = unicodedata.normalize('NFKD', value)
    -    value = re.sub('[^\w\s-]', '', value).strip().lower()
    +    value = unicodedata.normalize('NFKD', value).lower()
    +    for src, dst in substitutions:
    +        value = value.replace(src.lower(), dst.lower())
    +    value = re.sub('[^\w\s-]', '', value).strip()
         value = re.sub('[-\s]+', '-', value)
         # we want only ASCII chars
         value = value.encode('ascii', 'ignore')
    
    From 3da4c2e13e4146e1d0a58fd0e7267bb4ad957881 Mon Sep 17 00:00:00 2001
    From: Stefan hr Berder 
    Date: Sun, 7 Jul 2013 12:44:21 +0200
    Subject: [PATCH 0535/1975] add port option to pelican.server
    
    ---
     pelican/server.py | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/pelican/server.py b/pelican/server.py
    index fd99b209..24f3ae04 100644
    --- a/pelican/server.py
    +++ b/pelican/server.py
    @@ -10,7 +10,7 @@ try:
     except ImportError:
         import socketserver  # NOQA
     
    -PORT = 8000
    +PORT = len(sys.argv) == 2 and int(sys.argv[1]) or 8000
     
     Handler = srvmod.SimpleHTTPRequestHandler
     
    @@ -26,4 +26,4 @@ try:
         httpd.serve_forever()
     except KeyboardInterrupt as e:
         print("shutting down server")
    -    httpd.socket.close()
    \ No newline at end of file
    +    httpd.socket.close()
    
    From 00a1cbb6b84d9faad2d7dde01b068ff113b0184e Mon Sep 17 00:00:00 2001
    From: Lingzhu Xiang 
    Date: Sat, 4 May 2013 06:13:11 +0800
    Subject: [PATCH 0536/1975] Support importing Tumblr
    
    Try to integrate Tumblr's various post types without using
    additonal templates.
    ---
     docs/importer.rst               | 14 ++++--
     pelican/tools/pelican_import.py | 88 ++++++++++++++++++++++++++++++++-
     2 files changed, 98 insertions(+), 4 deletions(-)
    
    diff --git a/docs/importer.rst b/docs/importer.rst
    index 9a0c513e..057fecd8 100644
    --- a/docs/importer.rst
    +++ b/docs/importer.rst
    @@ -14,6 +14,7 @@ software to reStructuredText or Markdown. The supported import formats are:
     - WordPress XML export
     - Dotclear export
     - Posterous API
    +- Tumblr API
     - RSS/Atom feed
     
     The conversion from HTML to reStructuredText or Markdown relies on `Pandoc`_.
    @@ -41,16 +42,17 @@ Usage
     
     ::
     
    -    pelican-import [-h] [--wpfile] [--dotclear] [--posterous] [--feed] [-o OUTPUT]
    +    pelican-import [-h] [--wpfile] [--dotclear] [--posterous] [--tumblr] [--feed] [-o OUTPUT]
                        [-m MARKUP] [--dir-cat] [--dir-page] [--strip-raw] [--disable-slugs]
    -                   [-e EMAIL] [-p PASSWORD]
    -                   input|api_token
    +                   [-e EMAIL] [-p PASSWORD] [-b BLOGNAME]
    +                   input|api_token|api_key
     
     Positional arguments
     --------------------
     
       input                 The input file to read
       api_token             [Posterous only] api_token can be obtained from http://posterous.com/api/
    +  api_key               [Tumblr only] api_key can be obtained from http://www.tumblr.com/oauth/apps
     
     Optional arguments
     ------------------
    @@ -59,6 +61,7 @@ Optional arguments
       --wpfile              WordPress XML export (default: False)
       --dotclear            Dotclear export (default: False)
       --posterous           Posterous API (default: False)
    +  --tumblr              Tumblr API (default: False)
       --feed                Feed to parse (default: False)
       -o OUTPUT, --output OUTPUT
                             Output path (default: output)
    @@ -80,6 +83,8 @@ Optional arguments
                             Email used to authenticate Posterous API
       -p PASSWORD, --password=PASSWORD
                             Password used to authenticate Posterous API
    +  -b BLOGNAME, --blogname=BLOGNAME
    +                        Blog name used in Tumblr API
     
     
     Examples
    @@ -97,6 +102,9 @@ for Posterous::
     
         $ pelican-import --posterous -o ~/output --email= --password= 
     
    +For Tumblr::
    +
    +    $ pelican-import --tumblr -o ~/output --blogname= 
     
     Tests
     =====
    diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py
    index 630142e7..5f637c73 100755
    --- a/pelican/tools/pelican_import.py
    +++ b/pelican/tools/pelican_import.py
    @@ -326,6 +326,84 @@ def posterous2fields(api_token, email, password):
                 yield (post.get('title'), post.get('body_cleaned'), slug, date,
                     post.get('user').get('display_name'), [], tags, kind, "html")
     
    +
    +def tumblr2fields(api_key, blogname):
    +    """ Imports Tumblr posts (API v2)"""
    +    from time import strftime, localtime
    +    try:
    +        # py3k import
    +        import json
    +    except ImportError:
    +        # py2 import
    +        import simplejson as json
    +
    +    try:
    +        # py3k import
    +        import urllib.request as urllib_request
    +    except ImportError:
    +        # py2 import
    +        import urllib2 as urllib_request
    +
    +    def get_tumblr_posts(api_key, blogname, offset=0):
    +        url = "http://api.tumblr.com/v2/blog/%s.tumblr.com/posts?api_key=%s&offset=%d&filter=raw" % (blogname, api_key, offset)
    +        request = urllib_request.Request(url)
    +        handle = urllib_request.urlopen(request)
    +        posts = json.loads(handle.read().decode('utf-8'))
    +        return posts.get('response').get('posts')
    +
    +    offset = 0
    +    posts = get_tumblr_posts(api_key, blogname, offset)
    +    while len(posts) > 0:
    +        for post in posts:
    +            title = post.get('title') or post.get('source_title')
    +            slug = post.get('slug') or slugify(title)
    +            tags = post.get('tags')
    +            timestamp = post.get('timestamp')
    +            date = strftime("%Y-%m-%d %H:%M:%S", localtime(int(timestamp)))
    +            slug = strftime("%Y-%m-%d-", localtime(int(timestamp))) + slug
    +            format = post.get('format')
    +            content = post.get('body')
    +            type = post.get('type')
    +            if type == 'photo':
    +                if format == 'markdown':
    +                    fmtstr = '![%s](%s)'
    +                else:
    +                    fmtstr = '%s'
    +                content = '\n'.join(fmtstr % (photo.get('caption'), photo.get('original_size').get('url')) for photo in post.get('photos'))
    +            elif type == 'quote':
    +                if format == 'markdown':
    +                    fmtstr = '\n\n— %s'
    +                else:
    +                    fmtstr = '

    — %s

    ' + content = post.get('text') + fmtstr % post.get('source') + elif type == 'link': + if format == 'markdown': + fmtstr = '[via](%s)\n\n' + else: + fmtstr = '

    via

    \n' + content = fmtstr % post.get('url') + post.get('description') + elif type == 'audio': + if format == 'markdown': + fmtstr = '[via](%s)\n\n' + else: + fmtstr = '

    via

    \n' + content = fmtstr % post.get('source_url') + post.get('caption') + post.get('player') + elif type == 'video': + if format == 'markdown': + fmtstr = '[via](%s)\n\n' + else: + fmtstr = '

    via

    \n' + content = fmtstr % post.get('source_url') + post.get('caption') + '\n'.join(player.get('embed_code') for player in post.get('player')) + elif type == 'answer': + title = post.get('question') + content = '

    %s: %s

    \n%s' % (post.get('asking_name'), post.get('asking_url'), post.get('question'), post.get('answer')) + + yield (title, content, slug, date, post.get('blog_name'), [type], tags, format) + + offset += len(posts) + posts = get_tumblr_posts(api_key, blogname, offset) + + def feed2fields(file): """Read a feed and yield pelican fields""" import feedparser @@ -476,6 +554,8 @@ def main(): help='Dotclear export') parser.add_argument('--posterous', action='store_true', dest='posterous', help='Posterous export') + parser.add_argument('--tumblr', action='store_true', dest='tumblr', + help='Tumblr export') parser.add_argument('--feed', action='store_true', dest='feed', help='Feed to parse') parser.add_argument('-o', '--output', dest='output', default='output', @@ -499,6 +579,8 @@ def main(): help="Email address (posterous import only)") parser.add_argument('-p', '--password', dest='password', help="Password (posterous import only)") + parser.add_argument('-b', '--blogname', dest='blogname', + help="Blog name (Tumblr import only)") args = parser.parse_args() @@ -509,10 +591,12 @@ def main(): input_type = 'dotclear' elif args.posterous: input_type = 'posterous' + elif args.tumblr: + input_type = 'tumblr' elif args.feed: input_type = 'feed' else: - error = "You must provide either --wpfile, --dotclear, --posterous or --feed options" + error = "You must provide either --wpfile, --dotclear, --posterous, --tumblr or --feed options" exit(error) if not os.path.exists(args.output): @@ -528,6 +612,8 @@ def main(): fields = dc2fields(args.input) elif input_type == 'posterous': fields = posterous2fields(args.input, args.email, args.password) + elif input_type == 'tumblr': + fields = tumblr2fields(args.input, args.blogname) elif input_type == 'feed': fields = feed2fields(args.input) From 75263fa852fae5ed6e591c18fe1afad8fe5a7b0f Mon Sep 17 00:00:00 2001 From: Lingzhu Xiang Date: Sun, 5 May 2013 02:09:24 +0800 Subject: [PATCH 0537/1975] Fix importing Tumblr photo caption Besides each photo's caption, the general caption is also needed. While we're at it, also add a linefeed at the end of file. --- pelican/tools/pelican_import.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 5f637c73..3c40dd56 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -370,6 +370,7 @@ def tumblr2fields(api_key, blogname): else: fmtstr = '%s' content = '\n'.join(fmtstr % (photo.get('caption'), photo.get('original_size').get('url')) for photo in post.get('photos')) + content += '\n\n' + post.get('caption') elif type == 'quote': if format == 'markdown': fmtstr = '\n\n— %s' @@ -398,6 +399,8 @@ def tumblr2fields(api_key, blogname): title = post.get('question') content = '

    %s: %s

    \n%s' % (post.get('asking_name'), post.get('asking_url'), post.get('question'), post.get('answer')) + content = content.rstrip() + '\n' + yield (title, content, slug, date, post.get('blog_name'), [type], tags, format) offset += len(posts) From 241ac2400a33d6ad804012ae11b36a38e223476f Mon Sep 17 00:00:00 2001 From: Lingzhu Xiang Date: Sun, 5 May 2013 22:53:21 +0800 Subject: [PATCH 0538/1975] Use better titles than None for Tumblr posts without title --- pelican/tools/pelican_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 3c40dd56..3b5c55f2 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -355,7 +355,7 @@ def tumblr2fields(api_key, blogname): posts = get_tumblr_posts(api_key, blogname, offset) while len(posts) > 0: for post in posts: - title = post.get('title') or post.get('source_title') + title = post.get('title') or post.get('source_title') or post.get('type').capitalize() slug = post.get('slug') or slugify(title) tags = post.get('tags') timestamp = post.get('timestamp') From 3a5db543bb8fa385ac10347d81d98778959619bc Mon Sep 17 00:00:00 2001 From: Stefan hr Berder Date: Sun, 7 Jul 2013 13:27:50 +0200 Subject: [PATCH 0539/1975] add port parameter to bash script --- pelican/tools/templates/develop_server.sh.in | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pelican/tools/templates/develop_server.sh.in b/pelican/tools/templates/develop_server.sh.in index 6dd11e6d..16b61518 100755 --- a/pelican/tools/templates/develop_server.sh.in +++ b/pelican/tools/templates/develop_server.sh.in @@ -18,7 +18,7 @@ SRV_PID=$$BASEDIR/srv.pid PELICAN_PID=$$BASEDIR/pelican.pid function usage(){ - echo "usage: $$0 (stop) (start) (restart)" + echo "usage: $$0 (stop) (start) (restart) [port]" echo "This starts pelican in debug and reload mode and then launches" echo "A pelican.server to help site development. It doesn't read" echo "your pelican options so you edit any paths in your Makefile" @@ -59,13 +59,14 @@ function shut_down(){ } function start_up(){ + local port=$$1 echo "Starting up Pelican and pelican.server" shift $$PELICAN --debug --autoreload -r $$INPUTDIR -o $$OUTPUTDIR -s $$CONFFILE $$PELICANOPTS & pelican_pid=$$! echo $$pelican_pid > $$PELICAN_PID cd $$OUTPUTDIR - $PY -m pelican.server & + $PY -m pelican.server $$port & srv_pid=$$! echo $$srv_pid > $$SRV_PID cd $$BASEDIR @@ -83,15 +84,18 @@ function start_up(){ ### # MAIN ### -[[ $$# -ne 1 ]] && usage +[[ ($$# -eq 0) || ($$# -gt 2) ]] && usage +port='' +[[ $$# -eq 2 ]] && port=$$2 + if [[ $$1 == "stop" ]]; then shut_down elif [[ $$1 == "restart" ]]; then shut_down - start_up + start_up $$port elif [[ $$1 == "start" ]]; then - if ! start_up; then - shut_down + if ! start_up $$port; then + shut_down fi else usage From 689632835eb2119c2f822456dee6c11def11ced5 Mon Sep 17 00:00:00 2001 From: Stefan hr Berder Date: Sun, 7 Jul 2013 14:28:15 +0200 Subject: [PATCH 0540/1975] add port option to Makefile target serve/devserver --- pelican/tools/templates/Makefile.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 4bc764ca..f2e0ccc9 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -28,8 +28,8 @@ help: @echo ' make clean remove the generated files ' @echo ' make regenerate regenerate files upon modification ' @echo ' make publish generate using production settings ' - @echo ' make serve serve site at http://localhost:8000' - @echo ' make devserver start/restart develop_server.sh ' + @echo ' make serve [PORT=8000] serve site at http://localhost:8000' + @echo ' make devserver [PORT=8000] start/restart develop_server.sh ' @echo ' make stopserver stop local server ' @echo ' ssh_upload upload the web site via SSH ' @echo ' rsync_upload upload the web site via rsync+ssh ' @@ -50,10 +50,18 @@ regenerate: $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) serve: +ifdef PORT + cd $$(OUTPUTDIR) && $(PY) -m pelican.server $$(PORT) +else cd $$(OUTPUTDIR) && $(PY) -m pelican.server +endif devserver: +ifdef PORT + $$(BASEDIR)/develop_server.sh restart $$(PORT) +else $$(BASEDIR)/develop_server.sh restart +endif stopserver: kill -9 `cat pelican.pid` From cb650c1c992a92c25040387d77ecc774e6f5a4ac Mon Sep 17 00:00:00 2001 From: Benjamin Port Date: Thu, 9 May 2013 05:06:12 +0200 Subject: [PATCH 0541/1975] Add filter-author option to importer Allow to import post from only one author when importing data --- docs/importer.rst | 1 + pelican/tools/pelican_import.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/importer.rst b/docs/importer.rst index 9a0c513e..228471da 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -69,6 +69,7 @@ Optional arguments (default: False) --dir-page Put files recognised as pages in "pages/" sub- directory (wordpress import only) (default: False) + --filter-author Import only post from the specified author. --strip-raw Strip raw HTML code that can't be converted to markup such as flash embeds or iframes (wordpress import only) (default: False) diff --git a/pelican/tools/pelican_import.py b/pelican/tools/pelican_import.py index 630142e7..59b767f9 100755 --- a/pelican/tools/pelican_import.py +++ b/pelican/tools/pelican_import.py @@ -376,9 +376,11 @@ def build_markdown_header(title, date, author, categories, tags, slug): def fields2pelican(fields, out_markup, output_path, dircat=False, strip_raw=False, disable_slugs=False, - dirpage=False, filename_template=None): + dirpage=False, filename_template=None, filter_author=None): for (title, content, filename, date, author, categories, tags, kind, in_markup) in fields: + if filter_author and filter_author != author: + continue slug = not disable_slugs and filename or None if (in_markup == "markdown") or (out_markup == "markdown") : ext = '.md' @@ -487,6 +489,8 @@ def main(): parser.add_argument('--dir-page', action='store_true', dest='dirpage', help=('Put files recognised as pages in "pages/" sub-directory' ' (wordpress import only)')) + parser.add_argument('--filter-author', dest='author', + help='Import only post from the specified author') parser.add_argument('--strip-raw', action='store_true', dest='strip_raw', help="Strip raw HTML code that can't be converted to " "markup such as flash embeds or iframes (wordpress import only)") @@ -537,4 +541,5 @@ def main(): dircat=args.dircat or False, dirpage=args.dirpage or False, strip_raw=args.strip_raw or False, - disable_slugs=args.disable_slugs or False) + disable_slugs=args.disable_slugs or False, + filter_author=args.author) From 6c5444eb6833cda2ea9129321c3a4ba43505b772 Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Sun, 14 Jul 2013 23:01:16 +1000 Subject: [PATCH 0542/1975] do slug_substitutions on category and author ... --- pelican/contents.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index d56335dd..ed213c31 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -141,14 +141,21 @@ class Content(object): """Returns the URL, formatted with the proper values""" metadata = copy.copy(self.metadata) path = self.metadata.get('path', self.get_relative_source_path()) + default_category = self.settings['DEFAULT_CATEGORY'] + slug_substitutions = self.settings.get('SLUG_SUBSTITUTIONS', ()) metadata.update({ 'path': path_to_url(path), 'slug': getattr(self, 'slug', ''), 'lang': getattr(self, 'lang', 'en'), 'date': getattr(self, 'date', datetime.now()), - 'author': getattr(self, 'author', ''), - 'category': getattr(self, 'category', - self.settings['DEFAULT_CATEGORY']), + 'author': slugify( + getattr(self, 'author', ''), + slug_substitutions + ), + 'category': slugify( + getattr(self, 'category', default_category), + slug_substitutions + ) }) return metadata From 9b7ae20aa9182e7d3c10bea111716bb4e12edbd8 Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Mon, 15 Jul 2013 00:22:05 +1000 Subject: [PATCH 0543/1975] test for author & category slugification --- pelican/tests/test_contents.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index c081639d..af97db3f 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -191,6 +191,20 @@ class TestArticle(TestPage): custom_article = Article(**article_kwargs) self.assertEqual('custom', custom_article.template) + def test_slugify_category_author(self): + settings = get_settings() + settings['SLUG_SUBSTITUTIONS'] = [ ('C#', 'csharp') ] + settings['ARTICLE_URL'] = '{author}/{category}/{slug}/' + settings['ARTICLE_SAVE_AS'] = '{author}/{category}/{slug}/index.html' + article_kwargs = self._copy_page_kwargs() + article_kwargs['metadata']['author'] = "O'Brien" + article_kwargs['metadata']['category'] = 'C# & stuff' + article_kwargs['metadata']['title'] = 'fnord' + article_kwargs['settings'] = settings + article = Article(**article_kwargs) + self.assertEqual(article.url, 'obrien/csharp-stuff/fnord/') + self.assertEqual(article.save_as, 'obrien/csharp-stuff/fnord/index.html') + class TestURLWrapper(unittest.TestCase): def test_comparisons(self): From 4ca5d908ff767fc07a95a8b31487dcbb9416e2e5 Mon Sep 17 00:00:00 2001 From: Chris Howie Date: Mon, 15 Jul 2013 16:48:08 -0400 Subject: [PATCH 0544/1975] Update tag cloud documentation for SLUG_SUBSTITUTIONS --- docs/settings.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 61ccc2b2..2c16ca83 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -497,7 +497,7 @@ The default theme does not support tag clouds, but it is pretty easy to add:: From f43742c3f0b6b3a260ff5c338d7c4309865b0b54 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 15 Jul 2013 14:25:39 -0700 Subject: [PATCH 0545/1975] Add missing SITEURL variable to tag cloud docs --- docs/settings.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 2c16ca83..eb0d028f 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -493,11 +493,11 @@ Setting name (default value) What does it do? `TAG_CLOUD_MAX_ITEMS` (``100``) Maximum number of tags in the cloud. ================================================ ===================================================== -The default theme does not support tag clouds, but it is pretty easy to add:: +The default theme does not include a tag cloud, but it is pretty easy to add:: From c5008f61e0a480afb954a5258748eec576ee9a72 Mon Sep 17 00:00:00 2001 From: Jude N Date: Tue, 16 Jul 2013 23:44:53 -0400 Subject: [PATCH 0546/1975] Adding a FEED_ALL_ATOM check in the "social" div. The head section has a tests for FEED_ALL_ATOM when building the atom link. This diff add a similar test in the "social" div. --- pelican/themes/notmyidea/templates/base.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/themes/notmyidea/templates/base.html b/pelican/themes/notmyidea/templates/base.html index 9bf4b12b..e44e20fd 100644 --- a/pelican/themes/notmyidea/templates/base.html +++ b/pelican/themes/notmyidea/templates/base.html @@ -53,7 +53,9 @@ - -
    -
    -
    +
    + -
    +
    Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +The baz tag2010-03-14T00:00:00Ztag:,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p>
    \ No newline at end of file diff --git a/pelican/tests/output/basic/feeds/all.atom.xml b/pelican/tests/output/basic/feeds/all.atom.xml index 3081adc6..63628281 100644 --- a/pelican/tests/output/basic/feeds/all.atom.xml +++ b/pelican/tests/output/basic/feeds/all.atom.xml @@ -28,4 +28,5 @@ YEAH !</p>
    Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +The baz tag2010-03-14T00:00:00Ztag:,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p>
    \ No newline at end of file diff --git a/pelican/tests/output/basic/feeds/misc.atom.xml b/pelican/tests/output/basic/feeds/misc.atom.xml index e71bd151..f2885b1d 100644 --- a/pelican/tests/output/basic/feeds/misc.atom.xml +++ b/pelican/tests/output/basic/feeds/misc.atom.xml @@ -4,4 +4,5 @@
    Unbelievable !2010-10-15T20:30:00Ztag:,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +The baz tag2010-03-14T00:00:00Ztag:,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p>
    \ No newline at end of file diff --git a/pelican/tests/output/basic/filename_metadata-example.html b/pelican/tests/output/basic/filename_metadata-example.html index a9f548a5..e53e9c59 100644 --- a/pelican/tests/output/basic/filename_metadata-example.html +++ b/pelican/tests/output/basic/filename_metadata-example.html @@ -15,6 +15,7 @@
    Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +The baz tag2010-03-14T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p>
    \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/all.atom.xml b/pelican/tests/output/custom/feeds/all.atom.xml index 3187c2aa..a9e67acd 100644 --- a/pelican/tests/output/custom/feeds/all.atom.xml +++ b/pelican/tests/output/custom/feeds/all.atom.xml @@ -29,4 +29,5 @@ YEAH !</p> Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +The baz tag2010-03-14T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/all.rss.xml b/pelican/tests/output/custom/feeds/all.rss.xml index 8d07bec7..7d7890a9 100644 --- a/pelican/tests/output/custom/feeds/all.rss.xml +++ b/pelican/tests/output/custom/feeds/all.rss.xml @@ -29,4 +29,5 @@ YEAH !</p> Alexis MétaireauWed, 20 Oct 2010 10:14:00 +0200tag:blog.notmyidea.org,2010-10-20:oh-yeah.htmlohbaryeahUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> -Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file +Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.htmlThe baz taghttp://blog.notmyidea.org/tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> +Alexis MétaireauSun, 14 Mar 2010 00:00:00 +0100tag:blog.notmyidea.org,2010-03-14:tag/baz.html \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/misc.atom.xml b/pelican/tests/output/custom/feeds/misc.atom.xml index 45c996f3..029184b0 100644 --- a/pelican/tests/output/custom/feeds/misc.atom.xml +++ b/pelican/tests/output/custom/feeds/misc.atom.xml @@ -4,4 +4,5 @@ Unbelievable !2010-10-15T20:30:00+02:00Alexis Métaireautag:blog.notmyidea.org,2010-10-15:unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> +The baz tag2010-03-14T00:00:00+01:00Alexis Métaireautag:blog.notmyidea.org,2010-03-14:tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> \ No newline at end of file diff --git a/pelican/tests/output/custom/feeds/misc.rss.xml b/pelican/tests/output/custom/feeds/misc.rss.xml index 1d295abc..ab2639cf 100644 --- a/pelican/tests/output/custom/feeds/misc.rss.xml +++ b/pelican/tests/output/custom/feeds/misc.rss.xml @@ -4,4 +4,5 @@ Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> <a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a file-relative link to markdown-article</a></p> -Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.html \ No newline at end of file +Alexis MétaireauFri, 15 Oct 2010 20:30:00 +0200tag:blog.notmyidea.org,2010-10-15:unbelievable.htmlThe baz taghttp://blog.notmyidea.org/tag/baz.html<p>This article overrides the listening of the articles under the <em>baz</em> tag.</p> +Alexis MétaireauSun, 14 Mar 2010 00:00:00 +0100tag:blog.notmyidea.org,2010-03-14:tag/baz.html \ No newline at end of file diff --git a/pelican/tests/output/custom/filename_metadata-example.html b/pelican/tests/output/custom/filename_metadata-example.html index a9c0f5c1..83a4c43f 100644 --- a/pelican/tests/output/custom/filename_metadata-example.html +++ b/pelican/tests/output/custom/filename_metadata-example.html @@ -19,6 +19,7 @@