<!DOCTYPE html>
<html lang="en">
  <head>
  {% block head %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    {{ meta }}

    <title>{{ title }}</title>

    {% if embed -%}
      {% for stylesheet in embed['css'] -%}
      <style>{{ stylesheet }}</style>
      {%- endfor -%}
    {%- else -%}
      {%- for stylesheet in css -%}
    <link href="{{ stylesheet }}" rel="stylesheet">
      {%- endfor -%}
    {%- endif %}
    <style>.container { width: 740px; margin-top: 2em; } h1 { margin-bottom: 12px; } h2 { margin-bottom: 6px; }</style>
    {% if not prettify %}
    <style>
      /* fix pygments line number stuff */
      table.code {
        width: 720px;
      }
      td.code { width: 100%; }
      td.linenos { min-width: 0; }
      div.linenodiv pre {
        background-color: #fbfbfc;
        text-shadow: 0 1px 0 white;
        padding-left: 14px; padding-right: 12px;
        line-height: 18px;
        color: #BEBEC5;
      }
      div.linenodiv pre, div.code pre { 
        border: 1px solid #E1E1E8;
        width: 100%;
      }
      div.code pre {
        padding-left: 12px;
        background-color: #F7F7F9;
      }
    </style>
    {% endif %}
    {# javascript #}
    {% if embed %}{% for script in embed['js'] -%}
        <script>{{ script }}</script>
    {%- endfor %}{% else %}{% for script in js -%}
    <script src="{{ script }}"></script>
    {%- endfor %}{% endif %}
    
  {% endblock %}
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  {% block outerbody %}
  <body {% if prettify %}onload="prettyPrint();"{% endif %}>
  <div class="container">
  {{ header|safe }}
  {% block body %}
{{ document }}
  {% endblock %}
  {{ footer|safe }}
  </div>

  {% if (embed['js'] or js) and not prettify %}
  {# add linenumbers to pygmentized source when javascript is available #}
  <script>$("div.linenodiv pre").each(function() { $(this).html($(this).html().replace(/\n/g, '.\n') + '.'); });</script>
  {% endif %}
  </body>
  {% endblock %}
</html>
