##// END OF EJS Templates
Reorder inputsplitter transformers so that prompts pasted into the input are removed before other transforms are applied.
Thomas Kluyver -
Show More
@@ -665,7 +665,7 b' def _make_help_call(target, esc, lspace):'
665 _initial_space_re = re.compile(r'\s*')
665 _initial_space_re = re.compile(r'\s*')
666 _help_end_re = re.compile(r"""(%?
666 _help_end_re = re.compile(r"""(%?
667 [a-zA-Z_*][a-zA-Z0-9_*]* # Variable name
667 [a-zA-Z_*][a-zA-Z0-9_*]* # Variable name
668 (.[a-zA-Z_*][a-zA-Z0-9_*]*)* # .etc.etc
668 (\.[a-zA-Z_*][a-zA-Z0-9_*]*)* # .etc.etc
669 )
669 )
670 (\?\??)$ # ? or ??""",
670 (\?\??)$ # ? or ??""",
671 re.VERBOSE)
671 re.VERBOSE)
@@ -812,9 +812,9 b' class IPythonInputSplitter(InputSplitter):'
812
812
813 lines_list = lines.splitlines()
813 lines_list = lines.splitlines()
814
814
815 transforms = [transform_escaped, transform_help_end,
815 transforms = [transform_ipy_prompt, transform_classic_prompt,
816 transform_assign_system, transform_assign_magic,
816 transform_escaped, transform_help_end,
817 transform_ipy_prompt, transform_classic_prompt]
817 transform_assign_system, transform_assign_magic]
818
818
819 # Transform logic
819 # Transform logic
820 #
820 #
@@ -481,6 +481,14 b' syntax = \\'
481 ('/f a b', 'f(a, b)'),
481 ('/f a b', 'f(a, b)'),
482 ],
482 ],
483
483
484 # Check that we transform prompts before other transforms
485 mixed =
486 [ ('In [1]: %lsmagic', 'get_ipython().magic(u"lsmagic")'),
487 ('>>> %lsmagic', 'get_ipython().magic(u"lsmagic")'),
488 ('In [2]: !ls', 'get_ipython().system(u"ls")'),
489 ('In [3]: abs?', 'get_ipython().magic(u"pinfo abs")'),
490 ('In [4]: b = %who', 'b = get_ipython().magic(u"who")'),
491 ],
484 )
492 )
485
493
486 # multiline syntax examples. Each of these should be a list of lists, with
494 # multiline syntax examples. Each of these should be a list of lists, with
General Comments 0
You need to be logged in to leave comments. Login now