From 63d458bd785d2379bab80d01ffc5249f9ce1f9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20G=C3=B6tz?= Date: Fri, 11 Nov 2022 22:03:09 +0100 Subject: [PATCH] Allow prompt_templates without %s This makes it possible to specify empty prompts in the configuration --- src/nbsphinx.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nbsphinx.py b/src/nbsphinx.py index a771b203..81205d85 100644 --- a/src/nbsphinx.py +++ b/src/nbsphinx.py @@ -1175,7 +1175,10 @@ def _create_code_nodes(directive): outer_node = docutils.nodes.container(classes=outer_classes) if execution_count: - prompt = prompt_template % (execution_count,) + if '%s' in prompt_template: + prompt = prompt_template % (execution_count,) + else: + prompt = prompt_template prompt_node = docutils.nodes.literal_block( prompt, prompt, language='none', classes=['prompt']) else: