Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Moved ``manim_directive.py`` to ``manim.utils.docbuild`` (#2347)

Benjamin Hackldfac7a7b299c
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 76973b461..c4bdb3f9f 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -42,7 +42,7 @@ extensions = [
"sphinx.ext.extlinks",
"sphinx.ext.viewcode",
"sphinxext.opengraph",
- "manim_directive",
+ "manim.utils.docbuild.manim_directive",
"sphinx.ext.graphviz",
"sphinx.ext.inheritance_diagram",
]
diff --git a/docs/source/contributing/development.rst b/docs/source/contributing/development.rst
index 02e1ee7ea..6ea6aa151 100644
--- a/docs/source/contributing/development.rst
+++ b/docs/source/contributing/development.rst
@@ -147,13 +147,13 @@ Develop your contribution
.. tip::
- Use the :mod:`manim directive for Sphinx <.manim_directive>` to add examples
+ Use the :mod:`manim directive for Sphinx <manim.utils.docbuild.manim_directive>` to add examples
to the documentation!
.. autosummary::
:toctree: ../reference
- manim_directive
+ manim.utils.docbuild.manim_directive
As far as development on your local machine goes, these are the main steps you
should follow.
diff --git a/docs/source/contributing/examples.rst b/docs/source/contributing/examples.rst
index 2180ffe28..84667fe11 100644
--- a/docs/source/contributing/examples.rst
+++ b/docs/source/contributing/examples.rst
@@ -48,7 +48,7 @@ Writing examples
~~~~~~~~~~~~~~~~
When you want to add/edit examples, they can be found in the ``docs/source/`` directory, or directly in the manim source code (e.g. ``manim/mobject/mobject.py``). The examples are written in
-``rst`` format and use the manim directive (see :mod:`~.manim_directive` ), ``.. manim::``. Every example is in its own block, and looks like this:
+``rst`` format and use the manim directive (see :mod:`manim.utils.docbuild.manim_directive` ), ``.. manim::``. Every example is in its own block, and looks like this:
.. code:: rst
@@ -73,7 +73,7 @@ Here is the syntax:
* The flags are followed in the next line (no blank line here!), with the indentation level of one tab.
-All possible flags can be found at :mod:`~.manim_directive`.
+All possible flags can be found at :mod:`manim.utils.docbuild.manim_directive`.
In the example above, the ``Formula1`` following ``.. manim::`` is the scene
that the directive expects to render; thus, in the python code, the class
diff --git a/docs/source/manim_directive.py b/manim/utils/docbuild/manim_directive.py
similarity index 98%
rename from docs/source/manim_directive.py
rename to manim/utils/docbuild/manim_directive.py
index 9cddc80fe..b11f03ed2 100644
--- a/docs/source/manim_directive.py
+++ b/manim/utils/docbuild/manim_directive.py
@@ -23,6 +23,7 @@ render scenes that are defined within doctests, for example::
.. manim:: DirectiveDoctestExample
:ref_classes: Dot
+ >>> from manim import Create, Dot, RED, Scene
>>> dot = Dot(color=RED)
>>> dot.color
<Color #fc6255>
@@ -114,9 +115,9 @@ def process_name_list(option_input: str, reference_type: str) -> List[str]:
::
>>> process_name_list("Tex TexTemplate", "class")
- [":class:`~.Tex`", ":class:`~.TexTemplate`"]
+ [':class:`~.Tex`', ':class:`~.TexTemplate`']
>>> process_name_list("Scene.play Mobject.rotate", "func")
- [":func:`~.Scene.play`", ":func:`~.Mobject.rotate`"]
+ [':func:`~.Scene.play`', ':func:`~.Mobject.rotate`']
"""
return [f":{reference_type}:`~.{name}`" for name in option_input.split()]