File tree Expand file tree Collapse file tree 3 files changed +1
-15
lines changed Expand file tree Collapse file tree 3 files changed +1
-15
lines changed Original file line number Diff line number Diff line change @@ -335,4 +335,3 @@ jupyter_sphinx_linenos
335
335
jupyter_sphinx_continue_linenos
336
336
337
337
Whether to show continuous line numbering in all ``jupyter-execute `` sources.
338
- Line numbering can be reset to one with a ``linenos `` directive.
Original file line number Diff line number Diff line change @@ -400,19 +400,14 @@ def apply(self):
400
400
# Add line numbers to code cells if jupyter_sphinx_linenos or
401
401
# jupyter_sphinx_continue_linenos are set in the configuration,
402
402
# or the linenos directive is set.
403
- # Reset linenumber if linenos directive is set.
404
403
# Update current line numbers from cell if jupyter_sphinx_continue_linenos
405
404
# is set.
406
405
linenostart = 1
407
406
for node in nodes :
408
407
source = node .children [0 ]
409
- if linenos_config or continue_linenos :
410
- source ["linenos" ] = True
411
- if node ["linenos" ]:
412
- linenostart = 1
408
+ if linenos_config or continue_linenos or node ["linenos" ]:
413
409
source ["linenos" ] = True
414
410
if continue_linenos :
415
- source ["linenos" ] = True
416
411
source ["highlight_args" ] = {'linenostart' : linenostart }
417
412
linenostart += source .rawsource .count ("\n " ) + 1
418
413
Original file line number Diff line number Diff line change @@ -184,14 +184,6 @@ def test_continue_linenos_conf_option(doctree):
184
184
assert cell1 .children [0 ].rawsource .strip () == "3 + 3"
185
185
assert cell1 .children [1 ].rawsource .strip () == "6"
186
186
187
- # :linenos: directive should restart line numbering at one.
188
- assert cell2 .attributes ['linenos' ]
189
- assert cell2 .children [0 ].attributes ['linenos' ]
190
- assert cell2 .children [0 ].attributes ['highlight_args' ]['linenostart' ] == 1
191
- assert cell2 .children [0 ].rawsource .strip () == "4 + 4"
192
- assert cell2 .children [1 ].rawsource .strip () == "8"
193
-
194
-
195
187
def test_execution_environment_carries_over (doctree ):
196
188
source = '''
197
189
.. jupyter-execute::
You can’t perform that action at this time.
0 commit comments