     "#{date}T#{time}Z"
   end
 
+  defp generate_module_page(output, config, node) do
+    content = Templates.module_page(config, node)
+    File.write("#{output}/OEBPS/modules/#{node.id}.html", content)
+  end
+
+  defp templates_path(other) do
+    Path.expand("epub/templates/#{other}", __DIR__)
+  end
+
+  # Helper to generate an UUID v4. This version uses pseudo-random bytes generated by
+  # the `crypto` module.
+  defp uuid4 do
+    <<u0::48, _::4, u1::12, _::2, u2::62>> = :crypto.rand_bytes(16)
+    bin = <<u0::48, 4::4, u1::12, 2::2, u2::62>>
+    <<u0::32, u1::16, u2::16, u3::16, u4::48>> = bin
+
+    Enum.map_join([<<u0::32>>, <<u1::16>>, <<u2::16>>, <<u3::16>>, <<u4::48>>], <<45>>, &(Base.encode16(&1, case: :lower)))
+  end
+
+  defp write_readme(output, config, module_nodes, {:ok, content}) do
+    content = HTML.Autolink.project_doc(content, module_nodes)
+    readme_html = Templates.readme_template(config, content)
+    :ok = File.write("#{output}/OEBPS/modules/README.html", readme_html)
+    true
+  end
+
+  defp write_readme(_, _, _, _) do
+    false
+  end
+
   defp zero_pad(val, count) do
     num = Integer.to_string(val)
     :binary.copy("0", count - byte_size(num)) <> num

                  files_to_add(output),
                  uncompress: ['mimetype'])
    {:ok, zip_path}
  end

  defp files_to_add(path) do

    |> Enum.map(&Task.await/1)
  end

  defp generate_epub(output, config) do
    output = Path.expand(output)
    target_path = "#{output}/#{config.project}-v#{config.version}.epub" |> String.to_char_list
