nikola.plugins.command package

Commands for Nikola. Subpackages Submodules nikola.plugins.command.check module

Check the generated site.

class nikola.plugins.command.check.CommandCheck(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Check the generated site.

analyze(fname, find_sources=False, check_remote=False)

Analyze links on a page.

cache = {}
checked_remote_targets = {}

Remove orphaned files.

cmd_options = [{'name': 'links', 'short': 'l', 'long': 'check-links', 'type': <class 'bool'>, 'default': False, 'help': 'Check for dangling links'}, {'name': 'files', 'short': 'f', 'long': 'check-files', 'type': <class 'bool'>, 'default': False, 'help': 'Check for unknown (orphaned and not generated) files'}, {'name': 'clean', 'long': 'clean-files', 'type': <class 'bool'>, 'default': False, 'help': 'Remove all unknown files, use with caution'}, {'name': 'find_sources', 'long': 'find-sources', 'type': <class 'bool'>, 'default': False, 'help': 'List possible source files for files with broken links.'}, {'name': 'verbose', 'long': 'verbose', 'short': 'v', 'type': <class 'bool'>, 'default': False, 'help': 'Be more verbose.'}, {'name': 'remote', 'long': 'remote', 'short': 'r', 'type': <class 'bool'>, 'default': False, 'help': 'Check that remote links work.'}]
doc_purpose = 'check links and files in the generated site'
doc_usage = '[-v] (-l [--find-sources] [-r] | -f [--clean-files])'
existing_targets = {}
name = 'check'

Check files in the site, find missing and orphaned files.

Check links on the site.


Create a filesystem relative path from an URL path.

nikola.plugins.command.check.real_scan_files(site, cache=None)

Scan for files. nikola.plugins.command.console module

Start debugging console.

class nikola.plugins.command.console.CommandConsole(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Start debugging console.


Run a bpython shell.

cmd_options = [{'name': 'bpython', 'short': 'b', 'long': 'bpython', 'type': <class 'bool'>, 'default': False, 'help': 'Use bpython'}, {'name': 'ipython', 'short': 'i', 'long': 'plain', 'type': <class 'bool'>, 'default': False, 'help': 'Use IPython'}, {'name': 'plain', 'short': 'p', 'long': 'plain', 'type': <class 'bool'>, 'default': False, 'help': 'Use the plain Python interpreter'}, {'name': 'command', 'short': 'c', 'long': 'command', 'type': <class 'str'>, 'default': None, 'help': 'Run a single command'}, {'name': 'script', 'short': 's', 'long': 'script', 'type': <class 'str'>, 'default': None, 'help': 'Execute a python script in the console context'}]
doc_description = 'The site engine is accessible as `site` and `nikola_site`, the config file as `conf`, and commands are available as `commands`.\nIf there is no console to use specified (as -b, -i, -p) it tries IPython, then falls back to bpython, and finally falls back to the plain Python console.'
doc_purpose = 'start an interactive Python console with access to your site'
header = 'Nikola v8.1.3 -- {0} Console (conf = configuration file, site, nikola_site = site engine, commands = nikola commands)'

Run an IPython shell.

name = 'console'

Run a plain Python shell.

shells = ['ipython', 'bpython', 'plain'] nikola.plugins.command.default_config module

Show the default configuration.

class nikola.plugins.command.default_config.CommandShowConfig(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Show the default configuration.

cmd_options = []
doc_purpose = 'Print the default Nikola configuration.'
doc_usage = ''
name = 'default_config'
needs_config = False nikola.plugins.command.deploy module

Deploy site.

class nikola.plugins.command.deploy.CommandDeploy(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Deploy site.

doc_description = 'Deploy the site by executing deploy commands from the presets listed on the command line.  If no presets are specified, `default` is executed.'
doc_purpose = 'deploy the site'
doc_usage = '[preset [preset...]]'
name = 'deploy' nikola.plugins.command.github_deploy module

Deploy site to GitHub Pages.

class nikola.plugins.command.github_deploy.CommandGitHubDeploy(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Deploy site to GitHub Pages.

cmd_options = [{'name': 'commit_message', 'short': 'm', 'long': 'message', 'default': 'Nikola auto commit.', 'type': <class 'str'>, 'help': 'Commit message'}]
doc_description = 'This command can be used to deploy your site to GitHub Pages. It uses ghp-import to do this task. It also optionally commits to the source branch.\n\nConfiguration help: https://getnikola.com/handbook.html#deploying-to-github'
doc_purpose = 'deploy the site to GitHub Pages'
doc_usage = '[-m COMMIT_MESSAGE]'
name = 'github_deploy'
exception nikola.plugins.command.github_deploy.DeployFailedException

Bases: Exception

An internal exception for deployment errors.


Check if ghp-import is installed.

nikola.plugins.command.github_deploy.uni_check_output(*args, **kwargs)

Run command and return output as Unicode (UTf-8). nikola.plugins.command.import_wordpress module

Import a WordPress dump.

class nikola.plugins.command.import_wordpress.CommandImportWordpress(*args, **kwargs)

Bases: nikola.plugin_categories.Command, nikola.plugins.basic_import.ImportMixin

Import a WordPress dump.

all_tags = {}
cmd_options = [{'name': 'output_folder', 'long': 'output-folder', 'short': 'o', 'default': 'new_site', 'help': 'Location to write imported content.'}, {'name': 'exclude_drafts', 'long': 'no-drafts', 'short': 'd', 'default': False, 'type': <class 'bool'>, 'help': "Don't import drafts"}, {'name': 'exclude_privates', 'long': 'exclude-privates', 'default': False, 'type': <class 'bool'>, 'help': "Don't import private posts"}, {'name': 'include_empty_items', 'long': 'include-empty-items', 'default': False, 'type': <class 'bool'>, 'help': 'Include empty posts and pages'}, {'name': 'squash_newlines', 'long': 'squash-newlines', 'default': False, 'type': <class 'bool'>, 'help': 'Shorten multiple newlines in a row to only two newlines'}, {'name': 'no_downloads', 'long': 'no-downloads', 'default': False, 'type': <class 'bool'>, 'help': 'Do not try to download files for the import'}, {'name': 'download_auth', 'long': 'download-auth', 'default': None, 'type': <class 'str'>, 'help': "Specify username and password for HTTP authentication (separated by ':')"}, {'name': 'separate_qtranslate_content', 'long': 'qtranslate', 'default': False, 'type': <class 'bool'>, 'help': "Look for translations generated by qtranslate plugin.\nWARNING: a default wordpress export won't allow to recover title translations.\nFor this to be possible consider applying the hack suggested at\nhttps://github.com/qtranslate/qtranslate-xt/issues/199 :\n\nIn wp-admin/includes/export.php change\n`echo apply_filters( 'the_title_rss', $post->post_title );\n\nto\n`echo apply_filters( 'the_title_export', $post->post_title );\n"}, {'name': 'translations_pattern', 'long': 'translations_pattern', 'default': '{path}.{lang}.{ext}', 'type': <class 'str'>, 'help': 'The pattern for translation files names'}, {'name': 'export_categories_as_categories', 'long': 'export-categories-as-categories', 'default': False, 'type': <class 'bool'>, 'help': 'Export categories as categories, instead of treating them as tags'}, {'name': 'export_comments', 'long': 'export-comments', 'default': False, 'type': <class 'bool'>, 'help': 'Export comments as .wpcomment files'}, {'name': 'html2text', 'long': 'html2text', 'default': False, 'type': <class 'bool'>, 'help': 'Uses html2text (needs to be installed with pip) to transform WordPress posts to MarkDown during import'}, {'name': 'transform_to_markdown', 'long': 'transform-to-markdown', 'default': False, 'type': <class 'bool'>, 'help': 'Uses WordPress page compiler to transform WordPress posts to HTML and then use html2text to transform them to MarkDown during import'}, {'name': 'transform_to_html', 'long': 'transform-to-html', 'default': False, 'type': <class 'bool'>, 'help': 'Uses WordPress page compiler to transform WordPress posts directly to HTML during import'}, {'name': 'use_wordpress_compiler', 'long': 'use-wordpress-compiler', 'default': False, 'type': <class 'bool'>, 'help': 'Instead of converting posts to markdown, leave them as is and use the WordPress page compiler'}, {'name': 'install_wordpress_compiler', 'long': 'install-wordpress-compiler', 'default': False, 'type': <class 'bool'>, 'help': 'Automatically installs the WordPress page compiler (either locally or in the new site) if required by other options.\nWarning: the compiler is GPL software!'}, {'name': 'tag_sanitizing_strategy', 'long': 'tag-sanitizing-strategy', 'default': 'first', 'help': 'lower: Convert all tag and category names to lower case\nfirst: Keep first spelling of tag or category name'}, {'name': 'one_file', 'long': 'one-file', 'default': False, 'type': <class 'bool'>, 'help': 'Save imported posts in the more modern one-file format.'}]
code_re1 = re.compile('\\[code.* lang.*?="(.*?)?".*\\](.*?)\\[/code\\]', re.MULTILINE|re.DOTALL)
code_re2 = re.compile('\\[sourcecode.* lang.*?="(.*?)?".*\\](.*?)\\[/sourcecode\\]', re.MULTILINE|re.DOTALL)
code_re3 = re.compile('\\[code.*?\\](.*?)\\[/code\\]', re.MULTILINE|re.DOTALL)
code_re4 = re.compile('\\[sourcecode.*?\\](.*?)\\[/sourcecode\\]', re.MULTILINE|re.DOTALL)
doc_purpose = 'import a WordPress dump'
doc_usage = '[options] wordpress_export_file'
download_url_content_to_file(url, dst_path)

Download some content (attachments) to a file.

classmethod get_channel_from_file(filename, xml_preprocessor=None)

Get channel from XML file.

An optional ‘xml_preprocessor’ allows to modify the xml (typically to deal with variations in tags injected by some WP plugin)

import_attachment(item, wordpress_namespace)

Import an attachment to the site.

import_postpage_item(item, wordpress_namespace, out_folder=None, attachments=None)

Take an item from the feed and creates a post file.


Import posts into the site.

name = 'import_wordpress'
needs_config = False

Populate context with config for the site.


Process attachments.


Process posts and pages.

classmethod read_xml_file(filename)

Read XML file into memory.

static transform_caption(content, use_html=False)

Transform captions.


Transform code blocks.

transform_content(content, post_format, attachments)

Transform content into appropriate format.


Replace multiple newlines with only two.

write_attachments_info(path, attachments)

Write attachments info file.

nikola.plugins.command.import_wordpress.get_text_tag(tag, name, default)

Get the text of an XML tag.

nikola.plugins.command.import_wordpress.install_plugin(site, plugin_name, output_dir=None, show_install_notes=False)

Install a Nikola plugin.


Uniformize the “tag” used by various version of qtranslate.

The resulting byte string will only contain one set of qtranslate tags (namely [:LG] and [:]), older ones being converted to new ones.


Parse the content of a wordpress post or page and separate languages.

For qtranslateX tags: [:LL]blabla[:]

Note: qtranslate* plugins had a troubled history and used various tags over time, application of the ‘modernize_qtranslate_tags’ function is required for this function to handle most of the legacy cases. nikola.plugins.command.init module

Create a new site.

class nikola.plugins.command.init.CommandInit(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Create a new site.

static ask_questions(target, demo=False)

Ask some questions about Nikola.

cmd_options = [{'name': 'quiet', 'long': 'quiet', 'short': 'q', 'default': False, 'type': <class 'bool'>, 'help': 'Do not ask questions about config.'}, {'name': 'demo', 'long': 'demo', 'short': 'd', 'default': False, 'type': <class 'bool'>, 'help': 'Create a site filled with example data.'}]
classmethod copy_sample_site(target)

Copy sample site data to target directory.

static create_configuration(target)

Create configuration file.

static create_configuration_to_string()

Return configuration file as a string.

classmethod create_empty_site(target)

Create an empty site with directories only.

doc_purpose = 'create a Nikola site in the specified folder'
doc_usage = '[--demo] [--quiet] folder'
name = 'init'
needs_config = False

Adapt TRANSLATIONS setting for all additional languages.

Return the string to configure NAVIGATION_LINKS.

nikola.plugins.command.init.get_default_translations_dict(default_lang, additional_languages)

Generate a TRANSLATIONS dict matching the config from ‘format_default_translations_config’.


Parse sample config with JSON.

nikola.plugins.command.init.test_destination(destination, demo=False)

Check if the destination already exists, which can break demo site creation. nikola.plugins.command.new_page module

Create a new page.

class nikola.plugins.command.new_page.CommandNewPage(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Create a new page.

cmd_options = [{'name': 'title', 'short': 't', 'long': 'title', 'type': <class 'str'>, 'default': '', 'help': 'Title for the page.'}, {'name': 'author', 'short': 'a', 'long': 'author', 'type': <class 'str'>, 'default': '', 'help': 'Author of the post.'}, {'name': 'onefile', 'short': '1', 'type': <class 'bool'>, 'default': False, 'help': 'Create the page with embedded metadata (single file format)'}, {'name': 'twofile', 'short': '2', 'type': <class 'bool'>, 'default': False, 'help': 'Create the page with separate metadata (two file format)'}, {'name': 'edit', 'short': 'e', 'type': <class 'bool'>, 'default': False, 'help': 'Open the page (and meta file, if any) in $EDITOR after creation.'}, {'name': 'content_format', 'short': 'f', 'long': 'format', 'type': <class 'str'>, 'default': '', 'help': 'Markup format for the page (use --available-formats for list)'}, {'name': 'available-formats', 'short': 'F', 'long': 'available-formats', 'type': <class 'bool'>, 'default': False, 'help': 'List all available input formats'}, {'name': 'import', 'short': 'i', 'long': 'import', 'type': <class 'str'>, 'default': '', 'help': 'Import an existing file instead of creating a placeholder'}]
doc_purpose = 'create a new page in the site'
doc_usage = '[options] [path]'
name = 'new_page' nikola.plugins.command.new_post module

Create a new post.

class nikola.plugins.command.new_post.CommandNewPost(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Create a new post.

cmd_options = [{'name': 'is_page', 'short': 'p', 'long': 'page', 'type': <class 'bool'>, 'default': False, 'help': 'Create a page instead of a blog post. (see also: `nikola new_page`)'}, {'name': 'title', 'short': 't', 'long': 'title', 'type': <class 'str'>, 'default': '', 'help': 'Title for the post.'}, {'name': 'author', 'short': 'a', 'long': 'author', 'type': <class 'str'>, 'default': '', 'help': 'Author of the post.'}, {'name': 'tags', 'long': 'tags', 'type': <class 'str'>, 'default': '', 'help': 'Comma-separated tags for the post.'}, {'name': 'onefile', 'short': '1', 'type': <class 'bool'>, 'default': False, 'help': 'Create the post with embedded metadata (single file format)'}, {'name': 'twofile', 'short': '2', 'type': <class 'bool'>, 'default': False, 'help': 'Create the post with separate metadata (two file format)'}, {'name': 'edit', 'short': 'e', 'type': <class 'bool'>, 'default': False, 'help': 'Open the post (and meta file, if any) in $EDITOR after creation.'}, {'name': 'content_format', 'short': 'f', 'long': 'format', 'type': <class 'str'>, 'default': '', 'help': 'Markup format for the post (use --available-formats for list)'}, {'name': 'available-formats', 'short': 'F', 'long': 'available-formats', 'type': <class 'bool'>, 'default': False, 'help': 'List all available input formats'}, {'name': 'schedule', 'short': 's', 'type': <class 'bool'>, 'default': False, 'help': 'Schedule the post based on recurrence rule'}, {'name': 'import', 'short': 'i', 'long': 'import', 'type': <class 'str'>, 'default': '', 'help': 'Import an existing file instead of creating a placeholder'}, {'name': 'date-path', 'short': 'd', 'long': 'date-path', 'type': <class 'bool'>, 'default': False, 'help': 'Create post with date path (eg. year/month/day, see NEW_POST_DATE_PATH_FORMAT in config)'}]
doc_purpose = 'create a new blog post or site page'
doc_usage = '[options] [path]'
filter_post_pages(compiler, is_post)

Return the correct entry from post_pages.

Information based on: * selected compilers * available compilers * post/page status

name = 'new_post'

List all available compilers in a human-friendly format.

nikola.plugins.command.new_post.get_date(schedule=False, rule=None, last_date=None, tz=None, iso8601=False)

Return a date stamp, given a recurrence rule.

schedule - bool:

whether to use the recurrence rule or not

rule - str:

an iCal RRULE string that specifies the rule for scheduling posts

last_date - datetime:

timestamp of the last post

tz - tzinfo:

the timezone used for getting the current time.

iso8601 - bool:

whether to force ISO 8601 dates (instead of locale-specific ones)

nikola.plugins.command.new_post.get_default_compiler(is_post, compilers, post_pages)

Given compilers and post_pages, return a reasonable default compiler for this kind of post/page. nikola.plugins.command.orphans module

List all orphans.

class nikola.plugins.command.orphans.CommandOrphans(*args, **kwargs)

Bases: nikola.plugin_categories.Command

List all orphans.

doc_description = 'List all orphans, i.e. all files that are in the output directory,\nbut are not generated by Nikola.\n\nOutput contains filenames only (it is passable to `xargs rm` or the like).'
doc_purpose = 'list all orphans'
name = 'orphans' nikola.plugins.command.plugin module

Manage plugins.

class nikola.plugins.command.plugin.CommandPlugin(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Manage plugins.

cmd_options = [{'name': 'install', 'short': 'i', 'long': 'install', 'type': <class 'str'>, 'default': '', 'help': 'Install a plugin.'}, {'name': 'uninstall', 'long': 'uninstall', 'short': 'r', 'type': <class 'str'>, 'default': '', 'help': 'Uninstall a plugin.'}, {'name': 'list', 'short': 'l', 'long': 'list', 'type': <class 'bool'>, 'default': False, 'help': 'Show list of available plugins.'}, {'name': 'url', 'short': 'u', 'long': 'url', 'type': <class 'str'>, 'help': 'URL for the plugin repository', 'default': 'https://plugins.getnikola.com/v8/plugins.json'}, {'name': 'user', 'long': 'user', 'type': <class 'bool'>, 'help': 'Install user-wide, available for all sites.', 'default': False}, {'name': 'upgrade', 'long': 'upgrade', 'type': <class 'bool'>, 'help': 'Upgrade all installed plugins.', 'default': False}, {'name': 'list_installed', 'long': 'list-installed', 'type': <class 'bool'>, 'help': 'List the installed plugins with their location.', 'default': False}]
do_install(url, name, show_install_notes=True)

Download and install a plugin.


Uninstall a plugin.


Upgrade all installed plugins.

doc_purpose = 'manage plugins'
doc_usage = '[-u url] [--user] [-i name] [-r name] [--upgrade] [-l] [--list-installed]'

Download the JSON file with all plugins.

json = None

List all available plugins.


List installed plugins.

name = 'plugin'
needs_config = False
output_dir = None nikola.plugins.command.serve module

Start test server.

class nikola.plugins.command.serve.CommandServe(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Start test server.

cmd_options = ({'name': 'port', 'short': 'p', 'long': 'port', 'default': 8000, 'type': <class 'int'>, 'help': 'Port number'}, {'name': 'address', 'short': 'a', 'long': 'address', 'type': <class 'str'>, 'default': '', 'help': 'Address to bind, defaults to all local IPv4 interfaces'}, {'name': 'detach', 'short': 'd', 'long': 'detach', 'type': <class 'bool'>, 'default': False, 'help': 'Detach from TTY (work in the background)'}, {'name': 'browser', 'short': 'b', 'long': 'browser', 'type': <class 'bool'>, 'default': False, 'help': 'Open the test server in a web browser'}, {'name': 'ipv6', 'short': '6', 'long': 'ipv6', 'type': <class 'bool'>, 'default': False, 'help': 'Use IPv6'})
dns_sd = None
doc_purpose = 'start the test webserver'
doc_usage = '[options]'
name = 'serve'
shutdown(signum=None, _frame=None)

Shut down the server that is running detached.

class nikola.plugins.command.serve.IPv6Server(server_address, RequestHandlerClass, bind_and_activate=True)

Bases: http.server.HTTPServer

An IPv6 HTTPServer.

address_family = 10
class nikola.plugins.command.serve.OurHTTPRequestHandler(*args, directory=None, **kwargs)

Bases: http.server.SimpleHTTPRequestHandler

A request handler, modified for Nikola.

extensions_map = {'': 'text/plain', '.Z': 'application/octet-stream', '.bz2': 'application/x-bzip2', '.gz': 'application/gzip', '.xz': 'application/x-xz'}

Log messages. Or not, depending on a setting.

quiet = False

Send response code and MIME header.

This is common code for GET and HEAD commands.

Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. nikola.plugins.command.status module

Display site status.

class nikola.plugins.command.status.CommandStatus(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Display site status.

cmd_options = [{'name': 'list_drafts', 'short': 'd', 'long': 'list-drafts', 'type': <class 'bool'>, 'default': False, 'help': 'List all drafts'}, {'name': 'list_modified', 'short': 'm', 'long': 'list-modified', 'type': <class 'bool'>, 'default': False, 'help': 'List all modified files since last deployment'}, {'name': 'list_private', 'short': 'p', 'long': 'list-private', 'type': <class 'bool'>, 'default': False, 'help': 'List all private posts'}, {'name': 'list_published', 'short': 'P', 'long': 'list-published', 'type': <class 'bool'>, 'default': False, 'help': 'List all published posts'}, {'name': 'list_scheduled', 'short': 's', 'long': 'list-scheduled', 'type': <class 'bool'>, 'default': False, 'help': 'List all scheduled posts'}]
doc_description = 'Show information about the posts and site deployment.'
doc_purpose = 'display site status'
doc_usage = '[-d|--list-drafts] [-m|--list-modified] [-p|--list-private] [-P|--list-published] [-s|--list-scheduled]'

Translate time into a human-friendly representation.

logger = None
name = 'status' nikola.plugins.command.subtheme module

Given a swatch name from bootswatch.com or hackerthemes.com and a parent theme, creates a custom theme.

class nikola.plugins.command.subtheme.CommandSubTheme(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Given a swatch name from bootswatch.com and a parent theme, creates a custom theme.

cmd_options = [{'name': 'name', 'short': 'n', 'long': 'name', 'default': 'custom', 'type': <class 'str'>, 'help': 'New theme name'}, {'name': 'swatch', 'short': 's', 'default': '', 'type': <class 'str'>, 'help': 'Name of the swatch from bootswatch.com.'}, {'name': 'parent', 'short': 'p', 'long': 'parent', 'default': 'bootstrap4', 'help': 'Parent theme name'}]
doc_purpose = 'given a swatch name from bootswatch.com or hackerthemes.com and a parent theme, creates a custom theme'
doc_usage = '[options]'
name = 'subtheme' nikola.plugins.command.theme module

Manage themes.

class nikola.plugins.command.theme.CommandTheme(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Manage themes.

cmd_options = [{'name': 'install', 'short': 'i', 'long': 'install', 'type': <class 'str'>, 'default': '', 'help': 'Install a theme.'}, {'name': 'uninstall', 'long': 'uninstall', 'short': 'r', 'type': <class 'str'>, 'default': '', 'help': 'Uninstall a theme.'}, {'name': 'list', 'short': 'l', 'long': 'list', 'type': <class 'bool'>, 'default': False, 'help': 'Show list of available themes.'}, {'name': 'list_installed', 'long': 'list-installed', 'type': <class 'bool'>, 'help': 'List the installed themes with their location.', 'default': False}, {'name': 'url', 'short': 'u', 'long': 'url', 'type': <class 'str'>, 'help': 'URL for the theme repository', 'default': 'https://themes.getnikola.com/v8/themes.json'}, {'name': 'getpath', 'short': 'g', 'long': 'get-path', 'type': <class 'str'>, 'default': '', 'help': 'Print the path for installed theme'}, {'name': 'copy-template', 'short': 'c', 'long': 'copy-template', 'type': <class 'str'>, 'default': '', 'help': 'Copy a built-in template into templates/ or your theme'}, {'name': 'new', 'short': 'n', 'long': 'new', 'type': <class 'str'>, 'default': '', 'help': 'Create a new theme'}, {'name': 'new_engine', 'long': 'engine', 'type': <class 'str'>, 'default': 'mako', 'help': 'Engine to use for new theme (mako or jinja)'}, {'name': 'new_parent', 'long': 'parent', 'type': <class 'str'>, 'default': 'base', 'help': 'Parent to use for new theme'}, {'name': 'new_legacy_meta', 'long': 'legacy-meta', 'type': <class 'bool'>, 'default': False, 'help': 'Create legacy meta files for new theme'}]

Copy the named template file from the parent to a local theme or to templates/.

do_install(name, data)

Download and install a theme.

do_install_deps(url, name)

Install themes and their dependencies.


Uninstall a theme.

doc_purpose = 'manage themes'
doc_usage = '[-u url] [-i theme_name] [-r theme_name] [-l] [--list-installed] [-g] [-n theme_name] [-c template_name]'

Download the JSON file with all plugins.


Get path for an installed theme.

json = None

List all available themes.


List all installed themes.

name = 'theme'
new_theme(name, engine, parent, create_legacy_meta=False)

Create a new theme.

output_dir = 'themes' nikola.plugins.command.version module

Print Nikola version.

class nikola.plugins.command.version.CommandVersion(*args, **kwargs)

Bases: nikola.plugin_categories.Command

Print Nikola version.

cmd_options = [{'name': 'check', 'long': 'check', 'short': '', 'default': False, 'type': <class 'bool'>, 'help': 'Check for new versions.'}]
doc_purpose = 'print the Nikola version number'
doc_usage = '[--check]'
name = 'version'
needs_config = False