{% macro link_for(url, icon) %}
<a target="_blank" class="ref-link" href="{{ url }}"><i class="fa fa-{{ icon }} fa-1"></i> </a>
{% endmacro %}

{% macro citation_for(ref) -%}
{{ link_for(ref.url, 'quote-right') }}
{%- endmacro %}

{% macro bibentry(ref) -%}
<p class="ref" id="{{ ref.key }}">
    <a class="jump" href="#{{ ref.key }}"></a>
    <span class="ref-author-list">
        {% for author in ref.author -%}
        {% if loop.last and not loop.first %} and {% endif %}<span class="ref-author"
            data-given="{{ author.get('given') }}" data-family="{{ author.family }}">{{ author.get('given') }} {{
            author.family }}</span>{% if not loop.last %}, {% else %}.{% endif %}
        {%- endfor %}
    </span>
    <span class="ref-title">"{{ ref.title }}."</span>
    <span class="ref-container">{{ ref.container_title_short or ref.container_title or (ref.type | title) or 'Other' }}.</span>
    <span class="ref-date">{{ ref.issued.year }}.</span>
    {% if ref.note %}<span class="ref-note">({{ ref.note }})</span>{% endif %}
    {% for link in ref.links %}
    {{ link_for(link.href, link.icon) }}
    {% endfor %}
    {{ citation_for(ref) }}
</p>
{%- endmacro %}

{% set bibcss %}
/* jump links for research page, adapted from 6031 */
.margin {
  position: fixed;
  height: 100%;
}

a.jump {
  opacity: 0;
  position: absolute;
  left: 2em;
  padding: 0 1em 1em 1em;
  transition: opacity .5s 0s;
}

a.jump::after {
  content: '#';
}

.margin:hover ~ * a.jump,
p:hover > a.jump,
a.jump:hover {
  opacity: 1;
  transition: opacity .5s 0s;
}

[id]:target {
  animation: highlightout 3s;
}
@keyframes highlightout {
  from { background: #fcf8e3; }
}
/* end of jump links */

.ref-link {
    z-index: 10;
}
{% endset %}
