nikola.plugins.task package¶
Subpackages¶
Submodules¶
nikola.plugins.task.archive module¶
Classify the posts in archives.
-
class
nikola.plugins.task.archive.
Archive
¶ Bases: :class:`nikola.plugin_categories.Taxonomy`
Classify the post archives.
-
add_other_languages_variable
= True¶
-
always_disable_atom
= True¶
-
always_disable_rss
= True¶
-
apply_to_pages
= False¶
-
apply_to_posts
= True¶
-
classification_name
= 'archive'¶
-
classify
(post, lang)¶ Classify the given post for the given language.
-
extract_hierarchy
(classification)¶ Given a classification, return a list of parts in the hierarchy.
-
get_classification_friendly_name
(classification, lang, only_last_component=False)¶ Extract a friendly name from the classification.
-
get_implicit_classifications
(lang)¶ Return a list of classification strings which should always appear in posts_per_classification.
-
get_other_language_variants
(classification, lang, classifications_per_language)¶ Return a list of variants of the same classification in other languages.
-
get_path
(classification, lang, dest_type='page')¶ Return a path for the given classification.
-
has_hierarchy
= True¶
-
include_posts_from_subhierarchies
= True¶
-
include_posts_into_hierarchy_root
= True¶
-
minimum_post_count_per_classification_in_overview
= 1¶
-
more_than_one_classifications_per_post
= False¶
-
name
= 'classify_archive'¶
-
omit_empty_classifications
= False¶
-
overview_page_variable_name
= 'archive'¶
-
path_handler_docstrings
= {'archive': 'Link to archive path, name is the year.\n\n Example:\n\n link://archive/2013 => /archives/2013/index.html', 'archive_atom': False, 'archive_index': False, 'archive_rss': False}¶
-
postprocess_posts_per_classification
(posts_per_classification_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None)¶ Rearrange, modify or otherwise use the list of posts per classification and per language.
-
provide_context_and_uptodate
(classification, lang, node=None)¶ Provide data for the context and the uptodate list for the list of the given classifiation.
-
recombine_classification_from_hierarchy
(hierarchy)¶ Given a list of parts in the hierarchy, return the classification string.
-
set_site
(site)¶ Set Nikola site.
-
should_generate_classification_page
(classification, post_list, lang)¶ Only generates list of posts for classification if this function returns True.
-
sort_classifications
(classifications, lang, level=None)¶ Sort the given list of classification strings.
-
subcategories_list_template
= 'list.tmpl'¶
-
template_for_classification_overview
= None¶
-
nikola.plugins.task.authors module¶
Render the author pages and feeds.
Bases: :class:`nikola.plugin_categories.Taxonomy`
Classify the posts by authors.
Classify the given post for the given language.
Extract a friendly name from the classification.
Return a list of variants of the same author in other languages.
Return a path for the list of all classifications.
Return a path for the given classification.
Return True if this taxonomy is enabled, or False otherwise.
Rearrange, modify or otherwise use the list of posts per classification and per language.
Provide data for the context and the uptodate list for the list of the given classifiation.
Provide data for the context and the uptodate list for the list of all classifiations.
Set Nikola site.
nikola.plugins.task.bundles module¶
Bundle assets.
-
class
nikola.plugins.task.bundles.
BuildBundles
¶ Bases: :class:`nikola.plugin_categories.LateTask`
Bundle assets.
-
gen_tasks
()¶ Bundle assets.
-
name
= 'create_bundles'¶
-
-
nikola.plugins.task.bundles.
get_theme_bundles
(themes)¶ Given a theme chain, return the bundle definitions.
nikola.plugins.task.copy_assets module¶
Copy theme assets into output.
-
class
nikola.plugins.task.copy_assets.
CopyAssets
¶ Bases: :class:`nikola.plugin_categories.Task`
Copy theme assets into output.
-
gen_tasks
()¶ Create tasks to copy the assets of the whole theme chain.
If a file is present on two themes, use the version from the “youngest” theme.
-
name
= 'copy_assets'¶
-
nikola.plugins.task.copy_files module¶
Copy static files into the output folder.
-
class
nikola.plugins.task.copy_files.
CopyFiles
¶ Bases: :class:`nikola.plugin_categories.Task`
Copy static files into the output folder.
-
gen_tasks
()¶ Copy static files into the output folder.
-
name
= 'copy_files'¶
-
nikola.plugins.task.galleries module¶
Render image galleries.
-
class
nikola.plugins.task.galleries.
Galleries
¶ Bases: :class:`nikola.plugin_categories.Task`, :class:`nikola.image_processing.ImageProcessor`
Render image galleries.
-
create_galleries
()¶ Given a list of galleries, create the output folders.
-
create_galleries_paths
()¶ Given a list of galleries, put their paths into self.gallery_links.
-
create_target_images
(img, input_path)¶ Copy images to output.
-
dates
= {}¶
-
find_galleries
()¶ Find all galleries to be processed according to conf.py.
-
find_metadata
(gallery, lang)¶ Search for a gallery metadata file.
If there is an metadata file for the gallery, use that to determine captions and the order in which images shall be displayed in the gallery. You only need to list the images if a specific ordering or caption is required. The metadata file is YAML-formatted, with field names of # name: caption: order: # If a numeric order value is specified, we use that directly, otherwise we depend on how the library returns the information - which may or may not be in the same order as in the file itself. Non-numeric ordering is not supported. If no caption is specified, then we return an empty string. Returns a string (l18n’d filename), list (ordering), dict (captions), dict (image metadata).
-
gallery_global_path
(name, lang)¶ Link to the global gallery path, which contains all the images in galleries.
There is only one copy of an image on multilingual blogs, in the site root.
link://gallery_global/london => /galleries/trips/london/index.html
link://gallery_global/trips/london => /galleries/trips/london/index.html
(a
gallery
link could lead to eg. /en/galleries/trips/london/index.html)
-
gallery_path
(name, lang)¶ Link to an image gallery’s path.
It will try to find a gallery with that name if it’s not ambiguous or with that path. For example:
link://gallery/london => /galleries/trips/london/index.html
link://gallery/trips/london => /galleries/trips/london/index.html
-
gallery_rss
(img_list, dest_img_list, img_titles, lang, permalink, output_path, title)¶ Create a RSS showing the latest images in the gallery.
This doesn’t use generic_rss_renderer because it doesn’t involve Post objects.
-
gallery_rss_path
(name, lang)¶ Link to an image gallery’s RSS feed.
It will try to find a gallery with that name if it’s not ambiguous or with that path. For example:
link://gallery_rss/london => /galleries/trips/london/rss.xml
link://gallery_rss/trips/london => /galleries/trips/london/rss.xml
-
gen_tasks
()¶ Render image galleries.
-
get_excluded_images
(gallery_path)¶ Get list of excluded images.
-
get_image_list
(gallery_path)¶ Get list of included images.
-
name
= 'render_galleries'¶
-
parse_index
(gallery, input_folder, output_folder)¶ Return a Post object if there is an index.txt.
-
remove_excluded_image
(img, input_folder)¶ Remove excluded images.
-
render_gallery_index
(template_name, output_name, context, img_list, img_titles, thumbs, img_metadata)¶ Build the gallery index.
-
set_site
(site)¶ Set Nikola site.
-
nikola.plugins.task.gzip module¶
Create gzipped copies of files.
-
class
nikola.plugins.task.gzip.
GzipFiles
¶ Bases: :class:`nikola.plugin_categories.TaskMultiplier`
If appropiate, create tasks to create gzipped versions of files.
-
is_default
= True¶
-
name
= 'gzip'¶
-
process
(task, prefix)¶ Process tasks.
-
-
nikola.plugins.task.gzip.
create_gzipped_copy
(in_path, out_path, command=None)¶ Create gzipped copy of in_path and save it as out_path.
nikola.plugins.task.indexes module¶
Render the blog’s main index.
-
class
nikola.plugins.task.indexes.
Indexes
¶ Bases: :class:`nikola.plugin_categories.Taxonomy`
Classify for the blog’s main index.
-
apply_to_pages
= False¶
-
apply_to_posts
= True¶
-
classification_name
= 'index'¶
-
classify
(post, lang)¶ Classify the given post for the given language.
-
get_classification_friendly_name
(classification, lang, only_last_component=False)¶ Extract a friendly name from the classification.
-
get_implicit_classifications
(lang)¶ Return a list of classification strings which should always appear in posts_per_classification.
-
get_path
(classification, lang, dest_type='page')¶ Return a path for the given classification.
-
has_hierarchy
= False¶
-
more_than_one_classifications_per_post
= False¶
-
name
= 'classify_indexes'¶
-
omit_empty_classifications
= False¶
-
overview_page_variable_name
= None¶
-
path_handler_docstrings
= {'index': 'Link to a numbered index.\n\nExample:\n\nlink://index/3 => /index-3.html', 'index_atom': 'Link to a numbered Atom index.\n\nExample:\n\nlink://index_atom/3 => /index-3.atom', 'index_index': False, 'index_rss': 'A link to the RSS feed path.\n\nExample:\n\nlink://rss => /blog/rss.xml'}¶
-
provide_context_and_uptodate
(classification, lang, node=None)¶ Provide data for the context and the uptodate list for the list of the given classifiation.
-
set_site
(site)¶ Set Nikola site.
-
should_generate_atom_for_classification_page
(classification, post_list, lang)¶ Only generates Atom feed for list of posts for classification if this function returns True.
-
should_generate_classification_page
(classification, post_list, lang)¶ Only generates list of posts for classification if this function returns True.
-
should_generate_rss_for_classification_page
(classification, post_list, lang)¶ Only generates RSS feed for list of posts for classification if this function returns True.
-
show_list_as_index
= True¶
-
template_for_classification_overview
= None¶
-
template_for_single_list
= 'index.tmpl'¶
-
nikola.plugins.task.listings module¶
Render code listings.
-
class
nikola.plugins.task.listings.
Listings
¶ Bases: :class:`nikola.plugin_categories.Task`
Render code listings.
-
gen_tasks
()¶ Render pretty code listings.
-
listing_path
(namep, lang)¶ Return a link to a listing.
It will try to use the file name if it’s not ambiguous, or the file path.
Example:
link://listing/hello.py => /listings/tutorial/hello.py.html
link://listing/tutorial/hello.py => /listings/tutorial/hello.py.html
-
listing_source_path
(name, lang)¶ Return a link to the source code for a listing.
It will try to use the file name if it’s not ambiguous, or the file path.
Example:
link://listing_source/hello.py => /listings/tutorial/hello.py
link://listing_source/tutorial/hello.py => /listings/tutorial/hello.py
-
name
= 'render_listings'¶
-
register_output_name
(input_folder, rel_name, rel_output_name)¶ Register proper and improper file mappings.
-
set_site
(site)¶ Set Nikola site.
-
nikola.plugins.task.pages module¶
Render pages into output.
-
class
nikola.plugins.task.pages.
RenderPages
¶ Bases: :class:`nikola.plugin_categories.Task`
Render pages into output.
-
gen_tasks
()¶ Build final pages from metadata and HTML fragments.
-
name
= 'render_pages'¶
-
nikola.plugins.task.posts module¶
Build HTML fragments from metadata and text.
-
class
nikola.plugins.task.posts.
RenderPosts
¶ Bases: :class:`nikola.plugin_categories.Task`
Build HTML fragments from metadata and text.
-
dependence_on_timeline
(post, lang)¶ Check if a post depends on the timeline.
-
gen_tasks
()¶ Build HTML fragments from metadata and text.
-
name
= 'render_posts'¶
-
-
nikola.plugins.task.posts.
update_deps
(post, lang, task)¶ Update file dependencies as they might have been updated during compilation.
This is done for example by the ReST page compiler, which writes its dependencies into a .dep file. This file is read and incorporated when calling post.fragment_deps(), and only available /after/ compiling the fragment.
nikola.plugins.task.py3_switch module¶
nikola.plugins.task.redirect module¶
Generate redirections.
-
class
nikola.plugins.task.redirect.
Redirect
¶ Bases: :class:`nikola.plugin_categories.Task`
Generate redirections.
-
gen_tasks
()¶ Generate redirections tasks.
-
name
= 'redirect'¶
-
nikola.plugins.task.robots module¶
Generate a robots.txt file.
-
class
nikola.plugins.task.robots.
RobotsFile
¶ Bases: :class:`nikola.plugin_categories.LateTask`
Generate a robots.txt file.
-
gen_tasks
()¶ Generate a robots.txt file.
-
name
= 'robots_file'¶
-
nikola.plugins.task.rss module¶
nikola.plugins.task.scale_images module¶
Resize images and create thumbnails for them.
-
class
nikola.plugins.task.scale_images.
ScaleImage
¶ Bases: :class:`nikola.plugin_categories.Task`, :class:`nikola.image_processing.ImageProcessor`
Resize images and create thumbnails for them.
-
gen_tasks
()¶ Copy static files into the output folder.
-
name
= 'scale_images'¶
-
process_image
(src, dst, thumb)¶ Resize an image.
-
process_tree
(src, dst)¶ Process all images in a src tree and put the (possibly) rescaled images in the dst folder.
-
nikola.plugins.task.sources module¶
Copy page sources into the output.
-
class
nikola.plugins.task.sources.
Sources
¶ Bases: :class:`nikola.plugin_categories.Task`
Copy page sources into the output.
-
gen_tasks
()¶ Publish the page sources into the output.
-
name
= 'render_sources'¶
-
nikola.plugins.task.tags module¶
Render the tag pages and feeds.
Bases: :class:`nikola.plugin_categories.Taxonomy`
Classify the posts by tags.
Classify the given post for the given language.
Extract a friendly name from the classification.
Return a list of variants of the same tag in other languages.
Return a path for the list of all classifications.
Return a path for the given classification.
Return True if this taxonomy is enabled, or False otherwise.
Rearrange, modify or otherwise use the list of posts per classification and per language.
Provide data for the context and the uptodate list for the list of the given classifiation.
Provide data for the context and the uptodate list for the list of all classifiations.
Set site, which is a Nikola instance.
Slugify a tag name.
Module contents¶
Tasks for Nikola.