ablog package

Submodules

ablog.blog module

Classes for handling posts and archives.

class ablog.blog.Blog(app)

Bases: Container

Handle blog operations.

property feed_path

RSS feed page name.

page_id(pagename)

Return pagename, trimming index from end when found.

Return value is used as disqus page identifier.

page_url(pagename)

Return page URL when :confval:`blog_baseurl` is set, otherwise None.

When found, index.html is trimmed from the end of the URL.

recent(num, docname=None, **labels)

Yield num recent posts, excluding the one with docname.

register(docname, info)

Register post docname.

class ablog.blog.Collection(catalog, label, name=None, href=None, path=None, page=0)

Bases: BlogPageMixin

Posts sharing a label, i.e. tag, category, author, or location.

add(post)

Add post to the collection.

property catalog

Catalog that the collection belongs to.

property docname

Collection page document name.

property path

Collection page document name.

relsize(maxsize=5, minsize=1)

Relative size used in tag clouds.

class ablog.blog.Post(blog, docname, info)

Bases: BlogPageMixin

Handle post metadata.

property next

Next published post in chronological order.

property prev

Previous published post in chronological order.

to_html(pagename, fulltext=False, drop_h1=True)

Return excerpt or fulltext as HTML after resolving references with respect to pagename.

By default, first <h1> tag is dropped from the output. More than one can be dropped by setting drop_h1 to the desired number of tags to be dropped.

ablog.commands module

ablog.commands.ablog_build(builder=None, sourcedir=None, website=None, doctrees=None, traceback=False, runpdb=False, allfiles=False, werror=False, verbosity=0, quiet=False, extra_quiet=False, no_colors=False, **kwargs)
ablog.commands.ablog_clean(website=None, doctrees=None, deep=False, **kwargs)
ablog.commands.ablog_deploy(website, message=None, github_pages=None, push_quietly=False, push_force=False, github_token=None, github_is_http=True, github_url=None, github_branch=None, repodir=None, **kwargs)
ablog.commands.ablog_main()

Ablog Main.

ablog.commands.ablog_serve(website=None, port=8000, view=True, rebuild=False, patterns='*.rst;*.txt', **kwargs)

ablog.conf module

default config setting for ablog

from ablog.conf import *

override any values in the project’s conf.py

in general this should just leave the peronalized elements

ablog.post module

post and postlist directives.

class ablog.post.CheckFrontMatter(document, startnode=None)

Bases: SphinxTransform

Check the doctree for frontmatter meant for a blog post.

This is mutually-exclusive with the PostDirective. Only one much be used.

apply()

Override to apply the transform to the document tree.

default_priority = 800

Numerical priority of this transform, 0 through 999 (override).

class ablog.post.PostDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: Directive

Handle post directives.

final_argument_whitespace = True

May the final argument contain whitespace?

has_content = True

May the directive have content?

option_spec = {'author': <function PostDirective._split>, 'category': <function PostDirective._split>, 'excerpt': <class 'int'>, 'exclude': <function flag>, 'image': <class 'int'>, 'language': <function PostDirective._split>, 'location': <function PostDirective._split>, 'nocomments': <function flag>, 'redirect': <function PostDirective._split>, 'tags': <function PostDirective._split>, 'title': <function PostDirective.<lambda>>}

Mapping of option names to validator functions.

optional_arguments = 1

Number of optional arguments after the required arguments.

required_arguments = 0

Number of required directive arguments.

run()
class ablog.post.PostList(rawsource='', *children, **attributes)

Bases: General, Element

Represent postlist directive converted to a list of links.

class ablog.post.PostListDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: Directive

Handle postlist directives.

final_argument_whitespace = False

May the final argument contain whitespace?

has_content = False

May the directive have content?

option_spec = {'author': <function PostListDirective._split>, 'category': <function PostListDirective._split>, 'date': <function PostListDirective.<lambda>>, 'excerpts': <function flag>, 'expand': <function unchanged>, 'format': <function PostListDirective.<lambda>>, 'language': <function PostListDirective._split>, 'list-style': <function PostListDirective.<lambda>>, 'location': <function PostListDirective._split>, 'sort': <function flag>, 'tags': <function PostListDirective._split>}

Mapping of option names to validator functions.

optional_arguments = 1

Number of optional arguments after the required arguments.

required_arguments = 0

Number of required directive arguments.

run()
class ablog.post.PostNode(rawsource='', *children, **attributes)

Bases: Element

Represent post directive content and options in document tree.

class ablog.post.UpdateDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: BaseAdmonition

node_class

alias of UpdateNode

required_arguments = 1

Number of required directive arguments.

run()
class ablog.post.UpdateNode(rawsource='', *children, **attributes)

Bases: admonition

Represent update directive.

ablog.post.generate_archive_pages(app)

Generate archive pages for all posts, categories, tags, authors, and drafts.

ablog.post.generate_atom_feeds(app)

Generate archive pages for all posts, categories, tags, authors, and drafts.

ablog.post.process_postlist(app, doctree, docname)

Replace PostList nodes with lists of posts.

Also, register all posts if they have not been registered yet.

ablog.post.process_posts(app, doctree)

Process posts and map posted document names to post details in the environment.

ablog.post.purge_posts(app, env, docname)

Remove post and reference to it from the standard domain when its document is removed or changed.

ablog.post.register_posts(app)

Register posts found in the Sphinx build environment.

ablog.start module

ablog.start.ablog_start(**kwargs)
ablog.start.ask_user(d)

Borrowed from Sphinx 1.3b3.

Ask the user for quickstart values missing from d.

Values are:

  • path: root path

  • project: project name

  • author: author names

  • version: version of project

  • release: release of project

ablog.start.generate(d, overwrite=True, silent=False)

Borrowed from Sphinx 1.3b3.

Generate project based on values in d.

ablog.version module

Module contents

ABlog for Sphinx.

ablog.setup(app)

Setup ABlog extension.