nikola.plugins.command.auto package

Module contents

Automatic rebuilds for Nikola.

class nikola.plugins.command.auto.CommandAuto(*args, **kwargs)

Bases: :class:`nikola.plugin_categories.Command`

Automatic rebuilds for Nikola.

cmd_options = [{'name': 'port', 'short': 'p', 'long': 'port', 'default': 8000, 'type': <class 'int'>, 'help': 'Port number (default: 8000)'}, {'name': 'address', 'short': 'a', 'long': 'address', 'type': <class 'str'>, 'default': '127.0.0.1', 'help': 'Address to bind (default: 127.0.0.1 -- localhost)'}, {'name': 'browser', 'short': 'b', 'long': 'browser', 'type': <class 'bool'>, 'help': 'Start a web browser', 'default': False}, {'name': 'ipv6', 'short': '6', 'long': 'ipv6', 'default': False, 'type': <class 'bool'>, 'help': 'Use IPv6'}, {'name': 'no-server', 'long': 'no-server', 'default': False, 'type': <class 'bool'>, 'help': 'Disable the server, automate rebuilds only'}]
delta_last_rebuild = datetime.timedelta(microseconds=100000)
dns_sd = None
doc_purpose = 'builds and serves a site; automatically detects site changes, rebuilds, and optionally refreshes a browser'
has_server = True
name = 'auto'
async reload_page(event)

Reload the page.

async run_nikola_build(event)

Rebuild the site.

async run_rebuild_queue()

Run rebuilds from a queue (Nikola can only build in a single instance).

async send_to_websockets(message)

Send a message to all open WebSockets.

async serve_livereload_js(request)

Handle requests to /livereload.js and serve the JS file.

async serve_robots_txt(request)

Handle requests to /robots.txt.

async websocket_handler(request)

Handle requests to /livereload and initiate WebSocket communication.

class nikola.plugins.command.auto.ConfigEventHandler(configuration_filename, function, loop)

Bases: :class:`nikola.plugins.command.auto.NikolaEventHandler`

A Nikola-specific handler for Watchdog that handles the config file (as a workaround).

async on_any_event(event)

Handle file events if they concern the configuration file.

class nikola.plugins.command.auto.IndexHtmlStaticResource(modify_html=True, snippet='</head>', *args, **kwargs)

Bases: :class:`aiohttp.web_urldispatcher.StaticResource`

A StaticResource implementation that serves /index.html in directory roots.

async handle_file(request, filename, from_index=None)

Handle file requests.

modify_html = True
snippet = '</head>'
transform_html(text)

Apply some transforms to HTML content.

class nikola.plugins.command.auto.NikolaEventHandler(function, loop)

Bases: :class:`object`

A Nikola-specific event handler for Watchdog. Based on code from hachiko.

dispatch(event)

Dispatch events to handler.

async on_any_event(event)

Handle all file events.

async nikola.plugins.command.auto.windows_ctrlc_workaround()

Work around bpo-23057.