Revised builder checks, incremented version number, added rel post.

This commit is contained in:
Ahmet Bakan 2015-09-14 21:33:06 -07:00
parent 94de463fc7
commit f58e4319b1
3 changed files with 26 additions and 16 deletions

View file

@ -8,7 +8,7 @@ from .post import (PostDirective, PostListDirective, UpdateDirective,
generate_archive_pages, generate_atom_feeds,
missing_reference)
__version__ = '0.7.9'
__version__ = '0.7.10'
def anchor(post):
@ -19,20 +19,21 @@ def anchor(post):
else:
return ''
def build_safe(builder):
"""Return True when builder is expected to be safe. Safe builders are
HTML builders, excluding `PickleHTMLBuilder` and `JSONHTMLBuilder`
which run into issues when trying to serialize blog objects."""
def builder_support(builder):
"""Return True when builder is supported. Supported builders output in
html format, but exclude `PickleHTMLBuilder` and `JSONHTMLBuilder`,
which run into issues when serializing blog objects."""
if hasattr(builder, 'builder'):
builder = builder.builder
return builder.format == 'html' and not builder.name in {'json', 'pickle'}
not_supported = {'json', 'pickle'}
return builder.format == 'html' and not builder.name in not_supported
def html_page_context(app, pagename, templatename, context, doctree):
if build_safe(app):
if build_support(app):
context['ablog'] = Blog(app)
context['anchor'] = anchor

View file

@ -336,17 +336,14 @@ def process_posts(app, doctree):
env.ablog_posts[docname] = []
env.ablog_posts[docname].append(postinfo)
non_html = 'html' not in app.builder.name
# instantiate catalogs and collections here
# so that references are created and no warnings are issued
if non_html:
if app.builder.format == 'html':
stdlabel = env.domains['std'].data['labels']
else:
stdlabel = env.intersphinx_inventory.setdefault('std:label', {})
baseurl = getattr(env.config, 'blog_baseurl').rstrip('/') + '/'
project, version = env.config.project, text_type(env.config.version)
else:
stdlabel = env.domains['std'].data['labels']
for key in ['tags', 'author', 'category', 'location', 'language']:
catalog = blog.catalogs[key]
@ -480,7 +477,7 @@ def generate_archive_pages(app):
"""Generate archive pages for all posts, categories, tags, authors, and
drafts."""
if not ablog.build_safe(app):
if not ablog.builder_support(app):
return
blog = Blog(app)
@ -562,7 +559,7 @@ def generate_atom_feeds(app):
"""Generate archive pages for all posts, categories, tags, authors, and
drafts."""
if not ablog.build_safe(app):
if not ablog.builder_support(app):
return
blog = Blog(app)

View file

@ -123,8 +123,20 @@ ABlog v0.7.9 released
:category: Release
:location: SF
ABlog v0.7.9 is released to Windows specific file renaming issue in
ABlog v0.7.9 is released to fix Windows specific file renaming issue in
:ref:`ablog deploy <deploy>` command (:issue:`46`). Thanks to `Velimir`_
for the fix.
.. _Velimir: https://github.com/montyvesselinov
ABlog v0.7.10 released
---------------------
.. post:: Sep 14, 2015
:author: Ahmet
:category: Release
:location: SF
ABlog v0.7.10 is released to resolve Sphinx JSON/Pickle builder issues
related to serialization.