<div about="{{ sscres }}" typeof="schema:SoftwareSourceCode" class="softwaresourcecode">
    <div class="leftcolumn">
    {% if g.value(sscres, SDO.name) %}
    <h1 property="schema:name">{{ g.value(sscres, SDO.name) }}</h1>
    {% else %}
    <h1 property="schema:identifier">{{ g.value(sscres, SDO.identifier) }}</h1>
    {% endif %}

    {% if g.value(sscres, SDO.thumbnailUrl) %}
    <img class="thumbnail" src="{{ g.value(sscres, SDO.thumbnailUrl) }}" alt="{{ g.value(sscres, SDO.name) }}" />
    {% endif %}

    {% if g.value(sscres, SDO.description) %}
    <div property="schema:description">{{ g.value(sscres, SDO.description) }}</div>
    {% endif %}

    {% if not has_actionable_targetproducts(g,res) %}
        {% if g.value(sscres, SDO.url) %}
        <div class="go">
            <i class="fa fa-home"></i>
            <a rel="schema:url" href="{{ g.value(sscres, SDO.url) }}">
                <strong>Go to the software website</strong>
                <tt>{{ g.value(sscres, SDO.url) }}</tt>
            </a>
        </div>
        {% elif g.value(sscres, SDO.codeRepository) %}
        <div class="go">
            <i class="fa fa-code-branch"></i>
            <a rel="schema:url" href="{{ g.value(sscres, SDO.codeRepository) }}">
                <strong>Go to the source repository</strong>
                <tt>{{ g.value(sscres, SDO.codeRepository) }}</tt>
            </a>
        </div>
        {% endif %}
    {% endif %}

    {% if has_displayable_targetproducts(g, res) %}
    <h3>Provided tools &amp; services</h3>

    <div class="targetindex">
        {% for _, targetres in get_triples(g, sscres, SDO.targetProduct, abcsort=True) %}
        {% include 'targetproduct.html' %}
        {% endfor %}
    </div>
    {% endif %}

    {% for _,_,suite in g.triples((sscres, SDO.applicationSuite,None)) %}
    <h3>Tool suite: {{ suite }}</h3>

    <p>The following closely related tools are in a tool suite together with {{ g.value(sscres, SDO.name) }}:</p>

    <div class="cards">
    {% for res,_,_ in g.triples((None, SDO.applicationSuite, suite)) %}
    {% if res != sscres %}
    {% include 'card_softwaresourcecode.html' %}
    {% endif %}
    {% endfor %}
    </div>

    {% endfor %}

    {% if g.value(sscres, SDO.screenshot)  %}
    <h3>Screenshots</h3>

    <div class="screenshots">
        {% for url, res2 in get_triples(g, sscres, SDO.screenshot, SDO.url) %}
            {% if g.value(res2, SDO.caption) %}
                <img src="{{ url }}" alt="screenshot: {{ g.value(res2, SDO.caption) }}" title="{{ g.value(res2, SDO.caption) }}" />
            {% else %}
                <img src="{{ url }}" alt="screenshot" />
            {% endif %}
        {% endfor %}
    </div>
    {% endif %}

    {% if g.value(sscres, CODEMETA.referencePublication) or g.value(sscres, SDO.citation) %}

    <h3>References</h3>

    <div class="references">
        <ul>
        {% for title, ref in get_triples(g, sscres, CODEMETA.referencePublication, contextgraph=contextgraph) %}
        {% if ref %}
        <li>{% include 'reference.html' %}</li>
        {% else %}
        <li>{{ title }}</li>
        {% endif %}
        {% endfor %}

        {% for title, ref in get_triples(g, sscres, SDO.citation, contextgraph=contextgraph) %}
        {% if ref %}
        <li>{% include 'reference.html' %}</li>
        {% else %}
        <li>{{ title }}</li>
        {% endif %}
        {% endfor %}
        </ul>
    </div>
    {% endif %}

    <h3>Citation</h3>

    <p>
    {% if g.value(sscres, CODEMETA.referencePublication) or g.value(sscres, SDO.citation) %}
    Please use one of the above reference publications to cite the software, if you want to cite the software directly, you can use the following citation generated from the metadata:
    {% else %}
    You can cite this software using the following citation generated from its metadata:
    {% endif %}
    </p>

    {% include 'citation.html' %}


    <div class="log">
        {% if (res, CODEMETAPY.errors, None) in g and int(g.value(res, CODEMETAPY.errors)) > 0 %}
        <span class="negative" title="There were problems harvesting this metadata, please inspect the log"><i class="fa fa-bug"></i>  There were {{ g.value(res, CODEMETAPY.errors) }} error(s) harvesting this metadata, please inspect the log.</span><br/>
        {% endif %}
        <button onclick="document.getElementById('harvestlog').style.display = 'block'">Show metadata harvester log ▼</button>
        <pre id="harvestlog">
{{ g.value(res, CODEMETAPY.log) }}
        </pre>
    </div>

    </div>

    <div class="properties rightcolumn">
     <h3>Properties</h3>
     <dl>
        {% if g.value(sscres, SDO.version) %}
        <dt class="version" title="The latest version of this software">Version</dt>
        <dd class="version"><span property="schema:version">
            {{ g.value(sscres, SDO.version) }}</span>

            {% if g.value(sscres, SDO.releaseNotes) %}
                (<a rel="schema:releaseNotes" href="{{ g.value(sscres, SDO.releaseNotes) }}">release notes</a>)
            {% endif %}

        </dd>
        {% endif %}

        <dt class="interface" title="Interface types">Interface types</dt>
        <dd class="interface">
            <ul>
            {% for label, comment in get_interface_types(g, sscres, contextgraph, fallback=True) %}
            <li{% if comment %} title="{{ comment }}"{% endif %}>{{ label }}</li>
            {% endfor %}
            </ul>
        </dd>

        {% if g.value(sscres, SDO.url) %}
        <dt class="url" title="The project website for this software">Software website</dt>
        <dd class="url">
            <ul>
                {% for _,_, value in g.triples((sscres, SDO.url, None)) %}
                <li><i class="fa fa-home"></i>&nbsp;<a rel="schema:url" href="{{ value }}">{{ value }}</a></li>
                {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.codeRepository) %}
        <dt class="codeRepository" title="A version controlled repository where the source code of the software is available">Source code repository</dt>
        <dd class="codeRepository"><i class="fa fa-code-branch"></i>&nbsp;<a rel="schema:codeRepository" href="{{ g.value(sscres, SDO.codeRepository) }}">{{ g.value(sscres, SDO.codeRepository) }}</a>
        {% for img, url, label in get_badge(g, sscres, "stars") %}
        {% include 'badge.html' %}
        {% endfor %}
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.applicationCategory) %}
        <dt class="category">Category</dt>
        <dd class="category">
            <ul>
                 {% for label, catres in get_triples(g, sscres, SDO.applicationCategory, abcsort=True, contextgraph=contextgraph) %}
                    <li property="schema:applicationCategory" title="{{ get_description(contextgraph, catres) }}">{{ label }}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.keywords) %}
        <dt class="keywords">Keywords <i class="fa fa-tags"></i></dt>
        <dd class="keywords">
        <ul>
             {% for label, catres in get_triples(g, sscres, SDO.keywords, abcsort=True, contextgraph=contextgraph) %}
                <li property="schema:keywords">{{ label }}</li>
             {% endfor %}
        </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, CODEMETA.developmentStatus) %}
        <dt class="developmentStatus" title="Indication of the state of this software project regarding ongoing development and/or support">Development Status</dt>
        <dd class="developmentStatus">
            <ul>
                {% for _,_, devstatres in g.triples((sscres, CODEMETA.developmentStatus, None)) %}
                {% include 'developmentstatus.html' %}
                {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, CODEMETA.issueTracker) %}
        <dt class="issueTracker" title="A bug-reporting and feature tracking system for this software">Issue Tracker (Support)</dt>
        <dd class="issueTracker"><a rel="schema:issueTracker" href="{{ g.value(sscres, CODEMETA.issueTracker) }}">{{ g.value(sscres, CODEMETA.issueTracker) }}</a>
        {% for img, url, label in get_badge(g, sscres, "issues") %}
        {% include 'badge.html' %}
        {% endfor %}
        </dd>
        {% endif %}


        {% if g.value(sscres, SDO.softwareHelp) or g.value(sscres, CODEMETA.readme) %}
        <dt class="documentation">Documentation</dt>
        <dd class="documentation">
            <ul>
                {% if g.value(sscres, CODEMETA.readme) %}
                    {% for _,_, value in g.triples((sscres, CODEMETA.readme, None)) %}
                        <li><i class="fa fa-file"></i>&nbsp;<a rel="codemeta:readme" href="{{ value }}">README</span></a></li>
                    {% endfor %}
                {% endif %}
                {% if g.value(sscres, CODEMETA.buildInstructions) %}
                    {% for _,_, value in g.triples((sscres, CODEMETA.buildInstructions, None)) %}
                        <li><i class="fa fa-file"></i>&nbsp;<a rel="codemeta:buildInstructions" href="{{ value }}">Build Instructions</span></a></li>
                    {% endfor %}
                {% endif %}
                {% if g.value(sscres, SDO.softwareHelp) %}
                {% for _,_, res2 in g.triples((sscres, SDO.softwareHelp, None)) %}
                    {% if g.value(res2, SDO.name) and g.value(res2, SDO.url) %}
                    <li about="{{ res2 }}" typeof="{{ g.value(res2, RDF.type) }}"><i class="fa fa-book"></i>&nbsp;<a rel="schema:url" href="{{ g.value(res2, SDO.url) }}"><span property="schema:name">{{ g.value(res2, SDO.name) }}</span></a></li>
                    {% elif g.value(res2, SDO.url) %}
                    <li about="{{ res2 }}" typeof="{{ g.value(res2, RDF.type) }}"><i class="fa fa-book"></i>&nbsp;<a rel="schema:url" href="{{ g.value(res2, SDO.url) }}">{{ g.value(res2, SDO.url) }}</a></li>
                    {% endif %}
                {% endfor %}
                {% endif %}
                {% if g.value(sscres, SDO.documentation) %}
                {% for _,_, res2 in g.triples((sscres, SDO.documentation, None)) %}
                    {% if g.value(res2, SDO.name) and g.value(res2, SDO.url) %}
                    <li about="{{ res2 }}" typeof="{{ g.value(res2, RDF.type) }}"><i class="fa fa-book"></i>&nbsp;<a rel="schema:url" href="{{ g.value(res2, SDO.url) }}"><span property="schema:name">{{ g.value(res2, SDO.name) }}</span></a></li>
                    {% elif g.value(res2, SDO.url) %}
                    <li about="{{ res2 }}" typeof="{{ g.value(res2, RDF.type) }}"><i class="fa fa-book"></i>&nbsp;<a rel="schema:url" href="{{ g.value(res2, SDO.url) }}">{{ g.value(res2, SDO.url) }}</a></li>
                    {% endif %}
                {% endfor %}
                {% endif %}
            </ul>
        </dd>
        {% endif %}


        {% if g.value(sscres, SDO.license) %}
        <dt class="license" title="The license under which the source code is published">License</dt>
        <dd class="license">
            <ul>
                {% for _,_, license in g.triples((sscres, SDO.license, None)) %}
                {% if (license, SDO.name, None) in contextgraph %}
                <li><a rel="schema:license" href="{{ license }}">{{ contextgraph.value(license, SDO.name) }}</a></li>
                {% elif license.startswith("http") %}
                <li><a rel="schema:license" href="{{ license }}">{{ license }}</a></li>
                {% else %}
                <li>{{ license }}</li>
                {% endif %}
                {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.author)  %}
        <dt class="author" title="The main people that developed the software">Author(s)</dt>
        <dd class="author">
            <ul>
             {% for label, pores in get_triples(g, sscres, SDO.author) %}
             <li property="schema:author">
                 {% include 'person_or_org.html' %}
             </li>
             {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.maintainer)  %}
        <dt class="maintainer" title="The person or organisation that is responsible for maintaining the software and whom you can look for support">Maintainer(s)</dt>
        <dd class="maintainer">
            <ul>
             {% for label, pores in get_triples(g, sscres, SDO.maintainer) %}
             <li>{% include 'person_or_org.html' %}</li>
             {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.contributor)  %}
        <dt class="contributor" title="All people who contributed to the project's source code">Contributor(s)</dt>
        <dd class="contributor">
            <ul>
             {% for label, pores in get_triples(g, sscres, SDO.contributor) %}
             <li>{% include 'person_or_org.html' %}</li>
             {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.producer)  %}
        <dt class="producer" title="The organisation (or person) that produces/develops the software">Producer</dt>
        <dd class="producer">
            <ul>
             {% for label, pores in get_triples(g, sscres, SDO.producer) %}
             <li>{% include 'person_or_org.html' %}</li>
             {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.publisher)  %}
        <dt class="publisher" title="The organisation (or person) that publishes the software">Publisher</dt>
        <dd class="publisher">
            <ul>
             {% for label, pores in get_triples(g, sscres, SDO.publisher) %}
             <li>{% include 'person_or_org.html' %}</li>
             {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.funder) %}
        <dt class="funder" title="funder source (e.g. specific grant)">Funder</dt>
        <dd class="funder">
            <ul>
                 {% for label, pores in get_triples(g, sscres, SDO.funder, abcsort=True) %}
                 <li>{% include 'person_or_org.html' %}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, CODEMETA.funding) %}
        <dt class="funding" title="Funding source (e.g. specific grant)">Funding</dt>
        <dd class="funding">
            <ul>
                 {% for label, res2 in get_triples(g, sscres, CODEMETA.funding, abcsort=True) %}
                     {% if res2 and g.value(res2, SDO.url) %}
                        <li property="codemeta:funding"><a href="{{ g.value(res2, SDO.url) }}">{{ label }}</a></li>
                     {% else %}
                        <li property="codemeta:funding">{{ label }}</li>
                     {% endif %}
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}


        {% if g.value(sscres, SDO.programmingLanguage) %}
        <dt class="programmingLanguage">Programming Language</dt>
        <dd class="programmingLanguage">
            <ul>
                 {% for label, res2 in get_triples(g, sscres, SDO.programmingLanguage, abcsort=True) %}
                     {% if res2 and g.value(res2, SDO.url) %}
                        <li property="schema:programmingLanguage"><a href="{{ g.value(res2, SDO.url) }}">{{ label }}</a></li>
                     {% else %}
                        <li property="schema:programmingLanguage">{{ label }}</li>
                     {% endif %}
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, CODEMETA.contIntegration) %}
        <dt class="contIntegration" title="Service that continuously tests the software on each change">Continuous Integration Tests</dt>
        <dd class="contIntegration"><a rel="codemeta:contIntegration" href="{{ g.value(sscres, CODEMETA.contIntegration) }}">{{ g.value(sscres, CODEMETA.contIntegration) }}</a></dd>
        {% endif %}

        {% if g.value(sscres, SDO.runtimePlatform) %}
        <dt class="runtimePlatform" title="The required environment needed for the software to run">Runtime Platform</dt>
        <dd class="runtimePlatform">
            <ul>
                 {% for label, _ in get_triples(g, sscres, SDO.runtimePlatform, abcsort=True, contextgraph=contextgraph) %}
                    <li property="schema:runtimePlatform">{{ label }}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.operatingSystem) %}
        <dt class="operatingSystem" title="The operating system on which the software may run">Operating System</dt>
        <dd class="operatingSystem">
            <ul>
                 {% for label, _ in get_triples(g, sscres, SDO.operatingSystem, abcsort=True, contextgraph=contextgraph) %}
                    <li property="schema:operatingSystem">{{ label }}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if (sscres,CODEMETA.softwareRequirements, None) in g or (sscres, SDO.softwareRequirements, None) in g %}
        <dt class="softwareRequirements" title="Software upon which this software relies to run and/or build">Software dependencies</dt>
        <dd class="softwareRequirements">
         <ul>
         {% if g.value(sscres, CODEMETA.softwareRequirements) %}
         {% for label, res2 in get_triples(g, sscres, CODEMETA.softwareRequirements) %}
            <li property="schema:softwareRequirements">{{ label }}</li>
         {% endfor %}
         {% elif g.value(sscres, SDO.softwareRequirements) %}
         {% for label, res2 in get_triples(g, sscres, SDO.softwareRequirements) %}
            <li property="schema:softwareRequirements">{{ label }}</li>
         {% endfor %}
         {% endif %}
         </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.processorRequirements) %}
        <dt class="processorRequirements" title="CPU requirements to run the software">Processor Requirements</dt>
        <dd class="processorRequirements">
            <ul>
                 {% for label, _ in get_triples(g, sscres, SDO.processorRequirements, contextgraph=contextgraph) %}
                    <li property="schema:processorRequirements">{{ label }}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.memoryRequirements) %}
        <dt class="memoryRequirements" title="Memory requirements in order to run the software">Memory Requirements</dt>
        <dd class="memoryRequirements">
            <ul>
                 {% for label, _ in get_triples(g, sscres, SDO.memoryRequirements, contextgraph=contextgraph) %}
                    <li property="schema:memoryRequirements">{{ label }}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.permissions) %}
        <dt class="permissions" title="Permissions that are needed to run the software">Permissions</dt>
        <dd class="permissions">
            <ul>
                 {% for label, _ in get_triples(g, sscres, SDO.permissions, contextgraph=contextgraph) %}
                    <li property="schema:permissions">{{ label }}</li>
                 {% endfor %}
            </ul>
        </dd>
        {% endif %}

        {% if g.value(sscres, SOFTWAREIODATA.consumesData) %}
        <dt class="iodata" title="High-level overview of the type(s) of data that the software consumes as input">Input data</dt>
        <dd class="iodata">
        {% for label, iores in get_triples(g, sscres, SOFTWAREIODATA.consumesData, contextgraph=contextgraph) %}
            <div>{% include 'iodata.html' %}</div>
        {% endfor %}
        </dd>
        {% endif %}

        {% if g.value(sscres, SOFTWAREIODATA.producesData) %}
        <dt class="iodata" title="High-level overview of the type(s) of data that the software produces as output">Output data</dt>
        <dd class="iodata">
        {% for label, iores in get_triples(g, sscres, SOFTWAREIODATA.producesData, contextgraph=contextgraph) %}
            <div>{% include 'iodata.html' %}</div>
        {% endfor %}
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.review) %}
        <dt class="review" title="Rating of the quality and completeness of this software metadata, based on automatic validation. Click the stars for the full validation report. Note that this is not a judgement on the suitability of the software for any particular task.">Metadata validation</dt>
        <dd class="review">
            {% include 'validationrating.html' %}
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.dateCreated) %}
        <dt class="dateCreated" title="The date and time at which the software (all versions) was first created">Created</dt>
        <dd class="dateCreated">
            {{ g.value(sscres, SDO.dateCreated).replace("T"," ").replace("Z"," ") }}
        </dd>
        {% endif %}

        {% if g.value(sscres, SDO.dateModified) %}
        <dt class="dateModified" title="The date and time at which the software (this specific version, when available) was last modified">Last modified</dt>
        <dd class="dateModified">
            {{ g.value(sscres, SDO.dateModified).replace("T"," ").replace("Z"," ")  }}

            {% for img, url, label in get_badge(g, sscres, "lastcommits") %}
            {% include 'badge.html' %}
            {% endfor %}
        </dd>
        {% endif %}

        {% set doi = get_doi(g, sscres) %}
        {% if doi %}
        <dt class="doi" title="Digital Object Identifier">DOI</dt>
        <dd class="doi">
            <a href="https://doi.org/{{doi}}">{{doi}}</a>
        </dd>
        {% endif %}

     </dl>
    </div>

</div>
