module sphinxext.blog_post
¶
Short summary¶
module pyquickhelper.sphinxext.blog_post
Helpers to process blog post included in the documentation.
Classes¶
class |
truncated documentation |
---|---|
Defines a blog post. |
|
Exception raised when a error comes after a blogpost was parsed. |
Properties¶
property |
truncated documentation |
---|---|
Returns the author or None if not defined. |
|
Returns the blog background or None if not defined. |
|
Returns the categories. |
|
Returns the content of the blogpost. |
|
Returns the date. |
|
Returns the fields as a dictionary. |
|
Returns the filename. |
|
Returns the keywords. |
|
Produces a tag for the blog post. |
|
Returns the title. |
|
Returns the year, we assume |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Builds the tag for a post. |
Methods¶
method |
truncated documentation |
---|---|
This method avoids to get the following error |
|
Creates an instance of a blog post from a file or a string. |
|
Tells if this blog should be placed before other. |
|
Changes a link to an image if the page contains one into year/img.png. |
|
Reproduces the text of the blog post, updates the image links. |
Documentation¶
Helpers to process blog post included in the documentation.
- class pyquickhelper.sphinxext.blog_post.BlogPost(filename, encoding='utf-8-sig', raise_exception=False, extensions=None, conf=None, **kwargs_overrides)[source]¶
Bases:
object
Defines a blog post.
Creates an instance of a blog post from a file or a string.
- Parameters:
filename – filename or string
encoding – encoding
raise_exception – to raise an exception when the blog cannot be parsed
extensions – list of extension to use to parse the content of the blog, if None, it will consider a default list (see
BlogPost
andget_default_extensions
)conf – existing configuration
kwargs_overrides – additional parameters for sphinx
The constructor creates the following members:
title
date
keywords
categories
_filename
_raw
rst_obj: the object generated by docutils (
BlogPostDirective
)pub: Publisher
Parameter raise_exception catches the standard error. Option :process: of command .. runpython:: should be used within a blog post to avoid having the same process use sphinx at the same time.
- __cmp__(other)[source]¶
This method avoids to get the following error
TypeError: unorderable types: BlogPost() < BlogPost()
.- Parameters:
other – other
BlogPost
- Returns:
-1, 0, or 1
- __init__(filename, encoding='utf-8-sig', raise_exception=False, extensions=None, conf=None, **kwargs_overrides)[source]¶
Creates an instance of a blog post from a file or a string.
- Parameters:
filename – filename or string
encoding – encoding
raise_exception – to raise an exception when the blog cannot be parsed
extensions – list of extension to use to parse the content of the blog, if None, it will consider a default list (see
BlogPost
andget_default_extensions
)conf – existing configuration
kwargs_overrides – additional parameters for sphinx
The constructor creates the following members:
title
date
keywords
categories
_filename
_raw
rst_obj: the object generated by docutils (
BlogPostDirective
)pub: Publisher
Parameter raise_exception catches the standard error. Option :process: of command .. runpython:: should be used within a blog post to avoid having the same process use sphinx at the same time.
- _update_link(row)[source]¶
Changes a link to an image if the page contains one into year/img.png.
- Parameters:
row – row
- Returns:
new row
- static build_tag(date, title)[source]¶
Builds the tag for a post.
- Parameters:
date – date
title – title
- Returns:
tag or label