Blyx Nest Blyx language
Registry / Framework
framework · v0.1.2

Footnote Bind

Resolve forward footnote references and block typesetting while the outstanding count is positive.

Source repository · Package JSON

Use Footnote Bind

use vendor::footnote_bind::footnote_bind;

Run the example

nest demo footnote_bind@0.1.2
blyxc native-run footnote_bind-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::footnote_bind::footnote_bind;

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 = footnote_bind_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 = footnote_bind_step(live, args_at(arguments, i), text_number(input));
            let command = footnote_bind_command(live);
            println!(command);
            if command == "reject" { process_exit(1); }
            i += 2;
        }
        return;
    }
    let mut state = footnote_bind_start();
    state = footnote_bind_step(state, "start", 0.0);
    println!(footnote_bind_command(state));
    state = footnote_bind_step(state, "reference", 3.0);
    println!(footnote_bind_command(state));
    state = footnote_bind_step(state, "resolve", 2.0);
    println!(footnote_bind_command(state));
    state = footnote_bind_step(state, "typeset", 0.0);
    println!(footnote_bind_command(state));
    state = footnote_bind_step(state, "resolve", 1.0);
    println!(footnote_bind_command(state));
    state = footnote_bind_step(state, "typeset", 0.0);
    println!(footnote_bind_command(state));
}

Expected output

begin_layout
add_unresolved
bind_references
reject
bind_references
render_proof

Published versions

VersionPackageSource commitSHA-256
0.1.2Download ZIP · Browse filesed49aef468890cff0eee6ad7743735f89a281bf0657dc330a94bfdb7930f8ac0db6d1f10e7
0.1.1Download ZIP · Browse files5b2fc89ad37322bc9e46ceaf3aa2f1a0108ce200e2b2ffce2238704bceeb6e811eacfb4bd8
0.1.0Download ZIP · Browse files6349f23784b6ff263c754833c96fec4b6a209255ff794d3d16250f2986382041b8c8f8cd34