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 = [{'long': 'port', 'help': 'Port number (default: 8000)', 'name': 'port', 'default': 8000, 'type': <class 'int'>, 'short': 'p'}, {'long': 'address', 'help': 'Address to bind (default: 127.0.0.1 -- localhost)', 'name': 'address', 'type': <class 'str'>, 'default': '127.0.0.1', 'short': 'a'}, {'long': 'browser', 'help': 'Start a web browser', 'name': 'browser', 'type': <class 'bool'>, 'default': False, 'short': 'b'}, {'long': 'ipv6', 'help': 'Use IPv6', 'name': 'ipv6', 'default': False, 'type': <class 'bool'>, 'short': '6'}, {'long': 'no-server', 'help': 'Disable the server, automate rebuilds only', 'name': 'no-server', 'type': <class 'bool'>, 'default': False}]
delta_last_rebuild = datetime.timedelta(0, 0, 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'
reload_page(event)

Reload the page.

run_nikola_build(event)

Rebuild the site.

run_rebuild_queue()

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

send_to_websockets(message)

Send a message to all open WebSockets.

serve_livereload_js(request)

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

serve_robots_txt(request)

Handle requests to /robots.txt.

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

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.

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.

on_any_event(event)

Handle all file events.

nikola.plugins.command.auto.windows_ctrlc_workaround()

Work around bpo-23057.