{%- if page.collection == “organization” -%}

{%- if site.data.publish[page.identifier] -%}
  {%- assign biblio = site.data.publish[page.identifier].references | sort: "id" -%}
{%- endif -%}

{%- elsif page.collection == “person” -%}

{%- assign biblio = site.data.biblio.references | sort: "id" -%}

{%- else -%}

{%- assign biblio = site.data.biblio.references | sort: "id" -%}

{%- endif -%} {% if page.collection and biblio %}<h3>Produção bibliográfica e técnica</h2>{% endif %} <ol class=“refs bib-chicago”>

{% for work in biblio %}
  {%- assign output = 1 -%}
  {%- if page.collection == "person" -%}
    {%- assign output = 0 -%}
    {%- if work.author -%}
      {%- for author in work.author -%}
        {%- if author.family == page.familyName and author.given == page.givenName -%}
          {%- assign output = output | plus: 1 -%}
        {%- endif -%}
      {%- endfor -%}
    {%- endif -%}
    {%- if work.editor -%}
      {%- for editor in work.editor -%}
        {%- if editor.family == page.familyName and editor.given == page.givenName -%}
          {%- assign output = output | plus: 1 -%}
        {%- endif -%}
      {%- endfor -%}
    {%- endif -%}
  {%- endif -%}
  {%- if output > 0 -%}
  <li itemscope itemtype="http://schema.org/{%- case work.type -%}
                                            {%- when "book" -%}Book
                                            {%- when "article-journal" -%}Article
                                            {%- when "chapter" or "paper-conference" -%}Chapter
                                            {%- when "collection" -%}Collection
                                            {%- when "thesis" -%}Thesis
                                            {%- when "artwork" -%}VisualArtwork
                                            {%- else -%}Creativework
                                            {%- endcase -%}" id="{{ work.id }}">
    {% if work.author %}
    <span itemprop="author">
      {% for author in work.author %}
        {%- if author.family -%}
          {%- if forloop.first -%}
          <span itemscope itemtype="http://schema.org/Person">{{ author.dropping-particle | append: " " }}{{ author.family }}, {{ author.given }}</span>
          {%- else -%}
          <span itemscope itemtype="http://schema.org/Person">{{ author.given | append: " " }}{{ author.dropping-particle | append: " " }}{{ author.family }}</span>
          {%- endif -%}
        {%- else -%}
          <span itemscope itemtype="http://schema.org/Organization">{{ author }}</span>
        {%- endif -%}
        {%- if forloop.last -%} {%- else -%}; {% endif %}
      {% endfor %}
    </span>
    {% endif %}
    <time datetime="{{ work.issued[0].year }}" itemscope itemprop="datePublished" itemtype="http://schema.org/Date">({{ work.issued[0].year }})</time>
    <span itemprop="name">
      {%- case work.type %}
      {%- when "book" or "thesis" or "artwork" or "collection" -%}
        <em>{{ work.title }}.</em>
      {%- else %}
        “{{ work.title }}.”
      {%- endcase %}
    </span>
    {%- if work.type == 'chapter' or work.type == 'paper-conference' -%} In:
      {% if work.editor %}
        <span itemprop="editor">
          {% for editor in work.editor %}
            {%- if editor.family -%}
              <span itemscope itemtype="http://schema.org/Person">{{ editor.given | append: " " }}{{ editor.dropping-particle | append: " " }}{{ editor.family }}</span>
            {%- else -%}
              <span itemscope itemtype="http://schema.org/Organization">{{ editor }}</span>
            {%- endif -%}
          {% if forloop.last %}
            {% if forloop.last == forloop.first %}
              (ed.)
            {% else %}
              (eds.)
            {% endif %}
          {%- else -%}; {% endif %}
          {% endfor %}
        </span>
      {% endif %}
    {%- endif -%}
    {%- if work.container-title or work.event -%}
      <span itemprop="isPartOf">
        {%- if work.container-title -%}
          {%- if work.event -%}
            {{ work.event | append: ': ' }}
          {%- endif -%}
          <em>{{ work.container-title }}</em>
        {%- elsif work.event -%}
          <em>{{ work.event }}</em>
        {%- endif -%}
        {%- if work.volume -%}
          <span itemprop="volumeNumber">{{work.volume | prepend: ', ' }}</span>
        {%- endif -%}
        {%- if work.issue -%}
          <span itemprop="issueNumber">{{ work.issue | prepend: ' (' | append: ')' }}</span>
        {%- endif -%}
      </span>
    {%- endif -%}
    {%- if work.publisher or work.publisher-place -%}. 
      {% if work.publisher %}
        <span itemprop="spatial" itemtype="http://schema.org/Location">{{ work.publisher-place | append: ': ' }}</span>
        <span itemprop="publisher" itemtype="http://schema.org/Organization">{{ work.publisher }}</span>
      {%- else -%}
        <span itemprop="spatial" itemtype="http://schema.org/Location">{{ work.publisher-place }}</span>
      {%- endif -%}
    {%- endif -%}
    {% if work.genre %}
      <span itemprop="genre">{{ product.genre }}</span>
      <span itemprop="locationCreated">{{ work.event-place }}<span>
    {% endif %}
    {%- if work.page -%},
      <span itemprop="pagination">{{ work.page | replace: "-", "--" }}</span>
    {%- endif -%}
    {%- if work.ISBN -%}. ISBN 
      {% assign isbn = work.ISBN | split: " " %}
      <span itemprop="ISBN">{{ isbn[0] }}</span>
    {%- endif -%}
    {%- if work.ISSN -%}. ISSN 
      <span itemprop="ISSN">{{ work.ISSN }}</span>
    {%- endif -%}
    {%- if work.DOI -%}.
      <a itemprop="doi" href="http://dx.doi.org/{{ work.DOI }}">{{ work.DOI }}</a>
    {%- elsif work.URL -%}.
      <a itemprop="url" href="{{ work.URL }}">{{ work.URL }}</a>
    {%- endif -%}
  </li>
  {%- endif -%}{%- assign output = 0 -%}
{% endfor %}

</ol> <!– vim: set ft=liquid shiftwidth=2 tabstop=2 expandtab foldmethod=indent : –>