Registry / Framework

framework · v0.1.2
Outline Depth
Enforce one-level heading descent while allowing returns to outer levels when constructing an outline.
Use Outline Depth
use vendor::outline_depth::outline_depth;
Run the example
nest demo outline_depth@0.1.2
blyxc native-run outline_depth-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::outline_depth::outline_depth;
fn main() {
let arguments = cli_args();
if args_len(arguments) > 0 {
if args_len(arguments) % 2 != 0 {
stderr_line("Expected event and value pairs");
process_exit(2);
}
let mut live = outline_depth_start();
let mut i = 0;
while i < args_len(arguments) {
let input = args_at(arguments, i + 1);
if !text_is_number(input) {
stderr_line("Expected a whole numeric event value");
process_exit(2);
}
live = outline_depth_step(live, args_at(arguments, i), text_number(input));
let command = outline_depth_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = outline_depth_start();
state = outline_depth_step(state, "heading", 1.0);
println!(outline_depth_command(state));
state = outline_depth_step(state, "heading", 3.0);
println!(outline_depth_command(state));
state = outline_depth_step(state, "heading", 2.0);
println!(outline_depth_command(state));
state = outline_depth_step(state, "heading", 1.0);
println!(outline_depth_command(state));
state = outline_depth_step(state, "finish", 0.0);
println!(outline_depth_command(state));
}
Expected output
append_heading
report_skipped_level
append_heading
append_heading
export_outline
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | fc9b00d8f6 | d72c973005bb7b096d5987f461e57ffecc2aa8878d101425882c9ffa75dcc9cc |
| 0.1.1 | Download ZIP · Browse files | 51c76a5cfd | 892035919aa71574837a654cf4143f6b63b4b046c522917e459f62a8f5ec73a9 |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | 8cec0e7170074d179ccaf3f58c41cf90ea99eff0998ef20f5be22a701af6e8d7 |