Basic

A template as a shape with holes

A template is a page with names in it. The names are holes, and the holes are the whole interface between a template and a page.

What you will see

refuse before fill. Late filling is what ships a page with a hole.

About 1 min of reading

Try It

List the holes and check them

1

Write the holes

printf 'title\ndate\nbody\n' > /tmp/h.txt; wc -l < /tmp/h.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
3. Three holes is the interface of the template.
2

Check against the matter

printf 'title\ndate\n' > /tmp/m.txt; comm -23 /tmp/h.txt /tmp/m.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
body. The missing name is named, which is the refusal.
3

Refuse before filling

printf 'missing 1\n' | awk '{print ($1==0) ? "fill" : "refuse before fill"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
refuse before fill. Late filling is what ships a page with a hole.

Data Flow

A template to filled holes
1 The holes are listed from the template
↓
2 The names are checked against the matter
↓
3 A missing name refuses with the name
↓
4 The holes are filled
Why this works
Why the holes are checked before filling

A missing name filled late is a page with a hole in it. A page with a hole is a page that shipped, and shipped is too late.

The one thing a template never does

Read a file. Reading is the build's job, and one job is what keeps the passes separate.

Examples

A hole is a name

The name is read from the matter. A name read is a value that may be missing, and missing is a decision.

The holes are listed

The template says which names it needs. A list is what the build checks against the matter.

A template has no logic of its own

It fills and nothing else. Filling only is what makes a template readable by a reader.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Reading a folder as a contract
Previous Lesson
Reading a folder as a contract
Next Lesson
Filling with escaping
Filling with escaping →