From 7b6da2b6cca2e435d0b292737a7a0f71e4e6d25d Mon Sep 17 00:00:00 2001 From: Sebastian Tiedtke Date: Wed, 28 Feb 2024 09:01:45 -0500 Subject: [PATCH] Retro-fit ahead of migration to ResolveProgram --- internal/document/block.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/document/block.go b/internal/document/block.go index 995018349..b27912e33 100644 --- a/internal/document/block.go +++ b/internal/document/block.go @@ -211,12 +211,20 @@ func (b *CodeBlock) Interpreter() string { } func (b *CodeBlock) PromptEnv() bool { - val, err := strconv.ParseBool(b.Attributes()["promptEnv"]) - if err != nil { + val, ok := b.Attributes()["promptEnv"] + if !ok { return true } - return val + // todo(sebastian): integration with ResolveProgram + switch strings.ToLower(val) { + case "false", "no", "0": + return false + default: + // use default return + } + + return true } func (b *CodeBlock) ExcludeFromRunAll() bool {