From f6cf9b5f1a4f6f5f55cdf906e6527ba49b62473d Mon Sep 17 00:00:00 2001 From: Andy Bayer Roswell Date: Wed, 7 Aug 2024 00:42:03 +0200 Subject: [PATCH] comments on rmd support --- vreapis/containerizer/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vreapis/containerizer/views.py b/vreapis/containerizer/views.py index 2822ebc..4d74259 100644 --- a/vreapis/containerizer/views.py +++ b/vreapis/containerizer/views.py @@ -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') @@ -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]