-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcitation.html
More file actions
131 lines (122 loc) · 3.97 KB
/
Copy pathcitation.html
File metadata and controls
131 lines (122 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{% if include.lookup %}
{% assign citation = site.data.citations
| where_exp: "citation",
"citation.id == include.lookup or citation.title contains include.lookup"
| first
%}
{% else %}
{% assign citation = include %}
{% endif %}
{% assign citation_pdf = citation.pdf | default: nil %}
{% if citation_pdf == nil and citation.buttons.size > 0 %}
{% for button in citation.buttons %}
{% assign button_link = button.link | default: "" | downcase %}
{% assign button_text = button.text | default: "" | downcase %}
{% assign button_icon = button.icon | default: "" | downcase %}
{% assign is_pdf_link = button_link contains ".pdf" %}
{% assign is_pdf_text = button_text contains "pdf" %}
{% assign is_pdf_icon = button_icon contains "pdf" %}
{% if is_pdf_link or is_pdf_text or is_pdf_icon %}
{% assign citation_pdf = button.link %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
<div class="citation-container">
<div class="citation">
{% if include.style == "rich" %}
<a
{% if citation_pdf %}
href="{{ citation_pdf | relative_url | uri_escape }}"
{% elsif citation.link %}
href="{{ citation.link | relative_url | uri_escape }}"
{% endif %}
class="citation-image"
aria-label="{{ citation.title | default: "citation link" | regex_strip }}"
>
{% if citation_pdf %}
{% include pdf-preview.html pdf=citation_pdf image=citation.image title=citation.title %}
{% else %}
<img
src="{{ citation.image | relative_url | uri_escape }}"
alt="{{ citation.title | default: "citation image" | regex_strip }}"
loading="lazy"
{% include fallback.html %}
>
{% endif %}
</a>
{% endif %}
<div class="citation-text">
{% assign type = site.data.types[citation.type] %}
{% include icon.html icon=type.icon %}
<a
{% if citation.link %}
href="{{ citation.link | relative_url | xml_escape }}"
{% endif %}
class="citation-title"
>
{{ citation.title | default: "[no title info]" }}
</a>
<div
class="citation-authors"
{% if citation.authors.size > 10 %}
data-tooltip="{{ citation.authors | join: ", " | xml_escape }}"
{% endif %}
tabindex="0"
>
{{
citation.authors
| join: ","
| split: ","
| array_carve: 5
| join: ", "
| markdownify
| remove: "<p>" | remove: "</p>"
| default: "[no author info]"
}}
</div>
<div class="citation-details">
<span class="citation-publisher">
{{- citation.publisher | default: "[no publisher info]" -}}
</span>
·
<span class="citation-date">
{{- citation.date | default: "[no date info]" | date: "%d %b %Y" -}}
</span>
·
<span class="citation-id">
{{- citation.id | default: "[no id info]" -}}
</span>
</div>
{% if include.style == "rich" %}
{% if citation.description %}
<div class="citation-description">
{{
citation.description
| markdownify
| remove: "<p>"
| remove: "</p>"
}}
</div>
{% endif %}
{% if citation.buttons.size > 0 %}
<div class="citation-buttons">
{% for button in citation.buttons %}
{%
include button.html
type=button.type
icon=button.icon
text=button.text
link=button.link
style="bare"
%}
{% endfor %}
</div>
{% endif %}
{% if citation.tags.size > 0 or citation.repo %}
{% include tags.html tags=citation.tags repo=citation.repo %}
{% endif %}
{% endif %}
</div>
</div>
</div>