Collation is the process used by Inweb when it makes a new file in the weave output. For example, consider this weave (last seen in Contents Pages):

$ inweb weave smorgasbord -to my_website
weaving web "Sorting Smorgasbord" (Python program in MarkdownCode notation) as HTML
	[my_website/cnsr.html] [qcsr]
	[index]
	10 files copied to: my_website/assets

Here Inweb needs to make two section pages and one index page.

File Collated from
my_website/cnsr.html HTML/template-body.html
my_website/qcsr.html HTML/template-body.html
my_website/index.html HTML/template-index.html

Collation can also happen on smaller scales. When Inweb turns a Navigation resource into the actual HTML for a sidebar of navigation links, it does that by collation. (See Sitemaps.) And collation is also used when Inweb injects content from plugins into web pages. (See Asset Management.) As this demonstrates, one collation can include the output of another.

The basic idea is very simple. The template is a file like a pro-forma letter, which has everything in place except the actual text. Collating fills this in to make a finished letter.

For example, here is a template file for making an HTML page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>[[Booklet Title]]</title>
		[[Plugins]]
	</head>
	<body>
[[Weave Content]]
	</body>
</html>

Collating with this is just copying it over verbatim: except for the placeholders in double square brackets.

Placeholders used on body pages

Placeholders used on index pages

The template-index.html file has access to additional placeholders enabling it to generate contents/index pages: