Skip to content

Commit

Permalink
Support for active and frozen cells in percent format mwouts#101 mwou…
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Oct 18, 2018
1 parent 993f6e6 commit 9da6df9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jupytext/cell_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def find_cell_content(self, lines):
# Cell content
source = lines[cell_start:cell_end_marker]

if self.cell_type != 'code':
if self.cell_type != 'code' or (self.metadata and not is_active('py', self.metadata)):
source = uncomment(source, self.comment)
if self.comment_magics:
source = self.uncomment_code_and_magics(source)
Expand Down
4 changes: 3 additions & 1 deletion jupytext/cell_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def cell_to_text(self):
if self.cell_type != 'code':
self.metadata['cell_type'] = self.cell_type

active = is_active('py', self.metadata)
if self.cell_type == 'raw' and 'active' in self.metadata and self.metadata['active'] == '':
del self.metadata['active']

Expand All @@ -289,7 +290,8 @@ def cell_to_text(self):
if self.cell_type == 'code':
source = copy(self.source)
comment_magic(source, self.language, self.comment_magics)
return lines + source
if active:
return lines + source

return lines + comment_lines(self.source, self.comment)

Expand Down

0 comments on commit 9da6df9

Please sign in to comment.