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 |
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)[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()
)
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.
-
__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)[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()
)
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.
-
_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
-
post_as_rst
(language, directive='blogpostagg', cut=False)[source]¶ Reproduces the text of the blog post, updates the image links.
- Parameters
language – language
directive – to specify a different behavior based on
cut – truncate the post after the first paragraph
- Returns
blog post as RST
New in version 1.7: Parameter cut was added.