sigildocs

(sigil docs execute)

(sigil docs execute) - Executable Code Block Support

Execute code blocks in documentation and capture their output.

Supported block options: :run - Execute and show output :run-hide - Execute but hide block, show only output :run-error - Expect an error, show error message :no-prompt - Don't show > or $ prompt :session NAME - Share state between blocks with same session :continue - Continue previous block's session

Example: (execute-block block-record) -> <execution-result>

Exports

Construct a execution-result struct.

Test if a value is a execution-result struct.

Get the output field of a execution-result struct.

Get the value field of a execution-result struct.

Get the error? field of a execution-result struct.

Get the error-message field of a execution-result struct.

Get the duration field of a execution-result struct.

code-blockprocedure

Construct a code-block struct.

code-block?procedure

Test if a value is a code-block struct.

Get the lang field of a code-block struct.

Get the code field of a code-block struct.

Get the options field of a code-block struct.

Parse block options from info string "sigil :run :session demo" -> ((lang . "sigil") (run . #t) (session . "demo"))

parse-optionsprocedure

Parse option tokens into alist

Parse a code block from SXML pre element (pre (@ (lang "sigil :run")) "code") -> <code-block>

Find code content in pre element

Check if block should be executed

execute-blockprocedure

Execute a code block

Execute Sigil code block

Execute Sigil code string and capture output

Execute shell command block

safe-command?procedure

Check if command is safe to execute

Execute shell command and capture output

Create a session manager for tracking execution state

Get session by name

Set session value