Improve bib layout for thesis (#920)

This commit is contained in:
Simmo Saan 2022-12-25 21:03:26 +02:00 committed by GitHub
parent 34eb856fb8
commit 925cac03bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,108 +24,111 @@
<!-- Entry bib key --> <!-- Entry bib key -->
<div id="{{entry.key}}" class="col-sm-8"> <div id="{{entry.key}}" class="col-sm-8">
{% if entry.type == "thesis" -%} <!-- Title -->
{{reference}} <div class="title">{{entry.title}}</div>
{%- else %} <!-- Author -->
<!-- Title --> <div class="author">
<div class="title">{{entry.title}}</div> {% assign author_array_size = entry.author_array | size %}
<!-- Author -->
<div class="author">
{% assign author_array_size = entry.author_array | size %}
{% assign author_array_limit = author_array_size %} {% assign author_array_limit = author_array_size %}
{%- if site.max_author_limit and author_array_size > site.max_author_limit %} {%- if site.max_author_limit and author_array_size > site.max_author_limit %}
{% assign author_array_limit = site.max_author_limit %} {% assign author_array_limit = site.max_author_limit %}
{% endif %} {% endif %}
{%- for author in entry.author_array limit: author_array_limit -%} {%- for author in entry.author_array limit: author_array_limit -%}
{%- assign author_is_self = false -%} {%- assign author_is_self = false -%}
{%- assign author_last_name = author.last | remove: "¶" | remove: "&" | remove: "*" | remove: "†" | remove: "^" -%} {%- assign author_last_name = author.last | remove: "¶" | remove: "&" | remove: "*" | remove: "†" | remove: "^" -%}
{%- if site.scholar.last_name contains author_last_name -%} {%- if site.scholar.last_name contains author_last_name -%}
{%- if site.scholar.first_name contains author.first -%} {%- if site.scholar.first_name contains author.first -%}
{%- assign author_is_self = true -%} {%- assign author_is_self = true -%}
{%- endif -%}
{%- endif -%}
{%- assign coauthor_url = nil -%}
{%- if site.data.coauthors[author_last_name] -%}
{%- for coauthor in site.data.coauthors[author_last_name] -%}
{%- if coauthor.firstname contains author.first -%}
{%- assign coauthor_url = coauthor.url -%}
{%- break -%}
{%- endif -%} {%- endif -%}
{%- endif -%}
{%- assign coauthor_url = nil -%}
{%- if site.data.coauthors[author_last_name] -%}
{%- for coauthor in site.data.coauthors[author_last_name] -%}
{%- if coauthor.firstname contains author.first -%}
{%- assign coauthor_url = coauthor.url -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- if forloop.length > 1 -%}
{%- if forloop.first == false -%},&nbsp;{%- endif -%}
{%- if forloop.last and author_array_limit == author_array_size -%}and&nbsp;{%- endif -%}
{%- endif -%}
{%- if author_is_self -%}
<em>{{author.first}} {{author.last}}</em>
{%- else -%}
{%- if coauthor_url -%}
<a href="{{coauthor_url}}">{{author.first}} {{author.last}}</a>
{%- else -%}
{{author.first}} {{author.last}}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- assign more_authors = author_array_size | minus: author_array_limit -%}
{%- assign more_authors_hide = more_authors | append: " more author" -%}
{%- if more_authors > 0 -%}
{%- if more_authors > 1 -%}
{%- assign more_authors_hide = more_authors_hide | append: "s" -%}
{%- endif -%}
{%- assign more_authors_show = '' -%}
{%- for author in entry.author_array offset: author_array_limit -%}
{%- assign more_authors_show = more_authors_show | append: author.first | append: " " | append: author.last -%}
{%- unless forloop.last -%}
{%- assign more_authors_show = more_authors_show | append: ", " -%}
{%- endunless -%}
{%- endfor -%} {%- endfor -%}
, and
<span
class="more-authors"
title="click to view {{more_authors_hide}}"
onclick="
var element = $(this);
element.attr('title', '');
var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}';
var cursorPosition = 0;
var textAdder = setInterval(function(){
element.text(more_authors_text.substring(0, cursorPosition + 1));
if (++cursorPosition == more_authors_text.length){
clearInterval(textAdder);
}
}, '{{site.more_authors_animation_delay}}');
"
>{{more_authors_hide}}</span>
{%- endif -%} {%- endif -%}
</div> {%- if forloop.length > 1 -%}
{%- if forloop.first == false -%},&nbsp;{%- endif -%}
<!-- Journal/Book title and date --> {%- if forloop.last and author_array_limit == author_array_size -%}and&nbsp;{%- endif -%}
{% assign proceedings = "inproceedings, incollection" | split: ','%} {%- endif -%}
{% if entry.type == "article" -%} {%- if author_is_self -%}
{%- capture entrytype -%}<em>{{entry.journal}}</em>{%- endcapture -%} <em>{{author.first}} {{author.last}}</em>
{%- elsif proceedings contains entry.type -%}
{%- capture entrytype -%}<em>In {{entry.booktitle}}</em> {%- endcapture -%}
{%- else -%} {%- else -%}
{%- capture entrytype -%}{%- endcapture -%} {%- if coauthor_url -%}
<a href="{{coauthor_url}}">{{author.first}} {{author.last}}</a>
{%- else -%}
{{author.first}} {{author.last}}
{%- endif -%}
{%- endif -%} {%- endif -%}
{%- if entry.month -%} {%- endfor -%}
{%- capture entrymonth -%}{{ " " }}{{ entry.month | capitalize }}{%- endcapture -%} {%- assign more_authors = author_array_size | minus: author_array_limit -%}
{%- assign more_authors_hide = more_authors | append: " more author" -%}
{%- if more_authors > 0 -%}
{%- if more_authors > 1 -%}
{%- assign more_authors_hide = more_authors_hide | append: "s" -%}
{%- endif -%} {%- endif -%}
{%- if entry.year -%} {%- assign more_authors_show = '' -%}
{%- capture entryyear -%}{{ " " }}{{entry.year}}{%- endcapture -%} {%- for author in entry.author_array offset: author_array_limit -%}
{%- endif -%} {%- assign more_authors_show = more_authors_show | append: author.first | append: " " | append: author.last -%}
{%- capture periodical -%}{{ entrytype }}{{ entrymonth }}{{ entryyear }}{%- endcapture -%} {%- unless forloop.last -%}
<div class="periodical"> {%- assign more_authors_show = more_authors_show | append: ", " -%}
{{ periodical | strip }} {%- endunless -%}
</div> {%- endfor -%}
{%- endif %} , and
<span
class="more-authors"
title="click to view {{more_authors_hide}}"
onclick="
var element = $(this);
element.attr('title', '');
var more_authors_text = element.text() == '{{more_authors_hide}}' ? '{{more_authors_show}}' : '{{more_authors_hide}}';
var cursorPosition = 0;
var textAdder = setInterval(function(){
element.text(more_authors_text.substring(0, cursorPosition + 1));
if (++cursorPosition == more_authors_text.length){
clearInterval(textAdder);
}
}, '{{site.more_authors_animation_delay}}');
"
>{{more_authors_hide}}</span>
{%- endif -%}
</div>
<!-- Journal/Book title and date -->
{% assign proceedings = "inproceedings,incollection" | split: ','%}
{% assign thesis = "thesis,mastersthesis,phdthesis" | split: ','%}
{% if entry.type == "article" -%}
{%- capture entrytype -%}<em>{{entry.journal}}</em>{%- endcapture -%}
{%- elsif proceedings contains entry.type -%}
{%- capture entrytype -%}<em>In {{entry.booktitle}}</em> {%- endcapture -%}
{%- elsif thesis contains entry.type -%}
{%- capture entrytype -%}<em>{{entry.school}}</em> {%- endcapture -%}
{%- else -%}
{%- capture entrytype -%}{%- endcapture -%}
{%- endif -%}
{%- if entry.month -%}
{%- capture entrymonth -%}{{ " " }}{{ entry.month | capitalize }}{%- endcapture -%}
{%- endif -%}
{%- if entry.year -%}
{%- capture entryyear -%}{{ " " }}{{entry.year}}{%- endcapture -%}
{%- endif -%}
{% assign entrytype_text = entrytype | strip_html | strip %}
{%- capture periodical -%}{{ entrytype }}{%- if entrytype_text != "" and entryyear != "" -%}, {%- endif -%}{{ entrymonth }}{{ entryyear }}{%- endcapture -%}
<div class="periodical">
{{ periodical | strip }}
</div>
<div class="periodical">
{{ entry.note | strip }}
</div>
<!-- Links/Buttons --> <!-- Links/Buttons -->
<div class="links"> <div class="links">
{%- if entry.abstract %} {%- if entry.abstract %}