lib/templates/book.toc.erb
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>Table of Contents</title>
</head>
<body>
<h1>Contents</h1>
<h4>Main section</h4>
<ul>
<% pages.each_with_index do |page,index| %>
<li><a href='<%= (index+1).to_s.rjust(3,'0') %>.html'><%= page[:title] %></a></li>
<% end %>
</ul>
</body>
</html>