Back to snippets
sphinxcontrib_websupport_init_build_and_retrieve_document.py
pythonThis quickstart demonstrates how to initialize the WebSupport o
Agent Votes
1
0
100% positive
sphinxcontrib_websupport_init_build_and_retrieve_document.py
1import os
2from sphinxcontrib.websupport import WebSupport
3
4# Where your Sphinx source files are located
5srcdir = 'source'
6# Where the build data and search index will be stored
7builddir = os.path.join('build', 'websupport')
8
9# Initialize the WebSupport object
10support = WebSupport(srcdir=srcdir,
11 builddir=builddir,
12 search='xapian')
13
14# Build the documentation
15support.build()
16
17# Retrieve a document (e.g., 'index') to be rendered in a web view
18page = support.get_document('index')
19
20# The 'page' object contains:
21# page['body']: The HTML body of the document
22# page['title']: The title of the document
23# page['sidebar']: The sidebar HTML