##// END OF EJS Templates
Fix split_user_input to correctly handle %% escape for cell magics.
Fernando Perez -
Show More
@@ -44,7 +44,7 b' from IPython.utils.encoding import get_stream_enc'
44 line_split = re.compile("""
44 line_split = re.compile("""
45 ^(\s*) # any leading space
45 ^(\s*) # any leading space
46 ([,;/%]|!!?|\?\??)? # escape character or characters
46 ([,;/%]|!!?|\?\??)? # escape character or characters
47 \s*(%?[\w\.\*]*) # function/method, possibly with leading %
47 \s*(%{0,2}[\w\.\*]*) # function/method, possibly with leading %
48 # to correctly treat things like '?%magic'
48 # to correctly treat things like '?%magic'
49 (.*?$|$) # rest of line
49 (.*?$|$) # rest of line
50 """, re.VERBOSE)
50 """, re.VERBOSE)
@@ -20,7 +20,10 b' tests = ['
20 (' ;ls', (' ', ';', 'ls', '')),
20 (' ;ls', (' ', ';', 'ls', '')),
21 ('f.g(x)', ('', '', 'f.g', '(x)')),
21 ('f.g(x)', ('', '', 'f.g', '(x)')),
22 ('f.g (x)', ('', '', 'f.g', '(x)')),
22 ('f.g (x)', ('', '', 'f.g', '(x)')),
23 ('?%hist', ('', '?', '%hist', '')),
23 ('?%hist1', ('', '?', '%hist1', '')),
24 ('?%%hist2', ('', '?', '%%hist2', '')),
25 ('??%hist3', ('', '??', '%hist3', '')),
26 ('??%%hist4', ('', '??', '%%hist4', '')),
24 ('?x*', ('', '?', 'x*', '')),
27 ('?x*', ('', '?', 'x*', '')),
25 ]
28 ]
26 if py3compat.PY3:
29 if py3compat.PY3:
General Comments 0
You need to be logged in to leave comments. Login now