1.1.1.2.1.1. nikola.plugins.command package

Commands for Nikola.

1.1.1.2.1.1.1. Subpackages

1.1.1.2.1.1.2. Submodules

1.1.1.2.1.1.3. nikola.plugins.command.check module

Check the generated site.

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

Bases: Command

Check the generated site.

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

Analyze links on a page.

cache = {}
checked_remote_targets = {}
clean_files()

Remove orphaned files.

cmd_options = [{'default': False, 'help': 'Check for dangling links', 'long': 'check-links', 'name': 'links', 'short': 'l', 'type': <class 'bool'>}, {'default': False, 'help': 'Check for unknown (orphaned and not generated) files', 'long': 'check-files', 'name': 'files', 'short': 'f', 'type': <class 'bool'>}, {'default': False, 'help': 'Remove all unknown files, use with caution', 'long': 'clean-files', 'name': 'clean', 'type': <class 'bool'>}, {'default': False, 'help': 'List possible source files for files with broken links.', 'long': 'find-sources', 'name': 'find_sources', 'type': <class 'bool'>}, {'default': False, 'help': 'Be more verbose.', 'long': 'verbose', 'name': 'verbose', 'short': 'v', 'type': <class 'bool'>}, {'default': False, 'help': 'Check that remote links work.', 'long': 'remote', 'name': 'remote', 'short': 'r', 'type': <class 'bool'>}, {'default': 30, 'help': 'Timeout (in seconds) for HTTP requests in remote checks.', 'long': 'timeout', 'name': 'timeout', 'short': 't', 'type': <class 'int'>}, {'default': False, 'help': 'Ignore query strings for internal links.', 'long': 'ignore-query-strings', 'name': 'ignore_query_strings', 'short': 'q', 'type': <class 'bool'>}]
doc_purpose = 'check links and files in the generated site'
doc_usage = '[-v] (-l [--find-sources] [-r] | -f [--clean-files])'
existing_targets = {}
name = 'check'
scan_files()

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

Check links on the site.

timeout = None
nikola.plugins.command.check.fs_relpath_from_url_path(url_path)

Create a filesystem relative path from an URL path.

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

Scan for files.

1.1.1.2.1.1.4. nikola.plugins.command.console module

Start debugging console.

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

Bases: Command

Start debugging console.

bpython(willful=True)

Run a bpython shell.

cmd_options = [{'default': False, 'help': 'Use bpython', 'long': 'bpython', 'name': 'bpython', 'short': 'b', 'type': <class 'bool'>}, {'default': False, 'help': 'Use IPython', 'long': 'plain', 'name': 'ipython', 'short': 'i', 'type': <class 'bool'>}, {'default': False, 'help': 'Use the plain Python interpreter', 'long': 'plain', 'name': 'plain', 'short': 'p', 'type': <class 'bool'>}, {'default': None, 'help': 'Run a single command', 'long': 'command', 'name': 'command', 'short': 'c', 'type': <class 'str'>}, {'default': None, 'help': 'Execute a python script in the console context', 'long': 'script', 'name': 'script', 'short': 's', 'type': <class 'str'>}]
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.3.0 -- {0} Console (conf = configuration file, site, nikola_site = site engine, commands = nikola commands)'
ipython(willful=True)

Run an IPython shell.

name = 'console'
plain(willful=True)

Run a plain Python shell.

shells = ['ipython', 'bpython', 'plain']

1.1.1.2.1.1.5. nikola.plugins.command.default_config module

Show the default configuration.

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

Bases: Command

Show the default configuration.

cmd_options = []
doc_purpose = 'Print the default Nikola configuration.'
doc_usage = ''
name = 'default_config'
needs_config = False

1.1.1.2.1.1.6. nikola.plugins.command.deploy module

Deploy site.

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

Bases: 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'

1.1.1.2.1.1.7. nikola.plugins.command.github_deploy module

Deploy site to GitHub Pages.

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

Bases: Command

Deploy site to GitHub Pages.

cmd_options = [{'default': 'Nikola auto commit.', 'help': 'Commit message', 'long': 'message', 'name': 'commit_message', 'short': 'm', 'type': <class 'str'>}]
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.

nikola.plugins.command.github_deploy.check_ghp_import_installed()

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).

1.1.1.2.1.1.8. nikola.plugins.command.import_wordpress module

