##// END OF EJS Templates
Revised pandoc version detection.
cel -
Show More
@@ -15,6 +15,7 b' from __future__ import print_function'
15 15 # Stdlib imports
16 16 import subprocess
17 17 import warnings
18 import re
18 19 from io import TextIOWrapper, BytesIO
19 20
20 21 # IPython imports
@@ -89,8 +90,11 b' def get_pandoc_version():'
89 90 out = subprocess.check_output(['pandoc', '-v'],
90 91 universal_newlines=True)
91 92 out_lines = out.splitlines()
92 pandoc_line = out_lines[0]
93 __version = pandoc_line.lstrip("pandoc ")
93 version_pattern = re.compile(r"^\d+(\.\d+){1,}$")
94 for tok in out_lines[0].split():
95 if version_pattern.match(tok):
96 __version = tok
97 break
94 98 return __version
95 99
96 100
@@ -103,6 +107,12 b' def check_pandoc_version():'
103 107 If pandoc is unavailable.
104 108 """
105 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 116 ok = check_version(v , _minimal_version )
107 117 if not ok:
108 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