From c74abe579bc2b855b6487254bc7a79fab0718c84 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 10:46:32 +0100 Subject: [PATCH 1/6] Don't rewrite URLs Remove the code that was appending ../static in front of some URLs, and add a way to do cross-content linking. --- pelican/__init__.py | 4 +- pelican/contents.py | 96 +++++++++++++++++++++-- pelican/generators.py | 71 ++++++++++++----- pelican/utils.py | 38 ++++++++- pelican/writers.py | 67 ---------------- samples/content/another_super_article.rst | 2 +- samples/content/cat1/markdown-article.md | 3 + samples/content/pages/test_page.rst | 2 +- samples/content/super_article.rst | 4 +- samples/content/unbelievable.rst | 3 + tests/support.py | 8 ++ tests/test_generators.py | 55 +++++++------ 12 files changed, 228 insertions(+), 125 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index c0f33687..52d371ec 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -134,6 +134,7 @@ class Pelican(object): """Run the generators and return""" context = self.settings.copy() + filenames = {} # share the dict between all the generators generators = [ cls( context, @@ -142,7 +143,8 @@ class Pelican(object): self.theme, self.output_path, self.markup, - self.delete_outputdir + self.delete_outputdir, + filenames=filenames ) for cls in self.get_generator_classes() ] diff --git a/pelican/contents.py b/pelican/contents.py index bb2b5a6e..0d599771 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -3,13 +3,16 @@ import copy import locale import logging import functools +import os +import re +import urlparse from datetime import datetime from sys import platform, stdin from pelican.settings import _DEFAULT_CONFIG -from pelican.utils import slugify, truncate_html_words +from pelican.utils import slugify, truncate_html_words, memoized from pelican import signals logger = logging.getLogger(__name__) @@ -25,7 +28,7 @@ class Page(object): default_template = 'page' def __init__(self, content, metadata=None, settings=None, - filename=None): + filename=None, context=None): # init parameters if not metadata: metadata = {} @@ -34,6 +37,7 @@ class Page(object): self.settings = settings self._content = content + self._context = context self.translations = [] local_metadata = dict(settings.get('DEFAULT_METADATA', ())) @@ -128,12 +132,56 @@ class Page(object): key = key if self.in_default_lang else 'lang_%s' % key return self._expand_settings(key) + def _update_content(self, content): + """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. + """ + hrefs = re.compile(r""" + (?P<\s*[^\>]* # match tag with src and href attr + (?:href|src)\s*=) + + (?P["\']) # require value to be quoted + (?P\|(?P.*?)\|(?P.*?)) # the url value + \2""", re.X) + + def replacer(m): + what = m.group('what') + value = m.group('value') + origin = m.group('path') + # we support only filename for now. the plan is to support + # categories, tags, etc. in the future, but let's keep things + # simple for now. + if what == 'filename': + if value.startswith('/'): + value = value[1:] + else: + # relative to the filename of this content + value = self.get_relative_filename( + os.path.join(self.relative_dir, value) + ) + + if value in self._context['filenames']: + origin = urlparse.urljoin(self._context['SITEURL'], + self._context['filenames'][value].url) + else: + logger.warning(u"Unable to find {fn}, skipping url" + " replacement".format(fn=value)) + + return m.group('markup') + m.group('quote') + origin \ + + m.group('quote') + + return hrefs.sub(replacer, content) + @property + @memoized def content(self): if hasattr(self, "_get_content"): content = self._get_content() else: content = self._content + content = self._update_content(content) return content def _get_summary(self): @@ -143,7 +191,8 @@ class Page(object): return self._summary else: if self.settings['SUMMARY_MAX_LENGTH']: - return truncate_html_words(self.content, self.settings['SUMMARY_MAX_LENGTH']) + return truncate_html_words(self.content, + self.settings['SUMMARY_MAX_LENGTH']) return self.content def _set_summary(self, summary): @@ -162,6 +211,27 @@ class Page(object): else: return self.default_template + def get_relative_filename(self, filename=None): + """Return the relative path (from the content path) to the given + filename. + + If no filename is specified, use the filename of this content object. + """ + if not filename: + filename = self.filename + + return os.path.relpath( + os.path.abspath(os.path.join(self.settings['PATH'], filename)), + os.path.abspath(self.settings['PATH']) + ) + + @property + def relative_dir(self): + return os.path.dirname(os.path.relpath( + os.path.abspath(self.filename), + os.path.abspath(self.settings['PATH'])) + ) + class Article(Page): mandatory_properties = ('title', 'date', 'category') @@ -227,11 +297,27 @@ class Author(URLWrapper): pass +class StaticContent(object): + def __init__(self, src, dst=None, settings=None): + if not settings: + settings = copy.deepcopy(_DEFAULT_CONFIG) + self.src = src + self.url = dst or src + self.filepath = os.path.join(settings['PATH'], src) + self.save_as = os.path.join(settings['OUTPUT_PATH'], self.url) + + def __str__(self): + return str(self.filepath.encode('utf-8', 'replace')) + + def __unicode__(self): + return self.filepath + + def is_valid_content(content, f): try: content.check_properties() return True except NameError, e: - logger.error(u"Skipping %s: impossible to find informations about '%s'"\ - % (f, e)) + logger.error(u"Skipping %s: impossible to find informations about" + "'%s'" % (f, e)) return False diff --git a/pelican/generators.py b/pelican/generators.py index 020a3711..2da7d8bd 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -5,6 +5,7 @@ import random import logging import datetime import subprocess +import shutil from codecs import open from collections import defaultdict @@ -15,9 +16,10 @@ from operator import attrgetter, itemgetter from jinja2 import (Environment, FileSystemLoader, PrefixLoader, ChoiceLoader, BaseLoader, TemplateNotFound) -from pelican.contents import Article, Page, Category, is_valid_content +from pelican.contents import Article, Page, Category, StaticContent, \ + is_valid_content from pelican.readers import read_file -from pelican.utils import copy, process_translations +from pelican.utils import copy, process_translations, mkdir_p from pelican import signals @@ -61,6 +63,7 @@ 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) @@ -82,8 +85,10 @@ class Generator(object): :param path: the path to search the file on :param exclude: the list of path to exclude + :param extensions: the list of allowed extensions (if False, all + extensions are allowed) """ - if not extensions: + if extensions is None: extensions = self.markup files = [] @@ -97,10 +102,17 @@ class Generator(object): for e in exclude: if e in dirs: dirs.remove(e) - files.extend([os.sep.join((root, f)) for f in temp_files - if True in [f.endswith(ext) for ext in extensions]]) + for f in temp_files: + if extensions is False or \ + (True in [f.endswith(ext) for ext in extensions]): + files.append(os.sep.join((root, f))) return files + def add_filename(self, content): + location = os.path.relpath(os.path.abspath(content.filename), + os.path.abspath(self.path)) + self.context['filenames'][location] = content + def _update_context(self, items): """Update the context with the given items from the currrent processor. @@ -300,7 +312,7 @@ class ArticlesGenerator(Generator): self.generate_drafts(write) def generate_context(self): - """change the context""" + """Add the articles into the shared context""" article_path = os.path.normpath( # we have to remove trailing slashes os.path.join(self.path, self.settings['ARTICLE_DIR']) @@ -341,10 +353,12 @@ class ArticlesGenerator(Generator): signals.article_generate_context.send(self, metadata=metadata) article = Article(content, metadata, settings=self.settings, - filename=f) + filename=f, context=self.context) if not is_valid_content(article, f): continue + self.add_filename(article) + if article.status == "published": if hasattr(article, 'tags'): for tag in article.tags: @@ -440,11 +454,14 @@ class PagesGenerator(Generator): except Exception, e: logger.warning(u'Could not process %s\n%s' % (f, str(e))) continue - signals.pages_generate_context.send(self, metadata=metadata ) + signals.pages_generate_context.send(self, metadata=metadata) page = Page(content, metadata, settings=self.settings, - filename=f) + filename=f, context=self.context) if not is_valid_content(page, f): continue + + self.add_filename(page) + if page.status == "published": all_pages.append(page) elif page.status == "hidden": @@ -479,17 +496,33 @@ class StaticGenerator(Generator): copy(path, source, os.path.join(output_path, destination), final_path, overwrite=True) - def generate_output(self, writer): + def generate_context(self): + self.staticfiles = [] - self._copy_paths(self.settings['STATIC_PATHS'], self.path, - 'static', self.output_path) + # 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=False): + f_rel = os.path.relpath(f, self.path) + # TODO remove this hardcoded 'static' subdirectory + sc = StaticContent(f_rel, os.path.join('static', f_rel), + settings=self.settings) + self.staticfiles.append(sc) + self.context['filenames'][f_rel] = sc + # same thing for FILES_TO_COPY + for src, dest in self.settings['FILES_TO_COPY']: + sc = StaticContent(src, dest, settings=self.settings) + self.staticfiles.append(sc) + self.context['filenames'][src] = sc + + def generate_output(self, writer): self._copy_paths(self.settings['THEME_STATIC_PATHS'], self.theme, 'theme', self.output_path, '.') - - # copy all the files needed - for source, destination in self.settings['FILES_TO_COPY']: - copy(source, self.path, self.output_path, destination, - overwrite=True) + # copy all StaticContent files + for sc in self.staticfiles: + mkdir_p(os.path.dirname(sc.save_as)) + shutil.copy(sc.filepath, sc.save_as) + logger.info('copying %s to %s' % (sc.filepath, sc.save_as)) class PdfGenerator(Generator): @@ -532,8 +565,8 @@ class PdfGenerator(Generator): try: os.mkdir(pdf_path) except OSError: - logger.error("Couldn't create the pdf output folder in " + pdf_path) - pass + logger.error("Couldn't create the pdf output folder in " + + pdf_path) for article in self.context['articles']: self._create_pdf(article, pdf_path) diff --git a/pelican/utils.py b/pelican/utils.py index 79387357..6ca797c4 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -4,7 +4,9 @@ import re import pytz import shutil import logging -from collections import defaultdict +import errno +from collections import defaultdict, Hashable +from functools import partial from codecs import open from datetime import datetime @@ -19,6 +21,32 @@ class NoFilesError(Exception): pass +class memoized(object): + '''Decorator. Caches a function's return value each time it is called. + If called later with the same arguments, the cached value is returned + (not reevaluated). + ''' + def __init__(self, func): + self.func = func + self.cache = {} + def __call__(self, *args): + if not isinstance(args, Hashable): + # uncacheable. a list, for instance. + # better to not cache than blow up. + return self.func(*args) + if args in self.cache: + return self.cache[args] + else: + value = self.func(*args) + self.cache[args] = value + return value + def __repr__(self): + '''Return the function's docstring.''' + return self.func.__doc__ + def __get__(self, obj, objtype): + '''Support instance methods.''' + return partial(self.__call__, obj) + def get_date(string): """Return a datetime object from a string. @@ -300,3 +328,11 @@ def set_date_tzinfo(d, tz_name=None): return tz.localize(d) else: return d + + +def mkdir_p(path): + try: + os.makedirs(path) + except OSError, e: + if e.errno != errno.EEXIST: + raise diff --git a/pelican/writers.py b/pelican/writers.py index b932a805..b24a90dd 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -2,12 +2,10 @@ from __future__ import with_statement import os -import re import locale import logging from codecs import open -from functools import partial from feedgenerator import Atom1Feed, Rss201rev2Feed from jinja2 import Markup from pelican.paginator import Paginator @@ -129,8 +127,6 @@ class Writer(object): localcontext['SITEURL'] = get_relative_path(name) localcontext.update(kwargs) - if relative_urls: - self.update_context_contents(name, localcontext) # check paginated paginated = paginated or {} @@ -168,66 +164,3 @@ class Writer(object): else: # no pagination _write_file(template, localcontext, self.output_path, name) - - def update_context_contents(self, name, context): - """Recursively run the context to find elements (articles, pages, etc) - whose content getter needs to be modified in order to deal with - relative paths. - - :param name: name of the file to output. - :param context: dict that will be passed to the templates, which need - to be updated. - """ - def _update_content(name, input): - """Change all the relatives paths of the input content to relatives - paths suitable fot the ouput content - - :param name: path of the output. - :param input: input resource that will be passed to the templates. - """ - content = input._content - - hrefs = re.compile(r""" - (?P<\s*[^\>]* # match tag with src and href attr - (?:href|src)\s*=\s* - ) - (?P["\']) # require value to be quoted - (?![#?]) # don't match fragment or query URLs - (?![a-z]+:) # don't match protocol URLS - (?P.*?) # the url value - \2""", re.X) - - def replacer(m): - relative_path = m.group('path') - dest_path = os.path.normpath( - 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') - - return hrefs.sub(replacer, content) - - if context is None: - return - if hasattr(context, 'values'): - context = context.values() - - for item in context: - # run recursively on iterables - if hasattr(item, '__iter__'): - self.update_context_contents(name, item) - - # if it is a content, patch it - elif hasattr(item, '_content'): - relative_path = get_relative_path(name) - - paths = self.reminder.setdefault(item, []) - if relative_path not in paths: - paths.append(relative_path) - setattr(item, "_get_content", - partial(_update_content, name, item)) diff --git a/samples/content/another_super_article.rst b/samples/content/another_super_article.rst index 5ec1e2b8..e6e0a92c 100644 --- a/samples/content/another_super_article.rst +++ b/samples/content/another_super_article.rst @@ -14,7 +14,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 ! -.. image:: pictures/Sushi.jpg +.. image:: |filename|/pictures/Sushi.jpg :height: 450 px :width: 600 px :alt: alternate text diff --git a/samples/content/cat1/markdown-article.md b/samples/content/cat1/markdown-article.md index 3bf56dc0..5307b47a 100644 --- a/samples/content/cat1/markdown-article.md +++ b/samples/content/cat1/markdown-article.md @@ -2,3 +2,6 @@ Title: A markdown powered article Date: 2011-04-20 You're mutually oblivious. + +[a root-relative link to unbelievable](|filename|/unbelievable.rst) +[a file-relative link to unbelievable](|filename|../unbelievable.rst) diff --git a/samples/content/pages/test_page.rst b/samples/content/pages/test_page.rst index 06f91c10..2285f17b 100644 --- a/samples/content/pages/test_page.rst +++ b/samples/content/pages/test_page.rst @@ -5,7 +5,7 @@ This is a test page Just an image. -.. image:: pictures/Fat_Cat.jpg +.. image:: |filename|/pictures/Fat_Cat.jpg :height: 450 px :width: 600 px :alt: alternate text diff --git a/samples/content/super_article.rst b/samples/content/super_article.rst index 1dfd8e34..76e57683 100644 --- a/samples/content/super_article.rst +++ b/samples/content/super_article.rst @@ -16,12 +16,12 @@ This is a simple title And here comes the cool stuff_. -.. image:: pictures/Sushi.jpg +.. image:: |filename|/pictures/Sushi.jpg :height: 450 px :width: 600 px :alt: alternate text -.. image:: pictures/Sushi_Macro.jpg +.. image:: |filename|/pictures/Sushi_Macro.jpg :height: 450 px :width: 600 px :alt: alternate text diff --git a/samples/content/unbelievable.rst b/samples/content/unbelievable.rst index 11443e9a..20cb9dc7 100644 --- a/samples/content/unbelievable.rst +++ b/samples/content/unbelievable.rst @@ -4,3 +4,6 @@ Unbelievable ! :date: 2010-10-15 20:30 Or completely awesome. Depends the needs. + +`a root-relative link to markdown-article <|filename|/cat1/markdown-article.md>`_ +`a file-relative link to markdown-article <|filename|cat1/markdown-article.md>`_ diff --git a/tests/support.py b/tests/support.py index 5b63eeba..b6db5195 100644 --- a/tests/support.py +++ b/tests/support.py @@ -15,6 +15,7 @@ from tempfile import mkdtemp from shutil import rmtree from pelican.contents import Article +from pelican.settings import _DEFAULT_CONFIG try: import unittest2 as unittest @@ -149,3 +150,10 @@ def module_exists(module_name): return False else: return True + + +def get_settings(): + settings = _DEFAULT_CONFIG.copy() + settings['DIRECT_TEMPLATES'] = ['archives'] + settings['filenames'] = {} + return settings diff --git a/tests/test_generators.py b/tests/test_generators.py index f8f6a3f4..d2ad6f01 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -11,7 +11,7 @@ from pelican.generators import ArticlesGenerator, PagesGenerator, \ TemplatePagesGenerator from pelican.writers import Writer from pelican.settings import _DEFAULT_CONFIG -from .support import unittest +from .support import unittest, get_settings CUR_DIR = os.path.dirname(__file__) @@ -28,20 +28,20 @@ class TestArticlesGenerator(unittest.TestCase): for each test. """ if self.generator is None: - settings = _DEFAULT_CONFIG.copy() + settings = get_settings() 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']) + CUR_DIR, settings['THEME'], None, + settings['MARKUP']) self.generator.generate_context() return self.generator def distill_articles(self, articles): distilled = [] for page in articles: - distilled.append([ + distilled.append([ page.title, page.status, page.category.name, @@ -51,16 +51,16 @@ class TestArticlesGenerator(unittest.TestCase): return distilled def test_generate_feeds(self): - - generator = ArticlesGenerator(None, {'FEED_ALL_ATOM': _DEFAULT_CONFIG['FEED_ALL_ATOM']}, - None, _DEFAULT_CONFIG['THEME'], None, - _DEFAULT_CONFIG['MARKUP']) + settings = get_settings() + generator = ArticlesGenerator(settings, + {'FEED_ALL_ATOM': settings['FEED_ALL_ATOM']}, None, + settings['THEME'], None, settings['MARKUP']) writer = MagicMock() generator.generate_feeds(writer) - writer.write_feed.assert_called_with([], None, 'feeds/all.atom.xml') + writer.write_feed.assert_called_with([], settings, 'feeds/all.atom.xml') - generator = ArticlesGenerator(None, {'FEED_ALL_ATOM': None}, None, - _DEFAULT_CONFIG['THEME'], None, None) + generator = ArticlesGenerator(settings, {'FEED_ALL_ATOM': None}, None, + settings['THEME'], None, None) writer = MagicMock() generator.generate_feeds(writer) self.assertFalse(writer.write_feed.called) @@ -106,11 +106,10 @@ class TestArticlesGenerator(unittest.TestCase): def test_direct_templates_save_as_default(self): - settings = _DEFAULT_CONFIG.copy() - settings['DIRECT_TEMPLATES'] = ['archives'] - generator = ArticlesGenerator(settings.copy(), settings, None, - _DEFAULT_CONFIG['THEME'], None, - _DEFAULT_CONFIG['MARKUP']) + settings = get_settings() + generator = ArticlesGenerator(settings, settings, None, + settings['THEME'], None, + settings['MARKUP']) write = MagicMock() generator.generate_direct_templates(write) write.assert_called_with("archives.html", @@ -119,12 +118,12 @@ class TestArticlesGenerator(unittest.TestCase): def test_direct_templates_save_as_modified(self): - settings = _DEFAULT_CONFIG.copy() + settings = get_settings() settings['DIRECT_TEMPLATES'] = ['archives'] settings['ARCHIVES_SAVE_AS'] = 'archives/index.html' generator = ArticlesGenerator(settings, settings, None, - _DEFAULT_CONFIG['THEME'], None, - _DEFAULT_CONFIG['MARKUP']) + settings['THEME'], None, + settings['MARKUP']) write = MagicMock() generator.generate_direct_templates(write) write.assert_called_with("archives/index.html", @@ -133,12 +132,12 @@ class TestArticlesGenerator(unittest.TestCase): def test_direct_templates_save_as_false(self): - settings = _DEFAULT_CONFIG.copy() + settings = get_settings() settings['DIRECT_TEMPLATES'] = ['archives'] settings['ARCHIVES_SAVE_AS'] = 'archives/index.html' generator = ArticlesGenerator(settings, settings, None, - _DEFAULT_CONFIG['THEME'], None, - _DEFAULT_CONFIG['MARKUP']) + settings['THEME'], None, + settings['MARKUP']) write = MagicMock() generator.generate_direct_templates(write) write.assert_called_count == 0 @@ -174,13 +173,13 @@ class TestPageGenerator(unittest.TestCase): return distilled def test_generate_context(self): - settings = _DEFAULT_CONFIG.copy() - + settings = get_settings() settings['PAGE_DIR'] = 'TestPages' settings['DEFAULT_DATE'] = (1970, 01, 01) + generator = PagesGenerator(settings.copy(), settings, CUR_DIR, - _DEFAULT_CONFIG['THEME'], None, - _DEFAULT_CONFIG['MARKUP']) + settings['THEME'], None, + settings['MARKUP']) generator.generate_context() pages = self.distill_pages(generator.pages) hidden_pages = self.distill_pages(generator.hidden_pages) @@ -214,7 +213,7 @@ class TestTemplatePagesGenerator(unittest.TestCase): def test_generate_output(self): - settings = _DEFAULT_CONFIG.copy() + settings = get_settings() settings['STATIC_PATHS'] = ['static'] settings['TEMPLATE_PAGES'] = { 'template/source.html': 'generated/file.html' From b5b35c9fc8532e1a72b7907039079bef895c2f9e Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Nov 2012 10:58:32 +0100 Subject: [PATCH 2/6] update functional tests output $ 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 | 2 ++ tests/output/basic/author/alexis-metaireau.html | 2 +- tests/output/basic/category/bar.html | 2 +- tests/output/basic/category/cat1.html | 4 +++- tests/output/basic/category/misc.html | 2 ++ tests/output/basic/category/yeah.html | 4 ++-- tests/output/basic/feeds/all-en.atom.xml | 12 ++++++++---- tests/output/basic/feeds/all.atom.xml | 12 ++++++++---- tests/output/basic/feeds/bar.atom.xml | 2 +- tests/output/basic/feeds/cat1.atom.xml | 4 +++- tests/output/basic/feeds/misc.atom.xml | 2 ++ tests/output/basic/feeds/yeah.atom.xml | 4 ++-- tests/output/basic/index.html | 6 +++++- tests/output/basic/oh-yeah.html | 2 +- tests/output/basic/pages/this-is-a-test-page.html | 2 +- tests/output/basic/tag/bar.html | 2 +- tests/output/basic/tag/foobar.html | 4 ++-- 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 | 2 ++ tests/output/custom/a-markdown-powered-article.html | 2 ++ tests/output/custom/author/alexis-metaireau.html | 4 +++- tests/output/custom/author/alexis-metaireau2.html | 4 +++- tests/output/custom/category/bar.html | 2 +- tests/output/custom/category/cat1.html | 4 +++- tests/output/custom/category/misc.html | 2 ++ tests/output/custom/category/yeah.html | 4 ++-- tests/output/custom/feeds/all-en.atom.xml | 12 ++++++++---- tests/output/custom/feeds/all.atom.xml | 12 ++++++++---- tests/output/custom/feeds/all.rss.xml | 12 ++++++++---- tests/output/custom/feeds/bar.atom.xml | 2 +- tests/output/custom/feeds/bar.rss.xml | 2 +- tests/output/custom/feeds/cat1.atom.xml | 4 +++- tests/output/custom/feeds/cat1.rss.xml | 4 +++- tests/output/custom/feeds/misc.atom.xml | 2 ++ tests/output/custom/feeds/misc.rss.xml | 2 ++ tests/output/custom/feeds/yeah.atom.xml | 4 ++-- tests/output/custom/feeds/yeah.rss.xml | 4 ++-- tests/output/custom/index.html | 2 ++ tests/output/custom/index2.html | 4 +++- 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 | 2 ++ 49 files changed, 123 insertions(+), 63 deletions(-) diff --git a/tests/output/basic/a-markdown-powered-article.html b/tests/output/basic/a-markdown-powered-article.html index f3e60892..0e4e31f0 100644 --- a/tests/output/basic/a-markdown-powered-article.html +++ b/tests/output/basic/a-markdown-powered-article.html @@ -46,6 +46,8 @@