Import a WordPress dump.

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

Bases: Command, ImportMixin

Import a WordPress dump.

all_tags = {}
cmd_options = [{'default': 'new_site', 'help': 'Location to write imported content.', 'long': 'output-folder', 'name': 'output_folder', 'short': 'o'}, {'default': False, 'help': "Don't import drafts", 'long': 'no-drafts', 'name': 'exclude_drafts', 'short': 'd', 'type': <class 'bool'>}, {'default': False, 'help': "Don't import private posts", 'long': 'exclude-privates', 'name': 'exclude_privates', 'type': <class 'bool'>}, {'default': False, 'help': 'Include empty posts and pages', 'long': 'include-empty-items', 'name': 'include_empty_items', 'type': <class 'bool'>}, {'default': False, 'help': 'Shorten multiple newlines in a row to only two newlines', 'long': 'squash-newlines', 'name': 'squash_newlines', 'type': <class 'bool'>}, {'default': False, 'help': 'Do not try to download files for the import', 'long': 'no-downloads', 'name': 'no_downloads', 'type': <class 'bool'>}, {'default': None, 'help': "Specify username and password for HTTP authentication (separated by ':')", 'long': 'download-auth', 'name': 'download_auth', 'type': <class 'str'>}, {'default': False, '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", 'long': 'qtranslate', 'name': 'separate_qtranslate_content', 'type': <class 'bool'>}, {'default': '{path}.{lang}.{ext}', 'help': 'The pattern for translation files names', 'long': 'translations_pattern', 'name': 'translations_pattern', 'type': <class 'str'>}, {'default': False, 'help': 'Export categories as categories, instead of treating them as tags', 'long': 'export-categories-as-categories', 'name': 'export_categories_as_categories', 'type': <class 'bool'>}, {'default': False, 'help': 'Export comments as .wpcomment files', 'long': 'export-comments', 'name': 'export_comments', 'type': <class 'bool'>}, {'default': False, 'help': 'Uses html2text (needs to be installed with pip) to transform WordPress posts to MarkDown during import', 'long': 'html2text', 'name': 'html2text', 'type': <class 'bool'>}, {'default': False, 'help': 'Uses WordPress page compiler to transform WordPress posts to HTML and then use html2text to transform them to MarkDown during import', 'long': 'transform-to-markdown', 'name': 'transform_to_markdown', 'type': <class 'bool'>}, {'default': False, 'help': 'Uses WordPress page compiler to transform WordPress posts directly to HTML during import', 'long': 'transform-to-html', 'name': 'transform_to_html', 'type': <class 'bool'>}, {'default': False, 'help': 'Instead of converting posts to markdown, leave them as is and use the WordPress page compiler', 'long': 'use-wordpress-compiler', 'name': 'use_wordpress_compiler', 'type': <class 'bool'>}, {'default': False, '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!', 'long': 'install-wordpress-compiler', 'name': 'install_wordpress_compiler', 'type': <class 'bool'>}, {'default': 'first', 'help': 'lower: Convert all tag and category names to lower case\nfirst: Keep first spelling of tag or category name', 'long': 'tag-sanitizing-strategy', 'name': 'tag_sanitizing_strategy'}, {'default': False, 'help': 'Save imported posts in the more modern one-file format.', 'long': 'one-file', 'name': 'one_file', 'type': <class 'bool'>}]
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(channel)

Import posts into the site.

name = 'import_wordpress'
needs_config = False
populate_context(channel)

Populate context with config for the site.

process_item_if_attachment(item)

Process attachments.

process_item_if_post_or_page(item)

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(content)

Transform code blocks.

transform_content(content, post_format, attachments)

Transform content into appropriate format.

transform_multiple_newlines(content)

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.

nikola.plugins.command.import_wordpress.modernize_qtranslate_tags(xml_bytes)

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.

nikola.plugins.command.import_wordpress.separate_qtranslate_tagged_langs(text)

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.

1.1.1.2.1.1.9. nikola.plugins.command.init module

Create a new site.

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

Bases: Command

Create a new site.

static ask_questions(target, demo=False)

Ask some questions about Nikola.

cmd_options = [{'default': False, 'help': 'Do not ask questions about config.', 'long': 'quiet', 'name': 'quiet', 'short': 'q', 'type': <class 'bool'>}, {'default': False, 'help': 'Create a site filled with example data.', 'long': 'demo', 'name': 'demo', 'short': 'd', 'type': <class 'bool'>}]
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
nikola.plugins.command.init.format_default_translations_config(additional_languages)

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’.

nikola.plugins.command.init.prepare_config(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.

1.1.1.2.1.1.10. nikola.plugins.command.new_page module

Create a new page.

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

Bases: Command

Create a new page.

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

1.1.1.2.1.1.11. nikola.plugins.command.new_post module

Create a new post.

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

Bases: Command

Create a new post.

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

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.

1.1.1.2.1.1.12. nikola.plugins.command.orphans module

List all orphans.

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

Bases: 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'

1.1.1.2.1.1.13. nikola.plugins.command.plugin module

Manage plugins.

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

Bases: Command

Manage plugins.

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

Download and install a plugin.

do_uninstall(name)

Uninstall a plugin.

do_upgrade(url)

Upgrade all installed plugins.

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

Download the JSON file with all plugins.

json = None
list_available(url)

List all available plugins.

list_installed()

List installed plugins.

name = 'plugin'
needs_config = False
output_dir = None

1.1.1.2.1.1.14. nikola.plugins.command.serve module

Start test server.

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

Bases: Command

Start test server.

cmd_options = ({'default': 8000, 'help': 'Port number', 'long': 'port', 'name': 'port', 'short': 'p', 'type': <class 'int'>}, {'default': '', 'help': 'Address to bind, defaults to all local IPv4 interfaces', 'long': 'address', 'name': 'address', 'short': 'a', 'type': <class 'str'>}, {'default': False, 'help': 'Detach from TTY (work in the background)', 'long': 'detach', 'name': 'detach', 'short': 'd', 'type': <class 'bool'>}, {'default': False, 'help': 'Open the test server in a web browser', 'long': 'browser', 'name': 'browser', 'short': 'b', 'type': <class 'bool'>}, {'default': False, 'help': 'Use IPv6', 'long': 'ipv6', 'name': 'ipv6', 'short': '6', 'type': <class 'bool'>})
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: HTTPServer

An IPv6 HTTPServer.

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

Bases: 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_message(*args)

Log messages. Or not, depending on a setting.

quiet = False
send_head()

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.

1.1.1.2.1.1.15. nikola.plugins.command.status module

Display site status.

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

Bases: Command

Display site status.

cmd_options = [{'default': False, 'help': 'List all drafts', 'long': 'list-drafts', 'name': 'list_drafts', 'short': 'd', 'type': <class 'bool'>}, {'default': False, 'help': 'List all modified files since last deployment', 'long': 'list-modified', 'name': 'list_modified', 'short': 'm', 'type': <class 'bool'>}, {'default': False, 'help': 'List all private posts', 'long': 'list-private', 'name': 'list_private', 'short': 'p', 'type': <class 'bool'>}, {'default': False, 'help': 'List all published posts', 'long': 'list-published', 'name': 'list_published', 'short': 'P', 'type': <class 'bool'>}, {'default': False, 'help': 'List all scheduled posts', 'long': 'list-scheduled', 'name': 'list_scheduled', 'short': 's', 'type': <class 'bool'>}]
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]'
human_time(dt)

Translate time into a human-friendly representation.

logger = None
name = 'status'

1.1.1.2.1.1.16. 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: Command

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

cmd_options = [{'default': 'custom', 'help': 'New theme name', 'long': 'name', 'name': 'name', 'short': 'n', 'type': <class 'str'>}, {'default': '', 'help': 'Name of the swatch from bootswatch.com.', 'name': 'swatch', 'short': 's', 'type': <class 'str'>}, {'default': 'bootstrap4', 'help': 'Parent theme name', 'long': 'parent', 'name': 'parent', 'short': 'p'}]
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'

1.1.1.2.1.1.17. nikola.plugins.command.theme module

Manage themes.

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

Bases: Command

Manage themes.

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

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.

do_uninstall(name)

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]'
get_json(url)

Download the JSON file with all plugins.

get_path(name)

Get path for an installed theme.

json = None
list_available(url)

List all available themes.

list_installed()

List all installed themes.

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

Create a new theme.

output_dir = 'themes'

1.1.1.2.1.1.18. nikola.plugins.command.version module

Print Nikola version.

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

Bases: Command

Print Nikola version.

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