<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -63,16 +63,30 @@ def parse(fname):
 
 get_outp = lambda s:'.'.join(s.split('.')[:-1]) + '.html'
            
-        
-def parse_directory(current_dir, files, output_dir):
-    files = [f for f in files if ext(f) in options['extensions']]
+def get_template(template_dir, template):
+    &quot;&quot;&quot;Takes the directory where templates are located and the template name. Returns a blob containing the template.&quot;&quot;&quot;
+    template = os.path.join(template_dir, template)
+
     f = open(template, 'r')
     blob = Template(f.read())
     f.close()
+    return blob
+        
+def parse_directory(current_dir, files, output_dir):
+    files = [f for f in files if ext(f) in options['extensions']]
     for f in files:
         inp = os.path.join(current_dir,f)
         outp = get_outp(os.path.join(output_dir,f))
+
         headers, body = parse(inp)
+
+        # Attempt to use the file specified template, if not fall back to default.
+        blob = get_template(template_dir, template)
+        try:
+            blob = get_template(template_dir, headers['template'])
+        except:
+            pass
+
         format = options['format']
         try:
             format = headers['content-type']</diff>
      <filename>webgen.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8ae4e620edd944dba831bdfc7bda3dbc5f9c9ca1</id>
    </parent>
  </parents>
  <author>
    <name>Tarrant Rollins</name>
    <email>tarrant.rollins@gmail.com</email>
  </author>
  <url>http://github.com/btbytes/webgen.py/commit/c423ec164f9f50da39cc9bf6137d0c5bf6f17b5f</url>
  <id>c423ec164f9f50da39cc9bf6137d0c5bf6f17b5f</id>
  <committed-date>2008-12-08T19:07:13-08:00</committed-date>
  <authored-date>2008-12-08T19:07:13-08:00</authored-date>
  <message>Added page-specific Templates.</message>
  <tree>07b6cd81e948199e2b31332aa6cec5dc41ad028e</tree>
  <committer>
    <name>Tarrant Rollins</name>
    <email>tarrant.rollins@gmail.com</email>
  </committer>
</commit>
