module sphinxext.blog_post_list
¶
Short summary¶
module pyquickhelper.sphinxext.blog_post_list
Helpers to build RST extra files inserted in the documentation.
Classes¶
class |
truncated documentation |
---|---|
Defines a list of |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Removes accents and spaces to get a clean url. |
|
Divides a list into buckets of division items. |
|
Writes the content of an aggregate page of blog posts. |
|
Writes list of posts in an aggregated manners. |
Methods¶
method |
truncated documentation |
---|---|
usual |
|
Creates a list of |
|
Iterates on |
|
Returns the number of blog posts. |
|
Extracts the categories. |
|
Extracts the categories with the posts associated to it. |
|
Extracts the files. |
|
Returns the local path to an image in this folder. |
|
Extracts the categories. |
|
Extracts the months. |
|
Extracts the months with the posts associated to it. |
|
Builds the rst links to months or categories to displays the bottom of the aggregated pages. |
|
Builds the rst links to months or categories to displays at the beginning of the aggregated pages. |
|
Writes posts in a aggregated manner (post, categories, months). |
|
Writes posts in a aggregated manner per categories. |
|
Writes links to post per categories and per months. |
|
Writes an index. |
|
Writes posts in a aggregated manner per months. |
|
Writes posts in a aggregated manner. |
Documentation¶
Helpers to build RST extra files inserted in the documentation.
-
class
pyquickhelper.sphinxext.blog_post_list.
BlogPostList
(folder, encoding='utf8', language='en', extensions=None, fLOG=<function noLOG>)[source]¶ Bases:
object
Defines a list of
BlogPost
.Creates a list of
BlogPost
, we assume each blog post belongs to a subfolderYYYY
.- Parameters
folder – folder when to find files
encoding – encoding
language – language
extensions – list of extension to use to parse the content of the blog, if None, it will consider a default list (
BlogPost
andget_default_extensions()
)fLOG – logging function
-
__init__
(folder, encoding='utf8', language='en', extensions=None, fLOG=<function noLOG>)[source]¶ Creates a list of
BlogPost
, we assume each blog post belongs to a subfolderYYYY
.- Parameters
folder – folder when to find files
encoding – encoding
language – language
extensions – list of extension to use to parse the content of the blog, if None, it will consider a default list (
BlogPost
andget_default_extensions()
)fLOG – logging function
-
static
category2url
(cat)[source]¶ Removes accents and spaces to get a clean url.
- Parameters
cat – category name
- Returns
cleaned category
-
static
divide_list
(ld, division)[source]¶ Divides a list into buckets of division items.
- Parameters
ld – list of to divide
division – bucket size
- Returns
list fo buckets
-
get_categories_group
()[source]¶ Extracts the categories with the posts associated to it.
- Returns
dictionary (category, list of posts)
-
get_image
(img)[source]¶ Returns the local path to an image in this folder.
- Parameters
img – image name (see below)
- Returns
local file
- Allowed image names:
rss: image for RSS stream
-
get_months_group
()[source]¶ Extracts the months with the posts associated to it.
- Returns
dictionary (months, list of posts)
-
get_rst_links_down
()[source]¶ Builds the rst links to months or categories to displays the bottom of the aggregated pages.
- Returns
list of rst_links
-
get_rst_links_up
()[source]¶ Builds the rst links to months or categories to displays at the beginning of the aggregated pages.
- Returns
list of rst_links
-
static
produce_aggregated_post_page
(name, lp, this, prev, next, main_page='Blog', rst_links_up=None, rst_links_down=None, index_terms=None, bold_title=None, language='en')[source]¶ Writes the content of an aggregate page of blog posts.
- Parameters
name – filename to write
lp – list of posts
this – reference to this page
prev – reference to the previous page
next – reference to the next page
main_page – name of the main page
rst_links_up – list of rst_links to add at the beginning of a page
rst_links_down – list of rst_links to add at the bottom of a page
index_terms – terms to index
bold_title – title to display of the beginning of the page
language – language
- Returns
content of the page
-
write_aggregated
(folder, division=10, blog_title='__BLOG_TITLE__', blog_description='__BLOG_DESCRIPTION__', blog_root='__BLOG_ROOT__', only_html_index=True, only_html_agg=False)[source]¶ Writes posts in a aggregated manner (post, categories, months).
- Parameters
folder – where to write them
division – add a new page every division items
blog_title – blog title
blog_description – blog description
blog_root – blog root (publish url)
only_html_index – add item
.. only:: html
and indent everything after the main indexonly_html_agg – add item
.. only:: html
and indent everything for aggregated pages
- Returns
list of produced files
Changed in version 1.7: Splits only_html into only_html_index and only_html_agg.
-
write_aggregated_categories
(folder, division=10, rst_links_up=None, rst_links_down=None, only_html=True)[source]¶ Writes posts in a aggregated manner per categories.
- Parameters
folder – where to write them
division – add a new page every division items
rst_links_up – list of rst_links to add at the beginning of a page
rst_links_down – list of rst_links to add at the bottom of a page
only_html – add item
.. only:: html
and indent everything
- Returns
list of produced files
-
write_aggregated_chapters
(folder)[source]¶ Writes links to post per categories and per months.
- Parameters
folder – where to write them
- Returns
list of produced files
-
write_aggregated_index
(folder, hidden_files=None, hidden_files_html=None, only_html=True)[source]¶ Writes an index.
- Parameters
folder – where to write the file
hidden_files – creates an hidden toctree and a
tocdelay_node
.only_html – add item
.. only:: html
and indent everything after the main indexhidden_files_html – add item
.. only:: html
for these pages
- Returns
filename
Changed in version 1.7: Parameter hidden_files_html was added.
-
write_aggregated_months
(folder, division=10, rst_links_up=None, rst_links_down=None, only_html=True)[source]¶ Writes posts in a aggregated manner per months.
- Parameters
folder – where to write them
division – add a new page every division items
rst_links_up – list of rst_links to add at the beginning of a page
rst_links_down – list of rst_links to add at the bottom of a page
only_html – add item
.. only:: html
and indent everything
- Returns
list of produced files
-
static
write_aggregated_post_list
(folder, lp, division, prefix, encoding, rst_links_up=None, rst_links_down=None, index_terms=None, bold_title=None, language='en', only_html=True)[source]¶ Writes list of posts in an aggregated manners.
- Parameters
folder – when to write the aggregated posts
lp – list of posts
division – bucket size
prefix – prefix name for the files
encoding – encoding for the written files
rst_links_up – list of rst_links to add at the beginning of a page
rst_links_down – list of rst_links to add at the bottom of a page
index_terms – terms to index on the first bucket
bold_title – title to display at the beginning of the page
language – language
only_html – add item
.. only:: html
and indent everything
- Returns
list of produced files
-
write_aggregated_posts
(folder, division=10, rst_links_up=None, rst_links_down=None, only_html=True)[source]¶ Writes posts in a aggregated manner.
- Parameters
folder – where to write them
division – add a new page every division items
rst_links_up – list of rst_links to add at the beginning of a page
rst_links_down – list of rst_links to add at the bottom of a page
only_html – add item
.. only:: html
and indent everything
- Returns
list of produced files