<!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.css') }}">
        <link rel="stylesheet" href="{{ url_for('static', filename='auto-complete.css') }}">
        <br>
        <title>{% block title %}The Real Hugo{% endblock %}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        {% endblock %}
    </head>
    <body>
        <!-- topmenu -->
    <div class="menu">
    <a href="{{ url_for('content') }}" style="text-decoration:none">Husk</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>
    </div>

</div>
    <div class="menu">
    </div>
    <!--br><br-->
    </center>
<p></p>
        <div class="columns">
        <!-- Sidebar -->
<div class="column column-1">
  <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>
</div>
<div class="column column-2">{% block content %}{% endblock %}</div>
</div>
<div id="footer">
         {% block footer %}
<p></p>
    <center>
            &copy; Stefan Friese
    </center>
            {% endblock %}
        </div>

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