Commits

Fredrik Håård  committed 6fc6880

proton-te testing

  • Participants
  • Parent commits 7375bf4
  • Branches proton-te

Comments (0)

Files changed (2)

 from ConfigParser import SafeConfigParser, NoSectionError, NoOptionError
 import codecs
 import argparse
+import proton.template
 
 class Config(object):
     def __init__(self, path, defaults):
                     parts, 
                     comments=shortcomments, 
                     link=get_absolute_url(parts)))
+
+    #out = page_tpl.substitute(
+    #            defaults,
+    #            links=links, 
+    #            footer=footer,
+    #            main="\n".join(main))
+
+    ptl = proton.template.Templates(templates_path)['pagetemplate.html']
+    for i in 0, 1:
+        ptl.setelement(u'title', parts['title'], i)
+
     #Write main page
     with open(os.path.join(html_path, "index.html"), "w") as target:
-        target.write(page_tpl.substitute(
-                defaults,
-                links=links, 
-                footer=footer,
-                main="\n".join(main)).encode("utf-8"))
+        target.write(str(ptl))
     #Write rss
 
     description = config.get('content', 'description')

File templates/pagetemplate.html

 <!DOCTYPE html >
 <html lang="en">
 <head>
-  <title>${page_title}</title>
-  <meta charset="UTF-8">
+  <title eid='title'>Page title</title>
+  <meta charset="UTF-8" />
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <link rel="stylesheet" type="text/css" href="${css}" />
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
 
     <section class="page">
       <header class="page">
-        <h1>${page_title}</h1>  
+        <h1 eid='title'>${page_title}</h1>  
       </header>  
       
       ${main}