For Block
Repeat a block content for each item in an array.
This type is marked as unstable and is subject to change.
Properties
The ForBlock
type has these properties:
Name | Description | Type | Inherited from | JSON-LD @id |
Aliases |
---|---|---|---|---|---|
id |
The identifier for this item. | String |
Entity |
schema:id |
- |
executionMode |
Under which circumstances the node should be executed. | ExecutionMode |
Executable |
stencila:executionMode |
execution-mode , execution_mode |
compilationDigest |
A digest of the content, semantics and dependencies of the node. | CompilationDigest |
Executable |
stencila:compilationDigest |
compilation-digest , compilation_digest |
compilationMessages |
Messages generated while compiling the code. | CompilationMessage * |
Executable |
stencila:compilationMessages |
compilation-messages , compilation_messages , compilationMessage , compilation-message , compilation_message |
executionDigest |
The compilationDigest of the node when it was last executed. |
CompilationDigest |
Executable |
stencila:executionDigest |
execution-digest , execution_digest |
executionDependencies |
The upstream dependencies of this node. | ExecutionDependency * |
Executable |
stencila:executionDependencies |
execution-dependencies , execution_dependencies , executionDependency , execution-dependency , execution_dependency |
executionDependants |
The downstream dependants of this node. | ExecutionDependant * |
Executable |
stencila:executionDependants |
execution-dependants , execution_dependants , executionDependant , execution-dependant , execution_dependant |
executionTags |
Tags in the code which affect its execution. | ExecutionTag * |
Executable |
stencila:executionTags |
execution-tags , execution_tags , executionTag , execution-tag , execution_tag |
executionCount |
A count of the number of times that the node has been executed. | Integer |
Executable |
stencila:executionCount |
execution-count , execution_count |
executionRequired |
Whether, and why, the code requires execution or re-execution. | ExecutionRequired |
Executable |
stencila:executionRequired |
execution-required , execution_required |
executionStatus |
Status of the most recent, including any current, execution. | ExecutionStatus |
Executable |
stencila:executionStatus |
execution-status , execution_status |
executionInstance |
The id of the kernel instance that performed the last execution. | String |
Executable |
stencila:executionInstance |
execution-instance , execution_instance |
executionEnded |
The timestamp when the last execution ended. | Timestamp |
Executable |
stencila:executionEnded |
execution-ended , execution_ended |
executionDuration |
Duration of the last execution. | Duration |
Executable |
stencila:executionDuration |
execution-duration , execution_duration |
executionMessages |
Messages emitted while executing the node. | ExecutionMessage * |
Executable |
stencila:executionMessages |
execution-messages , execution_messages , executionMessage , execution-message , execution_message |
code |
The code. | Cord |
CodeExecutable |
stencila:code |
- |
programmingLanguage |
The programming language of the code. | String |
CodeExecutable |
schema:programmingLanguage |
programming-language , programming_language |
executionBounds |
The environment in which code should be executed. | ExecutionBounds |
CodeExecutable |
stencila:executionBounds |
execution-bounds , execution_bounds |
executionBounded |
The execution bounds, if any, on the last execution. | ExecutionBounds |
CodeExecutable |
stencila:executionBounded |
execution-bounded , execution_bounded |
authors |
The authors of the executable code. | Author * |
CodeExecutable |
schema:author |
author |
provenance |
A summary of the provenance of the code. | ProvenanceCount * |
CodeExecutable |
stencila:provenance |
- |
variable |
The name to give to the variable representing each item in the iterated array | String |
- | stencila:variable |
- |
content |
The content to repeat for each item | Block * |
- | stencila:content |
- |
otherwise |
The content to render if there are no items | Block * |
- | stencila:otherwise |
- |
iterations |
The content repeated for each iteration | Block * |
- | stencila:iterations |
iteration |
Related
The ForBlock
type is related to these types:
- Parents:
CodeExecutable
- Children: none
Formats
The ForBlock
type can be encoded (serialized) to, and/or decoded (deserialized) from, these formats:
Format | Encoding | Decoding | Support | Notes |
---|---|---|---|---|
DOM HTML | 🟢 No loss | |||
HTML | 🔷 Low loss | |||
JATS | ||||
Markdown | ⚠️ High loss | Encoded using implemented function | ||
Stencila Markdown | ⚠️ High loss | |||
Quarto Markdown | ⚠️ High loss | |||
MyST Markdown | ⚠️ High loss | |||
LLM Markdown | ⚠️ High loss | |||
LaTeX | 🔷 Low loss | 🔷 Low loss | ||
🔷 Low loss | ||||
Plain text | ⚠️ High loss | |||
IPYNB | 🔷 Low loss | 🔷 Low loss | ||
Microsoft Word DOCX | 🔷 Low loss | 🔷 Low loss | ||
OpenDocument ODT | 🔷 Low loss | 🔷 Low loss | ||
TeX | 🔷 Low loss | 🔷 Low loss | ||
JSON | 🟢 No loss | 🟢 No loss | ||
JSON+Zip | 🟢 No loss | 🟢 No loss | ||
JSON5 | 🟢 No loss | 🟢 No loss | ||
JSON-LD | 🟢 No loss | 🟢 No loss | ||
CBOR | 🟢 No loss | 🟢 No loss | ||
CBOR+Zstandard | 🟢 No loss | 🟢 No loss | ||
YAML | 🟢 No loss | 🟢 No loss | ||
Lexical JSON | 🔷 Low loss | 🔷 Low loss | ||
Koenig JSON | 🔷 Low loss | 🔷 Low loss | ||
Pandoc AST | 🔷 Low loss | 🔷 Low loss | ||
Directory | ||||
Stencila Web Bundle | ||||
Debug | 🔷 Low loss |
Bindings
The ForBlock
type is represented in:
- JSON-LD
- JSON Schema
- Python class
ForBlock
- Rust struct
ForBlock
- TypeScript class
ForBlock
Testing
During property-based (a.k.a generative) testing, the properties of the ForBlock
type are generated using the following strategies for each complexity level. Any optional properties that are not in this table are set to None
.
Property | Complexity | Description | Strategy |
---|---|---|---|
code |
Min+ | 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) |
|
Max | Generate an arbitrary string. | String::arbitrary().prop_map(Cord::from) |
|
programmingLanguage |
Min+ | 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}") |
|
Max | Generate an arbitrary string. | option::of(String::arbitrary()) |
|
variable |
Min+ | 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} |
|
Max | Generate an arbitrary string. | String::arbitrary() |
|
content |
Min+ | A single simple paragraph. | vec![p([t("For content")])] |
Low+ | Generate up to four arbitrary, non-recursive, block nodes. | vec_blocks_non_recursive(4) |
|
Max | Generate up to eight arbitrary, non-recursive, block nodes. | vec_blocks_non_recursive(8) |
|
otherwise |
Min+ | No otherwise clause. | None |
Low+ | Generate up to two arbitrary, non-recursive, block nodes. | option::of(vec_blocks_non_recursive(2)) |
|
Max | Generate up to four arbitrary, non-recursive, block nodes. | option::of(vec_blocks_non_recursive(4)) |
Source
This documentation was generated from ForBlock.yaml
by docs_types.rs
.