Expand description
Pure edit engines. They take documents and ops as plain data, never touch the database or the network, and either return the whole new state or reject the whole call.
Re-exports§
pub use error::EditError;pub use error::EditErrorCode;pub use error::Warning;pub use error::WarningCode;pub use op::PatchTarget;pub use op::parse_ops;
Modules§
- blocks
- Block tree navigation by index path (
[2, 0]= first child of the third top-level block). - course_
settings patch_course_settings: course and module settings. Publishing switches stay read-only.- course_
structure patch_course_structure: modules, chapters and pages, their order, names, titles, paths and chapter dates. Paths, chapter numbers and redirects are derived once at the end of a call.- error
- Errors and warnings of the edit engines.
- find_
replace find_replace: literal or regex search, optionally replace, over the raw stored strings of text-bearing block attributes. Matching sees markup:<em>for</em> loopsdoesn’t match “for loops”.- glossary_
references patch_course_glossary_and_references: glossary terms and BibTeX references.- labels 🔒
$namelabels: call-local names for items the call creates.- op
- The JSON-Patch-style op shared by every patch tool, and its parsing with teaching errors.
- page_
content patch_page_content: block-tree edits on one page, with cross-pagemoveandcopy.- path 🔒
- The path grammar the engines share: segments with JSON Pointer escapes, ids and
$labels, and block paths. - read
- Read selectors shared by
get_page_content,get_course_structureandread_back. - structural_
replace structural_replace: match blocks by type and text, then wrap, retype, unwrap or remove each.
Structs§
- Block
Match - A block a bulk edit matched.
- Created
IdLog 🔒 - Mints the ids a call’s ops create and lists each under the op that created it.
- Created
Ids - Ids one op created, in payload order (pre-order for nested items).
- Document
- A block document the course-wide engines read or changed.
- Document
Ref - A block document the course-wide engines read, borrowed.
- Page
Document - One page’s block tree with what the engines need to know about the page.
- PageRef
- A page borrowed from a course state. Engines that scan many pages take these and copy only the pages they change.
Enums§
- Anchor 🔒
- Where an op puts items: next to a sibling, or at the start or end of a list
L. - Document
Key - Which block document a course-wide engine read: a page or exercise text. Serialized, it is the location reported in results.
- Page
Type - The editor (and validator) context a page’s blocks are checked against. A chapter’s front page takes the same blocks as its other pages.
Functions§
- new_
item_ 🔒objects - The objects an
addvalue creates, each checked to have onlyfields.nounnames an item in errors, e.g. “an audience”, andshapeis the error for an item that isn’t an object. - non_
empty_ 🔒string - The value as a string with more than whitespace in it. Errors with
InvalidValuesaying thatwhatis one. - reject_
unknown_ 🔒keys - Fails with
UnknownFieldnaming every key ofobjectoutsideallowed.nounnames the object in the message, e.g. “a block”. - value_
items 🔒 - The items an
addvalue creates: each item of a non-empty list, or the one object.nounnames an item in the error, e.g. “a block”.