Skip to content

Commit ba273df

Browse files
committed
moving nodes to ast module
1 parent dddf065 commit ba273df

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

jupyter_sphinx/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
from .ast import (
1212
JupyterCell,
1313
JupyterCellNode,
14+
JupyterKernelNode,
1415
JupyterWidgetViewNode,
1516
JupyterWidgetStateNode,
1617
WIDGET_VIEW_MIMETYPE,
1718
jupyter_download_role,
1819
)
19-
from .execute import JupyterKernelNode, JupyterKernel, ExecuteJupyterCells
20+
from .execute import JupyterKernel, ExecuteJupyterCells
2021
from .thebelab import ThebeButton, ThebeButtonNode, ThebeOutputNode, ThebeSourceNode
2122

2223
REQUIRE_URL_DEFAULT = (

jupyter_sphinx/ast.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ class JupyterCellNode(docutils.nodes.container):
143143
"""
144144

145145

146+
class JupyterKernelNode(docutils.nodes.Element):
147+
"""Inserted into doctree whenever a JupyterKernel directive is encountered.
148+
149+
Used as a marker to signal that the following JupyterCellNodes (until the
150+
next, if any, JupyterKernelNode) should be executed in a separate kernel.
151+
"""
152+
153+
146154
class JupyterWidgetViewNode(docutils.nodes.Element):
147155
"""Inserted into doctree whenever a Jupyter cell produces a widget as output.
148156

jupyter_sphinx/execute.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
)
2828
from .ast import (
2929
JupyterCellNode,
30+
JupyterKernelNode,
3031
cell_output_to_nodes,
3132
JupyterWidgetStateNode,
3233
attach_outputs,
@@ -71,14 +72,6 @@ def run(self):
7172
]
7273

7374

74-
class JupyterKernelNode(docutils.nodes.Element):
75-
"""Inserted into doctree whenever a JupyterKernel directive is encountered.
76-
77-
Used as a marker to signal that the following JupyterCellNodes (until the
78-
next, if any, JupyterKernelNode) should be executed in a separate kernel.
79-
"""
80-
81-
8275
### Doctree transformations
8376
class ExecuteJupyterCells(SphinxTransform):
8477
"""Execute code cells in Jupyter kernels.

0 commit comments

Comments
 (0)