Exemple #1
0
def nav_html():
  navlist = []
  navlist.append(('About Me', '{{wr}}luke/index.html'))
  navlist.append(('Projects', '{{wr}}projects/index.html'))
  navlist.append(('Blog', '{{wr}}blog/index.html'))
  navlist.append(('Site Map', '{{wr}}map.html'))
  
  s = parts.load('nav.begin')
  for link, address in navlist:
    s += '<li><a href="' + address + '">' + link + '</a></li>\n'
  s += parts.load('search')
  s += parts.load('nav.end')
  return s
Exemple #2
0
def comments(p):
  if p.is_auto_index or p.is_dir:
      p.enable_comments = False

  if p.enable_comments:
    comment_html = '<br>'
    comment_html += parts.load('comments')
    
    # id based on address
    comment_html = comment_html.replace('{{disqus_identifier}}', p.address())
    return comment_html
  else:
    return ''
Exemple #3
0
def page(p):
  print "building page", p.human_name
  
  # beginning of head
  s = '<!DOCTYPE html><html>'
  s += '<head>'
  
  s += '<title>{{sn}} | ' + p.human_name + '</title>'
  
  s += parts.load('favicon')

  # style
  if config.use_less:
    s += parts.load('bootstrap_less')
  else:
    s += parts.load('bootstrap_css')

  s += parts.load('js_libs')
  s += parts.load('google_analytics')
  
  # end head, start page
  s += '</head><body>'
  
  # minify everything we have so far
  s = utils.minify(s)
  
  # main wrapper
  s += '<div id="wrapper">'

  # top bar and navigation
  s += utils.minify(nav_html())
  
  # start bg wrapper
  s += '<div id="bg-wrapper">'

  # sidebar
  s += sidebar(p)
  
  # start container
  s += '<div class="container" style="width: 800px;">'

  # start content
  s += '<div id="page-body">'
  s += p.breadcrumb()
  s += utils.md(p.content)
  
  s += utils.minify(comments(p))
  
  # end content
  s += '</div>'

  # end container
  s += '</div>'
  
  # end bg wrapper
  s += '</div>'
  s += '<div class="push"></div>'
  
  # end main wrapper
  s += '</div>'
  s += utils.minify(parts.load('footer'))
  s += '</body>'
  s += '</html>'
  
  return s