Reference and examples

This page keeps a reference complete and each example true. Make the pages from data, run each example in the build, and make each picture with a tool.

Reference pages from data

A reference has many entries in one form. When the entries are data, a tool can check that each one is complete, and a plugin can make the pages.

The command reference of ztcl works this way:

command string {
    synopsis {string SUBCOMMAND ?ARG ...?}
    summary {The commands for text: length, search, compare, change, and test.}
    subcommand map {
        synopsis {string map ?-nocase? MAPPING STRING}
        summary {Replaces each key of a list of keys and values with its value.}
        example {string map {a 1 b 2} abcab} 12c12
        error {string map a} {wrong # args: should be "string map ?-nocase? charMap string"} {TCL WRONGARGS}
    }
}

In Flight Manual, a plugin with the hook pages makes the pages from data. The example api makes a page for each function of a JSON file.

Examples that cannot lie

An example that does not run goes out of date with the next change of the program. Put each example where the build or CI runs it, and compare its output:

When an example changes its output on purpose, update the copy of the output in the same commit. The diff then shows the change to the reviewer.

Pictures that the build makes

A picture made by hand is old after the next change of the look. Make each picture with a tool of the repository:

Run the tool after each change of the look, and commit the pictures with the change.

Next: Review a page.