Commits

Fredrik Håård committed 6fc6880

proton-te testing

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')

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}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.