summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-17 01:20:59 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-17 01:20:59 +0900
commitc97218cc9780b5f05fa6e169f1b078ebb4377e29 (patch)
treec53315e113bbb3386b52bd0f8b2cad6f6140777f
parent59c973c8c2f03382c6bb8229846a939c3eededb4 (diff)
downloadsphinx-git-c97218cc9780b5f05fa6e169f1b078ebb4377e29.tar.gz
doc: Fix file inclusion in recipe tutorial has been broken
-rw-r--r--doc/development/tutorials/recipe.rst13
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/development/tutorials/recipe.rst b/doc/development/tutorials/recipe.rst
index 2a3aa6408..474888cb0 100644
--- a/doc/development/tutorials/recipe.rst
+++ b/doc/development/tutorials/recipe.rst
@@ -75,7 +75,7 @@ The first thing to examine is the ``RecipeDirective`` directive:
.. literalinclude:: examples/recipe.py
:language: python
:linenos:
- :lines: 17-37
+ :pyobject: RecipeDirective
Unlike :doc:`helloworld` and :doc:`todo`, this directive doesn't derive from
:class:`docutils.parsers.rst.Directive` and doesn't define a ``run`` method.
@@ -103,7 +103,12 @@ reStructuredText in the body.
.. literalinclude:: examples/recipe.py
:language: python
:linenos:
- :lines: 40-102
+ :pyobject: IngredientIndex
+
+.. literalinclude:: examples/recipe.py
+ :language: python
+ :linenos:
+ :pyobject: RecipeIndex
Both ``IngredientIndex`` and ``RecipeIndex`` are derived from :class:`Index`.
They implement custom logic to generate a tuple of values that define the
@@ -126,7 +131,7 @@ creating here.
.. literalinclude:: examples/recipe.py
:language: python
:linenos:
- :lines: 105-155
+ :pyobject: RecipeDomain
There are some interesting things to note about this ``recipe`` domain and domains
in general. Firstly, we actually register our directives, roles and indices
@@ -164,7 +169,7 @@ hook the various parts of our extension into Sphinx. Let's look at the
.. literalinclude:: examples/recipe.py
:language: python
:linenos:
- :lines: 158-
+ :pyobject: setup
This looks a little different to what we're used to seeing. There are no calls
to :meth:`~Sphinx.add_directive` or even :meth:`~Sphinx.add_role`. Instead, we