##// END OF EJS Templates
Revised pandoc version detection.
cel -
Show More
@@ -15,6 +15,7 b' from __future__ import print_function'
15 # Stdlib imports
15 # Stdlib imports
16 import subprocess
16 import subprocess
17 import warnings
17 import warnings
18 import re
18 from io import TextIOWrapper, BytesIO
19 from io import TextIOWrapper, BytesIO
19
20
20 # IPython imports
21 # IPython imports
@@ -89,8 +90,11 b' def get_pandoc_version():'
89 out = subprocess.check_output(['pandoc', '-v'],
90 out = subprocess.check_output(['pandoc', '-v'],
90 universal_newlines=True)
91 universal_newlines=True)
91 out_lines = out.splitlines()
92 out_lines = out.splitlines()
92 pandoc_line = out_lines[0]
93 version_pattern = re.compile(r"^\d+(\.\d+){1,}$")
93 __version = pandoc_line.lstrip("pandoc ")
94 for tok in out_lines[0].split():
95 if version_pattern.match(tok):
96 __version = tok
97 break
94 return __version
98 return __version
95
99
96
100
@@ -103,6 +107,12 b' def check_pandoc_version():'
103 If pandoc is unavailable.
107 If pandoc is unavailable.
104 """
108 """
105 v = get_pandoc_version()
109 v = get_pandoc_version()
110 if v is None:
111 warnings.warn("Sorry, we cannot determine the version of pandoc.\n"
112 "Please consider reporting this issue and include the"
113 "output of pandoc --version.\nContinuing...",
114 RuntimeWarning, stacklevel=2)
115 return False
106 ok = check_version(v , _minimal_version )
116 ok = check_version(v , _minimal_version )
107 if not ok:
117 if not ok:
108 warnings.warn( "You are using an old version of pandoc (%s)\n" % v +
118 warnings.warn( "You are using an old version of pandoc (%s)\n" % v +
General Comments 0
You need to be logged in to leave comments. Login now