Home

For Block

This is an executable control-flow block used in Stencila Schema for repetition.

It extends CodeExecutable so a document can repeat block content for each item in an array while preserving structured execution semantics. This brings loop-like behavior into the document model for dynamic and parameterized content generation.

Key properties include the iteration source, loop variable binding, repeated content, and inherited execution properties.

This type is marked as unstable and is subject to change.

Analogues

The following external types, elements, or nodes are similar to a ForBlock:

  • Jinja for block: Close template-language analogue for repeating content over an iterable, though Stencila models the loop as an executable document node.

Properties

The ForBlock type has these properties:

NameDescriptionTypeInherited from
variableThe name to give to the variable representing each item in the iterated arrayString-
contentThe content to repeat for each itemBlock*-
otherwiseThe content to render if there are no itemsBlock*-
iterationsThe content repeated for each iterationBlock*-
codeThe code.CordCodeExecutable
programmingLanguageThe programming language of the code.StringCodeExecutable
executionBoundsThe environment in which code should be executed.ExecutionBoundsCodeExecutable
executionBoundedThe execution bounds, if any, on the last execution.ExecutionBoundsCodeExecutable
authorsThe authors of the executable code.Author*CodeExecutable
provenanceA summary of the provenance of the code.ProvenanceCount*CodeExecutable
executionModeUnder which circumstances the node should be executed.ExecutionModeExecutable
compilationDigestA digest of the content, semantics and dependencies of the node.CompilationDigestExecutable
compilationMessagesMessages generated while compiling the code.CompilationMessage*Executable
executionDigestThe compilationDigest of the node when it was last executed.CompilationDigestExecutable
executionDependenciesThe upstream dependencies of this node.ExecutionDependency*Executable
executionDependantsThe downstream dependants of this node.ExecutionDependant*Executable
executionTagsTags in the code which affect its execution.ExecutionTag*Executable
executionCountA count of the number of times that the node has been executed.IntegerExecutable
executionRequiredWhether, and why, the code requires execution or re-execution.ExecutionRequiredExecutable
executionStatusStatus of the most recent, including any current, execution.ExecutionStatusExecutable
executionInstanceThe id of the kernel instance that performed the last execution.StringExecutable
executionEndedThe timestamp when the last execution ended.TimestampExecutable
executionDurationDuration of the last execution.DurationExecutable
executionMessagesMessages emitted while executing the node.ExecutionMessage*Executable
idThe identifier for this item.StringEntity

Related

The ForBlock type is related to these types:

Bindings

The ForBlock type is represented in:

Testing

During property-based (a.k.a generative) testing, the properties of the ForBlock type are generated using the following strategies.

PropertyComplexityDescriptionStrategy
codeMin+Generate a simple fixed string of code.Cord::from("code")
Low+Generate a random string of up to 10 alphanumeric characters (excludes whitespace whichcan be problematic in Markdown).r"[a-zA-Z0-9]{1,10}".prop_map(Cord::from)
High+Generate a random string of up to 100 characters (excluding control characters).r"[^\p{C}]{1,100}".prop_map(Cord::from)
MaxGenerate an arbitrary string.String::arbitrary().prop_map(Cord::from)
programmingLanguageMin+Generate a simple fixed string.Some(String::from("lang"))
Low+Generate one of the well known programming language short names.option::of(r"(cpp)|(js)|(py)|(r)|(ts)")
High+Generate a random string of up to 10 alphanumeric characters.option::of(r"[a-zA-Z0-9]{1,10}")
MaxGenerate an arbitrary string.option::of(String::arbitrary())
variableMin+Generate a fixed variable name.String::from("item")
Low+Generate a random string of up to 10 alphanumeric characters (and at most one underscore to avoida clash with Markdown emphasis).Regex [a-zA-Z_][a-zA-Z0-9]{0,9}
High+Generate a random string of up to 100 characters (excluding control characters).Regex [^\p{C}]{1,100}
MaxGenerate an arbitrary string.String::arbitrary()
contentMin+A single simple paragraph.vec![p([t("For content")])]
Low+Generate up to four arbitrary, non-recursive, block nodes.vec_blocks_non_recursive(4)
MaxGenerate up to eight arbitrary, non-recursive, block nodes.vec_blocks_non_recursive(8)
otherwiseMin+No otherwise clause.None
Low+Generate up to two arbitrary, non-recursive, block nodes.option::of(vec_blocks_non_recursive(2))
MaxGenerate up to four arbitrary, non-recursive, block nodes.option::of(vec_blocks_non_recursive(4))

This documentation was generated from ForBlock.yaml by docs_types.rs.

© 2026 Stencila