summaryrefslogtreecommitdiff
path: root/doc/development
diff options
context:
space:
mode:
authorChris Holdgraf <choldgraf@berkeley.edu>2020-07-22 16:30:49 -0700
committerStephen Finucane <stephenfinucane@hotmail.com>2020-07-29 10:38:18 +0100
commitc7085162d133bc6e1647b063995ddfb9f909b2dc (patch)
treeb8527d600181b47f62e2cd812f1141b8a8a92820 /doc/development
parent924befa07e792739d4878e0121373ea4fa0ca9ca (diff)
downloadsphinx-git-c7085162d133bc6e1647b063995ddfb9f909b2dc.tar.gz
rearranging a few docs and small updates
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/builders.rst (renamed from doc/development/tutorials/builders.rst)22
-rw-r--r--doc/development/index.rst7
-rw-r--r--doc/development/theming.rst (renamed from doc/development/tutorials/theming-dev.rst)28
-rw-r--r--doc/development/tutorials/index.rst7
-rw-r--r--doc/development/tutorials/overview.rst2
5 files changed, 44 insertions, 22 deletions
diff --git a/doc/development/tutorials/builders.rst b/doc/development/builders.rst
index b2e43a2ae..bb6777023 100644
--- a/doc/development/tutorials/builders.rst
+++ b/doc/development/builders.rst
@@ -15,16 +15,18 @@ group. The name of the entry point needs to match your builder's
:attr:`~.Builder.name` attribute, which is the name passed to the
:option:`sphinx-build -b` option. The entry point value should equal the
dotted name of the extension module. Here is an example of how an entry point
-for 'mybuilder' can be defined in the extension's ``setup.py``::
-
- setup(
- # ...
- entry_points={
- 'sphinx.builders': [
- 'mybuilder = my.extension.module',
- ],
- }
- )
+for 'mybuilder' can be defined in the extension's ``setup.py``
+
+.. code-block:: python
+
+ setup(
+ # ...
+ entry_points={
+ 'sphinx.builders': [
+ 'mybuilder = my.extension.module',
+ ],
+ }
+ )
Note that it is still necessary to register the builder using
:meth:`~.Sphinx.add_builder` in the extension's :func:`setup` function.
diff --git a/doc/development/index.rst b/doc/development/index.rst
index 6a3406a20..2025b3ec7 100644
--- a/doc/development/index.rst
+++ b/doc/development/index.rst
@@ -11,3 +11,10 @@ wish to use Sphinx with existing extensions, refer to :doc:`/usage/index`.
:maxdepth: 2
tutorials/index
+ builders
+
+.. toctree::
+ :caption: Theming
+ :maxdepth: 2
+
+ theming
diff --git a/doc/development/tutorials/theming-dev.rst b/doc/development/theming.rst
index ad6b73a6c..ea993e679 100644
--- a/doc/development/tutorials/theming-dev.rst
+++ b/doc/development/theming.rst
@@ -231,6 +231,7 @@ function as a callback for :event:`html-page-context`.
return "Your string is %s" % mystring
# Add it to the page's context
context['my_func'] = my_func
+
# Your extension's setup function
def setup(app):
app.connect("html-page-context", setup_my_func)
@@ -244,7 +245,7 @@ Now, you will have access to this function in jinja like so:
</div>
-Inject javsacript based on user configuration
+Inject JavaScript based on user configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If your extension makes use of JavaScript, it can be useful to allow users
@@ -257,15 +258,34 @@ configuration.
First, you may append ``_t`` to the end of any static files included with your
extension. This will cause Sphinx to process these files with the templating
-engine, allowing you to embed variables and control behavior. See
-:ref:`theming-static-templates` for more information.
+engine, allowing you to embed variables and control behavior.
+
+For example, the following JavaScript structure:
+
+.. code-block:: bash
+
+ mymodule/
+ ├── _static
+ │   └── myjsfile.js_t
+ └── mymodule.py
+
+Will result in the following static file placed in your HTML's build output:
+
+.. code-block:: bash
+
+ _build/
+ └── html
+ └── _static
+    └── myjsfile.js
+
+See :ref:`theming-static-templates` for more information.
Second, you may use the :meth:`Sphinx.add_js_file` method without pointing it
to a file. Normally, this method is used to insert a new JavaScript file
into your site. However, if you do *not* pass a file path, but instead pass
a string to the "body" argument, then this text will be inserted as JavaScript
into your site's head. This allows you to insert variables into your project's
-javascript from Python.
+JavaScript from Python.
For example, the following code will read in a user-configured value and then
insert this value as a JavaScript variable, which your extension's JavaScript
diff --git a/doc/development/tutorials/index.rst b/doc/development/tutorials/index.rst
index 9acfc6c76..3b625090d 100644
--- a/doc/development/tutorials/index.rst
+++ b/doc/development/tutorials/index.rst
@@ -9,7 +9,6 @@ Refer to the following tutorials to get started with extension development.
:caption: General extension tutorials
overview
- builders
.. toctree::
:caption: Directive tutorials
@@ -18,9 +17,3 @@ Refer to the following tutorials to get started with extension development.
helloworld
todo
recipe
-
-.. toctree::
- :caption: Theming
- :maxdepth: 1
-
- theming-dev
diff --git a/doc/development/tutorials/overview.rst b/doc/development/tutorials/overview.rst
index 8ffb8df42..ad474999a 100644
--- a/doc/development/tutorials/overview.rst
+++ b/doc/development/tutorials/overview.rst
@@ -19,7 +19,7 @@ use the :meth:`Sphinx.setup_extension` method. This will
activate another extension at run-time, ensuring that you have access to its
functionality.
-For example, the following code activates the "recommonmark" extension:
+For example, the following code activates the ``recommonmark`` extension:
.. code-block:: python