Skip to content
Snippets Groups Projects
Commit 64109856 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Allow for notebook with no markdown cells

parent 53c3bace
No related branches found
No related tags found
1 merge request!575Refactor parsing arguments and loading main notebook
...@@ -57,6 +57,8 @@ def extract_title_author(nb): ...@@ -57,6 +57,8 @@ def extract_title_author(nb):
""" """
first_md = first_markdown_cell(nb) first_md = first_markdown_cell(nb)
if first_md is None:
return None, None
source = first_md["source"] source = first_md["source"]
title = re.findall(r'#+\s*(.*)\s*#+', source) title = re.findall(r'#+\s*(.*)\s*#+', source)
author = re.findall( author = re.findall(
...@@ -375,7 +377,9 @@ def prepare_job( ...@@ -375,7 +377,9 @@ def prepare_job(
params = parameter_values(params, cluster_profile=cluster_profile) params = parameter_values(params, cluster_profile=cluster_profile)
new_nb = replace_definitions(nb, params, execute=False, lang='python') new_nb = replace_definitions(nb, params, execute=False, lang='python')
if not show_title: if not show_title:
first_markdown_cell(new_nb).source = '' title_cell = first_markdown_cell(new_nb)
if title_cell is not None:
title_cell.source = ''
set_figure_format(new_nb, args["vector_figs"]) set_figure_format(new_nb, args["vector_figs"])
new_name = f"{nb_path.stem}__{cparm}__{suffix}.ipynb" new_name = f"{nb_path.stem}__{cparm}__{suffix}.ipynb"
......
...@@ -282,7 +282,7 @@ def make_epilog(nb, caltype=None): ...@@ -282,7 +282,7 @@ def make_epilog(nb, caltype=None):
""" """
msg = "" msg = ""
header_cell = first_markdown_cell(nb) header_cell = first_markdown_cell(nb)
lines = header_cell.source.split("\n") lines = header_cell.source.split("\n") if header_cell is not None else ['']
if caltype: if caltype:
msg += "{:<15} {}".format(caltype, lines[0]) + "\n" msg += "{:<15} {}".format(caltype, lines[0]) + "\n"
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment