PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>

TEMPLATE <head.rqg>( ?ontology , ?lang) {
  "<head>"
  "<meta charset='UTF-8'>"
  BOX { "\n" 

    TEMPLATE {
     "<title>" ?title "</title>\n"
    } ITERATOR <select/title.rqg>(?ontology, ?lang) AS ?title . 

    TEMPLATE { 
      '''<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <link href="{?cssLocation}owl.css" rel="stylesheet" type="text/css" />
    <link href="{?cssLocation}Primer.css" rel="stylesheet" type="text/css" />
    <link href="{?cssLocation}rec.css" rel="stylesheet" type="text/css" />
    <link href="{?cssLocation}extra.css" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon"Locatio href="{?cssLocation}favicon.ico" />
    <script src="{?cssLocation}jquery.js"><!-- Comment for compatibility --></script>
    <script src="{?cssLocation}jquery.scrollTo.js"><!-- Comment for compatibility --></script>
    <script src="./marked.min.js"><!-- Comment for compatibility --></script>
    <script>
    $(document).ready(
      function () \{
        jQuery(".markdown").each(function(el)\{jQuery(this).after(marked(jQuery(this).text())).remove()});
        var list = $('a[name="{?ontology}"]');
        if (list.size() != 0) \{
          var element = list.first();
          $.scrollTo(element);
        }
      });
    </script>'''
    } 
    WHERE {
     BIND( COALESCE( fun:property(<properties/preferences.properties>, "css-location"), "" ) AS ?cssLocation )
    } .
  }
  "\n</head>"  
}