<html>
  <head>
    <title>{{name}}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="application/ld+json">
      {{{ jsonld }}}
    </script>
    <style>
      body {
        font-size: 16px;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
        margin: 0 auto;
        padding: 1rem;
        max-width: 800px;
      }

      #map {
        height: 20rem;
      }

      #attributes-wrapper,
      #jsonld-wrapper {
        height: 20rem;
        overflow-y: scroll;
      }

      table {
        border-collapse: collapse;
      }

      th {
        border-bottom: 1px solid black;
      }

      th, td {
        padding: 0.25rem;
      }

      table.listing td {
        border: 1px solid #CCC;
      }

      table.listing tr td:first-child {
          background-color: #EEE;
      }

      table.listing ul {
        margin: 0 0 0 1.5rem;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <h1>{{name}}</h1>
    <p><strong>Description:</strong> {{description}}</p>

    <h2>Bibliographic</h2>

    <table class="listing">
      <tr>
        <td>Published</td>
        <td>{{datePublished}}</td>
      </tr>
      <tr>
        <td>Keywords</td>
        <td>
          <ul>
          {{#keywords}}
            <li>{{.}}</li>
          {{/keywords}}
        </ul>
        </td>
      </tr>
      <tr>
        <td>Funder</td>
        <td>{{funder}}</td>
      </tr>
      <tr>
        <td>License</td>
        <td>{{license}}</td>
      </tr>
    </table>

    <h2>Coverage</h2>

    <h3>Temporal</h3>

    <table class="listing">
      <tr>
        <td>Begin</td>
        <td>{{beginDate}}</td>
      </tr>
      <tr>
        <td>End</td>
        <td>{{endDate}}</td>
      </tr>
    </table>

    <h3>Spatial</h3>
    <pre><code>{{ geographicCoverage }}</code></pre>
    <div id="map"></div>

    <h2>Attributes</h2>

    <div id="attributes-wrapper">
      <table id="attributes">
        <thead>
          <tr>
            <th>Name</th>
            <th>Description</th>
            <th>Unit</th>
          </tr>
        </thead>
        <tbody>
          {{#variableMeasured}}
          <tr>
            <td><code>{{ name }}</code></td>
            <td>{{ description }}</td>
            <td>{{ unitText }}</td>
          </tr>
          {{/variableMeasured}}
        </tbody>
      </table>
    </div>

    <h2>Distribution</h2>
    <table>
      <thead>
        <tr>
          <th>File</th>
          <th>Format</th>
          <th>&nbsp;</th>
        </tr>
      </thead>
      <tbody>
        {{#distribution}}
        <tr>
          <td><code>{{ name }}</code></td>
          <td><code>{{ encodingFormat }}</code></td>
          <td><a href="{{ contentUrl }}">Download</a></td>
        </tr>
        {{/distribution}}
      </tbody>
    </table>

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
  integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
  crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
  integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
  crossorigin=""></script>
    <script>
      var mymap = L.map('map').setView({{mapcenterstring}}, 1);

      L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
        maxZoom: 18,
      }).addTo(mymap);

      var polygon = L.polygon({{mappolystring}}).addTo(mymap);
    </script>
  </body>
</html>