In cat1.

You're mutually oblivious.

+

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

diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index 106e3581..e6f65a11 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.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/category/bar.html b/tests/output/basic/category/bar.html index 88475376..896d9222 100644 --- a/tests/output/basic/category/bar.html +++ b/tests/output/basic/category/bar.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/category/cat1.html b/tests/output/basic/category/cat1.html index 180b8f20..bc149fc6 100644 --- a/tests/output/basic/category/cat1.html +++ b/tests/output/basic/category/cat1.html @@ -42,7 +42,9 @@

In cat1.

-

You're mutually oblivious.

+

You're mutually oblivious.

+

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 d708da2a..6a088793 100644 --- a/tests/output/basic/category/misc.html +++ b/tests/output/basic/category/misc.html @@ -69,6 +69,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 diff --git a/tests/output/basic/category/yeah.html b/tests/output/basic/category/yeah.html index a414eb6f..37dfde63 100644 --- a/tests/output/basic/category/yeah.html +++ b/tests/output/basic/category/yeah.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/feeds/all-en.atom.xml b/tests/output/basic/feeds/all-en.atom.xml
index c7e53da6..bc5418a7 100644
--- a/tests/output/basic/feeds/all-en.atom.xml
+++ b/tests/output/basic/feeds/all-en.atom.xml
@@ -1,14 +1,16 @@
 
 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>
+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>
 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>
 <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()
@@ -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="|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>
 
\ 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 c715db8c..645c5890 100644
--- a/tests/output/basic/feeds/all.atom.xml
+++ b/tests/output/basic/feeds/all.atom.xml
@@ -1,15 +1,17 @@
 
 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>
+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>
 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>
 <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()
@@ -20,7 +22,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="|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>
 
\ No newline at end of file
diff --git a/tests/output/basic/feeds/bar.atom.xml b/tests/output/basic/feeds/bar.atom.xml
index 7b842a63..2c988122 100644
--- a/tests/output/basic/feeds/bar.atom.xml
+++ b/tests/output/basic/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="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
 </div>
 
\ 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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 --------------------------