Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Use ipython[2,3] for notebooks when nbconvert version >= 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed Feb 6, 2017
1 parent a05badb commit b576a96
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sphinx_nbexamples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@

logger = logging.getLogger(__name__)

code_blocks = re.compile(r'\.\. code:: python\n(?s)(.+?)(?=\n\S+|$)')
inner_code_blocks = re.compile(r'(?<=.. code:: python\n)(?s)(.+?)(?=\n\S+|$)')
if nbconvert.__version__ < '5.0':
code_blocks = re.compile(r'\.\. code:: python\n(?s)(.+?)(?=\n\S+|$)')
inner_code_blocks = re.compile(r'(?<=.. code:: python\n)(?s)(.+?)(?=\n\S+|$)')
else:
code_blocks = re.compile(r'\.\. code:: ipython\d\n(?s)(.+?)(?=\n\S+|$)')
inner_code_blocks = re.compile(r'(?<=.. code:: ipython\d\n)(?s)(.+?)(?=\n\S+|$)')
magic_patt = re.compile(r'(?m)^(\s+)(%.*\n)')


Expand Down

0 comments on commit b576a96

Please sign in to comment.