|
27 | 27 | <div class="title">{{entry.title}}</div>
|
28 | 28 | <!-- Author -->
|
29 | 29 | <div class="author">
|
30 |
| - {%- for author in entry.author_array -%} |
| 30 | + {% assign author_array_size = entry.author_array | size %} |
| 31 | + |
| 32 | + {%- if site.max_author_limit and author_array_size > site.max_author_limit %} |
| 33 | + {% assign author_array_limit = site.max_author_limit %} |
| 34 | + {% else %} |
| 35 | + {% assign author_array_limit = author_array_size %} |
| 36 | + {% endif %} |
| 37 | + |
| 38 | + {%- for author in entry.author_array limit: author_array_limit -%} |
31 | 39 | {%- assign author_is_self = false -%}
|
32 |
| - {%- if author.last == site.scholar.last_name%} |
| 40 | + {%- if author.last == site.scholar.last_name %} |
33 | 41 | {%- if site.scholar.first_name contains author.first -%}
|
34 | 42 | {%- assign author_is_self = true -%}
|
35 | 43 | {%- endif -%}
|
|
62 | 70 | {%- endif -%}
|
63 | 71 | {%- endif -%}
|
64 | 72 | {%- else -%}
|
| 73 | + {%- if author_array_limit == author_array_size %} and {% endif %} |
65 | 74 | {% if author_is_self -%}
|
66 |
| - and <em>{{author.last}}, {{author.first}}</em> |
| 75 | + <em>{{author.last}}, {{author.first}}</em> |
67 | 76 | {% else -%}
|
68 | 77 | {%- if coauthor_url -%}
|
69 |
| - and <a href="{{coauthor_url}}">{{author.last}}, {{author.first}}</a> |
| 78 | + <a href="{{coauthor_url}}">{{author.last}}, {{author.first}}</a> |
70 | 79 | {% else -%}
|
71 |
| - and {{author.last}}, {{author.first}} |
| 80 | + {{author.last}}, {{author.first}} |
72 | 81 | {%- endif -%}
|
73 | 82 | {%- endif -%}
|
74 | 83 | {%- endunless -%}
|
75 | 84 | {%- endif -%}
|
76 | 85 | {%- endfor %}
|
| 86 | + |
| 87 | + {% assign more_authors = author_array_size | minus: author_array_limit %} |
| 88 | + |
| 89 | + {%- if more_authors > 0 %} |
| 90 | + {% assign more_authors_hide = more_authors | append: " more author" %} |
| 91 | + {% if more_authors > 1 %} |
| 92 | + {% assign more_authors_hide = more_authors_hide | append: "s" %} |
| 93 | + {% endif %} |
| 94 | + {% assign more_authors_show = '' %} |
| 95 | + {%- for author in entry.author_array offset: author_array_limit -%} |
| 96 | + {% assign more_authors_show = more_authors_show | append: author.last | append: ", " | append: author.first %} |
| 97 | + {% unless forloop.last %} |
| 98 | + {% assign more_authors_show = more_authors_show | append: ", " %} |
| 99 | + {% endunless %} |
| 100 | + {%- endfor -%} |
| 101 | + and |
| 102 | + <span |
| 103 | + class="more-authors" |
| 104 | + title="click to view {{more_authors_hide}}" |
| 105 | + onclick=" |
| 106 | + var element = $('span.more-authors'); |
| 107 | + var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}'; |
| 108 | + var cursorPosition = 0; |
| 109 | + var textAdder = setInterval(function(){ |
| 110 | + element.text(more_authors_text.substring(0, cursorPosition + 1)); |
| 111 | + element.attr('title', ''); |
| 112 | + if (++cursorPosition == more_authors_text.length){ |
| 113 | + clearInterval(textAdder); |
| 114 | + } |
| 115 | + }, 15); |
| 116 | + " |
| 117 | + >{{more_authors_hide}}</span> |
| 118 | + {% endif %} |
| 119 | + |
77 | 120 | </div>
|
78 | 121 |
|
79 | 122 | <!-- Journal/Book title and date -->
|
|
0 commit comments