Skip to content

Commit

Permalink
comments on rmd support
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyBRoswell committed Aug 6, 2024
1 parent f1da57c commit f6cf9b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vreapis/containerizer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def post(self, request: Request):
payload = request.data
# common.logger.debug('ExtractorHandler. payload: ' + json.dumps(payload, indent=4))
if 'rmarkdown' in payload:
# Directly setting `NotebookNode.metadata['jupytext'] = {'split_at_heading': True, }` is no use. I don't know why. So we don't use lib jupytext here.
# Directly setting `NotebookNode.metadata['jupytext'] = {'split_at_heading': True, }` has no use. I don't know why. So we don't use lib jupytext here.
venv_activator = '/opt/venv/bin/activate'
command_jupytext = f'source {venv_activator}; jupytext --from Rmd --to ipynb --opt split_at_heading=true -o -'
process_jupytext = subprocess.Popen(command_jupytext, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, executable='/bin/bash')
Expand All @@ -108,7 +108,7 @@ def post(self, request: Request):
if isinstance(payload['notebook'], dict):
payload['notebook'] = json.dumps(payload['notebook'])
notebook = nbformat.reads(payload['notebook'], nbformat.NO_CONVERT)
if 'rmarkdown' in payload:
if 'rmarkdown' in payload: # parsermd ignores md cells with \n only. We need to remove them here to keep consistency
filtered_cells = [notebook.cells[0]]
for i in range(1, len(notebook.cells)):
cell = notebook.cells[i]
Expand Down

0 comments on commit f6cf9b5

Please sign in to comment.