1.1.1.2.1.1.1.1. nikola.plugins.command.auto package¶
Automatic rebuilds for Nikola.
- class nikola.plugins.command.auto.CommandAuto(*args, **kwargs)¶
Bases:
Command
Automatic rebuilds for Nikola.
- cmd_options = [{'default': 8000, 'help': 'Port number', 'long': 'port', 'name': 'port', 'short': 'p', 'type': <class 'int'>}, {'default': '127.0.0.1', 'help': 'Address to bind', 'long': 'address', 'name': 'address', 'short': 'a', 'type': <class 'str'>}, {'default': False, 'help': 'Start 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'>}, {'default': False, 'help': 'Disable the server, automate rebuilds only', 'long': 'no-server', 'name': 'no-server', 'type': <class 'bool'>}, {'default': 0, 'help': 'Number of subprocesses', 'long': 'process', 'name': 'process', 'section': 'Arguments passed to `nikola build`', 'short': 'n', 'type': <class 'int'>}, {'default': 'process', 'help': "Parallelization mode ('process' or 'thread')", 'long': 'parallel-type', 'name': 'parallel-type', 'section': 'Arguments passed to `nikola build`', 'short': 'P', 'type': <class 'str'>}, {'default': '.doit.db', 'help': 'Database file', 'long': 'db-file', 'name': 'db-file', 'section': 'Arguments passed to `nikola build`', 'type': <class 'str'>}, {'default': 'dbm', 'help': "Database backend ('dbm', 'json', 'sqlite3')", 'long': 'backend', 'name': 'backend', 'section': 'Arguments passed to `nikola build`', 'type': <class 'str'>}, {'default': False, 'help': 'Use polling to notice changes behind symbolic links. This may reduce performance.', 'long': 'poll', 'name': 'poll', 'type': <class 'bool'>}]¶
- 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 queue_rebuild(event) None ¶
Rebuild the site.
- async reload_page(event) None ¶
Reload the page.
- async remove_websockets(_app) None ¶
Remove all websockets.
- async run_initial_rebuild() None ¶
Run an initial rebuild.
- async run_rebuild_queue() None ¶
Run rebuilds from a queue (Nikola can only build in a single instance).
- async run_reload_queue() None ¶
Send reloads from a queue to limit CPU usage.
- async send_to_websockets(message: dict) None ¶
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 set_up_server(host: str, port: int, base_path: str, out_folder: str) None ¶
Set up aiohttp server and start it.
- web_runner: web.AppRunner = None¶
- async websocket_handler(request)¶
Handle requests to /livereload and initiate WebSocket communication.
- class nikola.plugins.command.auto.ConfigEventHandler(configuration_filename, function, loop)¶
Bases:
NikolaEventHandler
A Nikola-specific handler for Watchdog that handles the config file (as a workaround).
- dispatch(event)¶
Handle file events if they concern the configuration file.
- class nikola.plugins.command.auto.IndexHtmlStaticResource(modify_html=True, snippet='</head>', *args, **kwargs)¶
Bases:
StaticResource
A StaticResource implementation that serves /index.html in directory roots.
- async handle_file(request: Request, filename: str, from_index=None) Response ¶
Handle file requests.
- modify_html = True¶
- snippet = '</head>'¶
- transform_html(text: str) str ¶
Apply some transforms to HTML content.