{% load publication_extras %}

{% if publication.authors_escaped|length > 8 %}
	{% for author, author_escaped in publication.authors_escaped|slice:":8" %}
	<a href="/publications/{{ author_escaped }}/" class="author">{{ author }}</a>,
	{% endfor %} <i>et al.</i><br />
{% else %}
	{% for author, author_escaped in publication.authors_escaped %}
	<a href="/publications/{{ author_escaped }}/" class="author">{{ author }}</a>{% if not forloop.last %}{% if forloop.revcounter == 2 %}{% if not forloop.first %},{% endif %} and {% else %}, {% endif %}{% endif %}
	{% endfor %}<br />
{% endif %}
<b><a href="/publications/{{ publication.pk }}/" class="title">{{ publication.title|tex_parse }}</a></b><br/>
{% if publication.journal %}
	<i>{{ publication.journal }}, {{ publication.year }}</i><br />
{% else %}
	<i>{% if publication.book_title %}{{ publication.book_title }},{% endif %}
	{% if publication.publisher %}{{ publication.publisher }},{% endif %}
	{% if publication.institution %}{{ publication.institution }},{% endif %}
	{{ publication.year }},
	{% if publication.isbn %}ISBN {{ publication.isbn }}{% endif %}</i><br />
{% endif %}
{% if publication.keywords %}
	{% for keyword, keyword_escaped in publication.keywords_escaped %}
		<a class="keyword" href="/publications/tag/{{ keyword_escaped }}/">{{ keyword }}</a>
	{% endfor %}
	<br />
{% endif %}
{% if publication.code %}<a class="link" href="{{ publication.code }}">Code</a>,{% endif %}
{% if publication.url %}<a class="link" rel="external" href="{{ publication.url }}">URL</a>,{% endif %}
{% if publication.doi %}<a class="link" rel="external" href="http://dx.doi.org/{{ publication.doi }}">DOI</a>,{% endif %}
{% if not publication.journal and publication.isbn %}<a class="link" rel="external" href="http://isbndb.com/search/all?query={{ publication.isbn }}">ISBN</a>,{% endif %}
{% if publication.pdf %}<a class="link" href="{{ MEDIA_URL }}{{ publication.pdf }}">PDF</a>,{% endif %}
{% for file in publication.files %}
	<a class="link" href="{{ MEDIA_URL }}{{ file.file }}">{{ file.description }}</a>,
{% endfor %}
{% for link in publication.links %}
	<a class="link" rel="external" href="{{ link.url }}">{{ link.description }}</a>,
{% endfor %}
<a href="/publications/{{ publication.pk }}/?bibtex">BibTex</a>
