Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
neroist committed Jun 18, 2024
1 parent 070a9ac commit 4fe8e3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/nimib/blocks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ func nbNormalize*(text: string): string =
# note that: '\c' == '\r' and '\l' == '\n'

template newNbBlock*(cmd: string, readCode: static[bool], nbDoc, nbBlock, body, blockImpl: untyped) =
# stdout.write "[nimib] ", nbDoc.blocks.len, " ", cmd, ": "
stdout.write "[nimib] ", nbDoc.blocks.len, " ", cmd, ": "
nbBlock = NbBlock(command: cmd, context: newContext(searchDirs = @[], partials = nbDoc.partials))
when readCode:
nbBlock.code = nbNormalize:
when defined(nimibCodeFromAst):
toStr(body)
else:
getCodeAsInSource(nbDoc.source, cmd, body)
# echo peekFirstLineOf(nbBlock.code)
echo peekFirstLineOf(nbBlock.code)
blockImpl
# if len(nbBlock.output) > 0: echo " -> ", peekFirstLineOf(nbBlock.output)
if len(nbBlock.output) > 0: echo " -> ", peekFirstLineOf(nbBlock.output)
nbBlock.context["code"] = nbBlock.code
nbBlock.context["output"] = nbBlock.output.dup(removeSuffix)
nbDoc.blocks.add nbBlock
Expand Down
2 changes: 2 additions & 0 deletions tests/tblocks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ suite "newNbBlock":
let b = 3.21
check blk.code == ""

fail()


0 comments on commit 4fe8e3a

Please sign in to comment.