Advertisement
mixster

SASSPy template

Nov 10th, 2013
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. from sass import *
  2.  
  3. def make_template():
  4.     css = VoidTag('link', None, (('href', 'style.css'), ('rel', 'stylesheet'), ('type', 'text/css')))
  5.     content = None
  6.  
  7.     with Tag('div', None, (('id', 'root'),)) as root:
  8.         with Tag('div', root, (('id', 'header'),)) as header:
  9.             Content("Read Only", Tag('h1', header))
  10.             Content("A Little Writer's Space", Tag('h2', header))
  11.  
  12.         with Tag('div', root, (('id', 'body'),)) as body:
  13.             content = Tag('div', Tag('div', body, (('id', 'content-wrapper'),)), (('id', 'content'),))
  14.  
  15.             with Menu(Tag('div', body, (('id', 'menu'),)), Tag('div', None, (('class', 'link'),))) as menu:
  16.                 items = (('Home', 'index'), ('Stories', 'stories'), ('About', 'about'))
  17.                 for title, url in items:
  18.                     MenuItem(title, url, menu)
  19.  
  20.             Tag('div', body, (('class', 'clear'),))
  21.  
  22.         with Tag('div', root, (('id', 'footer'),)) as footer:
  23.             Content("There's probably some copyright and reserved rights.\nIf you want to contact the webmaster, please check the ", footer)
  24.             Content('About', InlineTag('a', footer, (('href', 'about.html'),)))
  25.             Content(" page.", footer)
  26.  
  27.  
  28.         return Template(root, content, menu, css)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement