1.1.1.2.1.4. nikola.plugins.task package¶
Tasks for Nikola.
1.1.1.2.1.4.1. Submodules¶
1.1.1.2.1.4.2. nikola.plugins.task.archive module¶
Classify the posts in archives.
- class nikola.plugins.task.archive.Archive¶
Bases:
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) 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¶
1.1.1.2.1.4.4. nikola.plugins.task.bundles module¶
Bundle assets.
- class nikola.plugins.task.bundles.BuildBundles¶
Bases:
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.
1.1.1.2.1.4.5. nikola.plugins.task.categories module¶
Render the category pages and feeds.
- class nikola.plugins.task.categories.ClassifyCategories¶
Bases:
Taxonomy
Classify the posts by categories.
- add_other_languages_variable = True¶
- always_disable_atom = False¶
- always_disable_rss = False¶
- apply_to_pages = False¶
- apply_to_posts = True¶
- classification_name = 'category'¶
- 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_other_language_variants(classification, lang, classifications_per_language)¶
Return a list of variants of the same category in other languages.
- get_overview_path(lang, dest_type='page')¶
Return a path for the list of all classifications.
- 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 = False¶
- is_enabled(lang=None)¶
Return True if this taxonomy is enabled, or False otherwise.
- minimum_post_count_per_classification_in_overview = 1¶
- more_than_one_classifications_per_post = False¶
- name = 'classify_categories'¶
- omit_empty_classifications = True¶
- overview_page_hierarchy_variable_name = 'cat_hierarchy'¶
- overview_page_items_variable_name = 'cat_items'¶
- overview_page_variable_name = 'categories'¶
- path_handler_docstrings = {'category': 'A link to a category. Takes page number as optional keyword argument.\n\nExample:\n\nlink://category/dogs => /categories/dogs.html', 'category_atom': "A link to a category's Atom feed.\n\nExample:\n\nlink://category_atom/dogs => /categories/dogs.atom", 'category_index': 'A link to the category index.\n\nExample:\n\nlink://category_index => /categories/index.html', 'category_rss': "A link to a category's RSS feed.\n\nExample:\n\nlink://category_rss/dogs => /categories/dogs.xml"}¶
- 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.
- provide_overview_context_and_uptodate(lang)¶
Provide data for the context and the uptodate list for the list of all classifiations.
- recombine_classification_from_hierarchy(hierarchy)¶
Given a list of parts in the hierarchy, return the classification string.
- set_site(site)¶
Set site, which is a Nikola instance.
- 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_subcategories_list = False¶
- slugify_category_name(path, lang)¶
Slugify a category name.
- slugify_tag_name(name, lang)¶
Slugify a tag name.
- template_for_classification_overview = 'tags.tmpl'¶
1.1.1.2.1.4.6. nikola.plugins.task.copy_assets module¶
Copy theme assets into output.
1.1.1.2.1.4.7. nikola.plugins.task.copy_files module¶
Copy static files into the output folder.
1.1.1.2.1.4.8. nikola.plugins.task.galleries module¶
Render image galleries.
- class nikola.plugins.task.galleries.Galleries¶
Bases:
Task
,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: Dict[str, datetime.datetime] = {}¶
- 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.
1.1.1.2.1.4.9. nikola.plugins.task.gzip module¶
Create gzipped copies of files.
- class nikola.plugins.task.gzip.GzipFiles¶
Bases:
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.
1.1.1.2.1.4.10. nikola.plugins.task.indexes module¶
Render the blog’s main index.
- class nikola.plugins.task.indexes.Indexes¶
Bases:
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'¶
1.1.1.2.1.4.11. nikola.plugins.task.listings module¶
Render code listings.
- class nikola.plugins.task.listings.Listings¶
Bases:
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.
1.1.1.2.1.4.12. nikola.plugins.task.page_index module¶
Render the page index.
- class nikola.plugins.task.page_index.PageIndex¶
Bases:
Taxonomy
Classify for the page index.
- always_disable_atom = True¶
- always_disable_rss = True¶
- apply_to_pages = True¶
- apply_to_posts = False¶
- classification_name = 'page_index_folder'¶
- classify(post, lang)¶
Classify the given post for the given language.
- extract_hierarchy(dirname)¶
Given a classification, return a list of parts in the hierarchy.
- get_classification_friendly_name(dirname, lang, only_last_component=False)¶
Extract a friendly name from the classification.
- get_path(hierarchy, lang, dest_type='page')¶
Return a path for the given classification.
- has_hierarchy = True¶
- include_posts_from_subhierarchies = False¶
- is_enabled(lang=None)¶
Return True if this taxonomy is enabled, or False otherwise.
- more_than_one_classifications_per_post = False¶
- name = 'classify_page_index'¶
- omit_empty_classifications = True¶
- overview_page_variable_name = 'page_folder'¶
- path_handler_docstrings = {'page_index_folder': None, 'page_index_folder_atom': None, 'page_index_folder_index': None, 'page_index_folder_rss': None}¶
- provide_context_and_uptodate(dirname, 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.
- should_generate_classification_page(dirname, post_list, lang)¶
Only generates list of posts for classification if this function returns True.
- show_list_as_index = False¶
- template_for_classification_overview = None¶
- template_for_single_list = 'list.tmpl'¶
1.1.1.2.1.4.13. nikola.plugins.task.pages module¶
Render pages into output.
1.1.1.2.1.4.14. nikola.plugins.task.posts module¶
Build HTML fragments from metadata and text.
- class nikola.plugins.task.posts.RenderPosts¶
Bases:
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.
1.1.1.2.1.4.15. nikola.plugins.task.redirect module¶
Generate redirections.
1.1.1.2.1.4.16. nikola.plugins.task.robots module¶
Generate a robots.txt file.
1.1.1.2.1.4.17. nikola.plugins.task.scale_images module¶
Resize images and create thumbnails for them.
- class nikola.plugins.task.scale_images.ScaleImage¶
Bases:
Task
,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.
1.1.1.2.1.4.18. nikola.plugins.task.sitemap module¶
Generate a sitemap.
- class nikola.plugins.task.sitemap.Sitemap¶
Bases:
LateTask
Generate a sitemap.
- gen_tasks()¶
Generate a sitemap.
- get_lastmod(p)¶
Get last modification date.
- name = 'sitemap'¶
- nikola.plugins.task.sitemap.get_base_path(base)¶
Return the path of a base URL if it contains one.
>>> get_base_path('http://some.site') == '/' True >>> get_base_path('http://some.site/') == '/' True >>> get_base_path('http://some.site/some/sub-path') == '/some/sub-path/' True >>> get_base_path('http://some.site/some/sub-path/') == '/some/sub-path/' True
1.1.1.2.1.4.19. nikola.plugins.task.sources module¶
Copy page sources into the output.
1.1.1.2.1.4.21. nikola.plugins.task.taxonomies module¶
Render the taxonomy overviews, classification pages and feeds.