<!doctype html>
<html lang="en">
    <center>
    <head>
        {% block head %}
        <script src="https://cdn.jsdelivr.net/npm/fuse.js/dist/fuse.js"></script>
        <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
        <script type="text/javascript" src="{{ url_for('static', filename='js/auto-complete.js') }}"></script>
        <script type="text/javascript" src="{{ url_for('static', filename='js/lunr.min.js')}}"></script>
        <script type="text/javascript" src="{{ url_for('static', filename='js/search.js')}}"></script>
        <link rel="stylesheet" href="{{ url_for('static', filename=stylesheet) }}">
        <link rel="stylesheet" href="{{ url_for('static', filename=stylesheet_auto_complete) }}">
        <br>
        <title>{% block title %}{{ project_title }}{% endblock %}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        {% endblock %}
    </head>

    <body class="HolyGrail">
  <header>
    <div class="menu">
    <a href="{{ url_for('content') }}" style="text-decoration:none">{{ project_name }}</a>
    </div>
    <div class="search-container">    
        <label for="search-by"><i class="fas fa-search"></i></label>
        <input data-search-input="" id="search-by" type="search" placeholder="Search..." autocomplete="off">
        <!--button type="submit"><i class="search"></i>&#128269;</button>-->
        <span data-search-clear=""><i class="fas fa-times"></i></span>
    <p></p>
    </div>
</div>
  </header>

  <div class="HolyGrail-body">
    <nav class="HolyGrail-nav">
  <ul>
      {%- for item in tree.children recursive %}
      {%- set name = item.name.split('/')[-1] -%}
      {%- if item.type != "directory" -%}
      <li><a href="{{ item.name }}.html">{{ name }}</a></li>
        {%- else -%}
        {%- if item.children|length -%}
        <details id={{ name }} ontoggle="linkClick(this); return false;" ><summary>{{ name[0]|upper }}{{ name[1:] }}</summary>
        {%- endif -%}
        {%- endif -%}
    {%- if item.children and item.children|length -%}
    <ul>{{ loop(item.children) }}</ul></details>
    {%- endif %}
{%- endfor %}
</ul>
    </nav>
    <main class="HolyGrail-content">{% block content %}{% endblock %}</main>
    {{ toc | safe }}
  </div>
  <footer>
         {% block footer %}
<p></p>
    <center>
            &copy; Stefan Friese
    </center>
            {% endblock %}
  </footer>
</body>
        <script>
    function linkClick(obj) {
       if (obj.open) {
           //console.log('open');
                       if (sessionStorage.getItem(obj.id) && !(sessionStorage.getItem(obj.id) === "open")) {
                           sessionStorage.removeItem(obj.id);
                       }
           sessionStorage.setItem(obj.id,"open");
           console.log(obj.id);
       } else {
           //console.log('closed');
            sessionStorage.removeItem(obj.id);
      }
    }

    let _keys = Object.keys(sessionStorage);
    if (_keys) {
       for ( let i = 0; i < _keys.length; i++ ) {
            document.getElementById(_keys[i])['open'] = 'open';
       }
    }
</script>            
    <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      config: ["MMLorHTML.js"],
      jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"],
      extensions: ["MathMenu.js", "MathZoom.js"]
    });
    </script>
    </body>
</html>