##// END OF EJS Templates
Include empty lines condition in PromptStipper and cell_magic.
Tony Fast -
Show More
@@ -61,6 +61,8 b' class PromptStripper:'
61 return [self.prompt_re.sub('', l, count=1) for l in lines]
61 return [self.prompt_re.sub('', l, count=1) for l in lines]
62
62
63 def __call__(self, lines):
63 def __call__(self, lines):
64 if not lines:
65 return lines
64 if self.initial_re.match(lines[0]) or \
66 if self.initial_re.match(lines[0]) or \
65 (len(lines) > 1 and self.prompt_re.match(lines[1])):
67 (len(lines) > 1 and self.prompt_re.match(lines[1])):
66 return self._strip(lines)
68 return self._strip(lines)
@@ -74,7 +76,7 b' classic_prompt = PromptStripper('
74 ipython_prompt = PromptStripper(re.compile(r'^(In \[\d+\]: |\s*\.{3,}: ?)'))
76 ipython_prompt = PromptStripper(re.compile(r'^(In \[\d+\]: |\s*\.{3,}: ?)'))
75
77
76 def cell_magic(lines):
78 def cell_magic(lines):
77 if not lines[0].startswith('%%'):
79 if not lines or not lines[0].startswith('%%'):
78 return lines
80 return lines
79 if re.match('%%\w+\?', lines[0]):
81 if re.match('%%\w+\?', lines[0]):
80 # This case will be handled by help_end
82 # This case will be handled by help_end
General Comments 0
You need to be logged in to leave comments. Login now