Expand description
Block tree navigation by index path ([2, 0] = first child of the third top-level block).
Structs§
- Exercise
Copy - An exercise block a copy duplicated. The caller creates the new exercise from the source’s settings.
Constants§
- EXERCISE_
BLOCK - The name of the block that embeds an exercise; its
idattribute is the exercise id. - EXERCISE_
INTERNAL_ 🔒BLOCKS - Blocks that only exist inside an exercise block’s editor tree.
- RENDERED_
BLOCK_ 🔒KEYS - Keys a page read adds to a block besides its stored fields. Writes ignore them, so a block read back can be written again.
- TEXT_
ATTRIBUTES 🔒 - Attributes that hold a block’s text, most telling first: bulk edits search them unless told otherwise, and a block’s preview is the first one with text.
Functions§
- ancestor_
ids - The parent ids of the block at
path, outermost first. - attribute 🔒
- The value at JSON Pointer
pointer(non-empty, escaped) insideattributes. - content_
counts - A page’s block count, nested blocks included, and its exercise count, as the course structure shows them.
- copy_
blocks - Copies
sourceforpage_idwith new block ids. Exercise blocks get new exercise ids, listed in the result. - count_
blocks 🔒 - find_
path - The index path of the block
id, if the tree has it. - for_
each_ string - Visits every string value inside
attributes. - for_
each_ string_ mut - Visits every string value inside
attributes, to change it in place. - get
- The block at an index path. Paths come from
find_pathon the same tree, so the error, for an empty path or one the tree doesn’t have, means the location went stale. - get_mut
get, to change the block.- is_
exercise - Whether the block embeds an exercise.
- is_
exercise_ part - An exercise block or a block of an exercise’s editor tree.
- is_
in_ exercise - Whether the block at
pathis inside an exercise’s editor tree; withinclude_self, also whether it is part of one itself. Errors withstale_locationif the tree lackspath. - list
list_mut, to read.- list_
mut - The children list whose parent is at
parent_path; the top level for an empty path. - stale_
location 🔒 - The error for a located block or range the tree no longer has.
- walk
- Depth-first, pre-order visit of every block with its index path (
[2, 0]is the first child of the third top-level block). - walk_
mut_ outside_ exercises - Like
walk_mut, but never enters an exercise, whose blocks page edits don’t touch. - walk_
outside_ exercises - Like
walk, but never enters an exercise, whose blocks page edits don’t touch.