Skip to content

Commit 614e8ec

Browse files
committed
add bibliography handling to website
1 parent cc021fe commit 614e8ec

File tree

5 files changed

+402
-0
lines changed

5 files changed

+402
-0
lines changed

assets/_custom.scss

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,184 @@
6565
// border-left: 0.1rem solid lightgrey;
6666
margin-left: 0.2rem;
6767
padding-left: 0.5rem;
68+
}
69+
70+
71+
// Custom styles for citations
72+
// Citation styles for inline numeric references
73+
.citation {
74+
font-size: 1em;
75+
margin: 0 2px;
76+
}
77+
78+
.citation a {
79+
text-decoration: none;
80+
color: #2c5aa0;
81+
font-weight: bold;
82+
}
83+
84+
.citation a:hover {
85+
text-decoration: underline;
86+
}
87+
// Citation styles for inline numeric references
88+
.citation {
89+
font-size: 1em;
90+
margin: 0 2px;
91+
}
92+
93+
.citation a {
94+
text-decoration: none;
95+
color: #2c5aa0;
96+
font-weight: bold;
97+
}
98+
99+
.citation a:hover {
100+
text-decoration: underline;
101+
}
102+
103+
// Enhanced citation tooltips
104+
// CSS-only Tooltip Styling with text wrapping and simplecite style
105+
.citation {
106+
position: relative;
107+
cursor: pointer;
108+
109+
// Tooltip bubble - hidden by default
110+
&::before {
111+
content: attr(data-tooltip);
112+
position: absolute;
113+
bottom: 100%;
114+
left: 50%;
115+
transform: translateX(-50%) translateY(5px);
116+
background: #333;
117+
color: white;
118+
padding: 1px 6px;
119+
border-radius: 4px;
120+
font-size: 0.6em;
121+
white-space: normal;
122+
width: 300px; /* Fixed width to control wrapping */
123+
max-width: 80vw; /* Responsive max width */
124+
text-align: left;
125+
opacity: 0;
126+
visibility: hidden;
127+
transition: all 0.2s ease;
128+
z-index: 1000;
129+
pointer-events: none;
130+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); /* Subtle shadow like simplecite */
131+
line-height: 1.4; /* Better line spacing for wrapped text */
132+
}
133+
134+
// Tooltip arrow
135+
&::after {
136+
content: '';
137+
position: absolute;
138+
bottom: 100%;
139+
left: 50%;
140+
transform: translateX(-50%) translateY(0);
141+
border: 5px solid transparent;
142+
border-top-color: #333;
143+
opacity: 0;
144+
visibility: hidden;
145+
transition: all 0.2s ease;
146+
z-index: 1000;
147+
pointer-events: none;
148+
}
149+
150+
// Show tooltip on hover
151+
&:hover::before,
152+
&:hover::after {
153+
opacity: 1;
154+
visibility: visible;
155+
transform: translateX(-50%) translateY(-5px);
156+
}
157+
}
158+
159+
// Alternative: More compact simplecite-like styling
160+
.citation.compact-tooltip::before {
161+
width: 250px;
162+
font-size: 0.75em;
163+
padding: 6px 10px;
164+
background: #2c3e50; /* Dark blue-grey like academic tools */
165+
border: 1px solid #34495e;
166+
}
167+
168+
.citation.compact-tooltip::after {
169+
border-top-color: #2c3e50;
170+
}
171+
172+
// Ultra-compact bibliography with hover effects
173+
.bibliography {
174+
border-top: 1px solid #e0e0e0;
175+
margin-top: 1.5rem;
176+
padding-top: 0.75rem;
177+
font-size: 0.8em;
178+
color: #666;
179+
line-height: 1.2;
180+
transition: all 0.3s ease;
181+
}
182+
183+
/* Hover effect for entire bibliography */
184+
.bibliography:hover {
185+
color: #444; /* Darker text on hover */
186+
border-top-color: #2c5aa0; /* Blue line on hover */
187+
}
188+
189+
.bibliography h2 {
190+
font-size: 1.1em;
191+
color: #444;
192+
margin-bottom: 0.5rem;
193+
transition: color 0.3s ease;
194+
}
195+
196+
.bibliography:hover h2 {
197+
color: #2c5aa0; /* Blue heading on hover */
198+
}
199+
200+
.bibliography ol {
201+
padding-left: 1rem;
202+
margin: 0;
203+
}
204+
205+
.bibliography li {
206+
margin-bottom: 0.35rem;
207+
padding-bottom: 0.15rem;
208+
transition: all 0.2s ease;
209+
border-radius: 2px;
210+
padding: 0.15rem 0.25rem;
211+
}
212+
213+
/* Hover effect for individual reference items */
214+
.bibliography li:hover {
215+
background-color: #f8f9fa; /* Light grey background */
216+
color: #333; /* Darker text */
217+
transform: translateX(2px); /* Slight shift to the right */
218+
}
219+
220+
.bibliography li:last-child {
221+
margin-bottom: 0;
222+
}
223+
224+
.bibliography em {
225+
color: #555;
226+
font-style: italic;
227+
}
228+
229+
.bibliography a {
230+
color: #2c5aa0;
231+
text-decoration: none;
232+
transition: color 0.2s ease;
233+
}
234+
235+
.bibliography a:hover {
236+
text-decoration: underline;
237+
color: #1e3d6d; /* Darker blue on hover */
238+
}
239+
240+
/* Individual item link hover */
241+
.bibliography li:hover a {
242+
color: #1e3d6d;
243+
}
244+
245+
.citation-error {
246+
color: #cc0000;
247+
font-style: italic;
68248
}

data/bib.json

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
[
2+
{
3+
"id": "KellyJr.1956",
4+
"author": [
5+
{
6+
"family": "Kelly Jr.",
7+
"given": "J. L."
8+
}
9+
],
10+
"citation-key": "KellyJr.1956",
11+
"container-title": "Bell System Technical Journal",
12+
"DOI": "10.1002/j.1538-7305.1956.tb03809.x",
13+
"ISSN": "1538-7305",
14+
"issue": "4",
15+
"issued": {
16+
"date-parts": [
17+
[
18+
"1956"
19+
]
20+
]
21+
},
22+
"language": "en",
23+
"license": "© 1956 The Bell System Technical Journal",
24+
"page": "917–926",
25+
"source": "Wiley Online Library",
26+
"title": "A New Interpretation of Information Rate",
27+
"type": "article-journal",
28+
"URL": "https://onlinelibrary.wiley.com/doi/abs/10.1002/j.1538-7305.1956.tb03809.x",
29+
"volume": "35"
30+
},
31+
{
32+
"id": "Ferguson2009",
33+
"author": [
34+
{
35+
"family": "Ferguson",
36+
"given": "Thomas"
37+
}
38+
],
39+
"citation-key": "Ferguson2009",
40+
"collection-title": "UCLA",
41+
"container-title": "Game Theory for Statisticians",
42+
"issued": {
43+
"date-parts": [
44+
[
45+
"2009"
46+
]
47+
]
48+
},
49+
"language": "en",
50+
"source": "Zotero",
51+
"title": "The Kelly Betting System for Favorable Games.",
52+
"type": "article-journal",
53+
"URL": "https://www.math.ucla.edu/~tom/stat596.html"
54+
},
55+
{
56+
"id": "Thorp2006",
57+
"author": [
58+
{
59+
"family": "Thorp",
60+
"given": "Edward O."
61+
}
62+
],
63+
"citation-key": "Thorp2006",
64+
"container-title": "Handbook of Asset and Liability Management",
65+
"DOI": "10.1016/S1872-0978(06)01009-X",
66+
"ISBN": "978-0-444-50875-1",
67+
"issued": {
68+
"date-parts": [
69+
[
70+
"2006"
71+
]
72+
]
73+
},
74+
"language": "en",
75+
"page": "385–428",
76+
"publisher": "Elsevier",
77+
"source": "DOI.org (Crossref)",
78+
"title": "Chapter 9 The Kelly Criterion in Blackjack Sports Betting, and the Stock Market",
79+
"type": "chapter",
80+
"URL": "https://linkinghub.elsevier.com/retrieve/pii/S187209780601009X",
81+
"volume": "1"
82+
},
83+
{
84+
"id": "VonNeumann2007",
85+
"author": [
86+
{
87+
"family": "Von Neumann",
88+
"given": "John"
89+
},
90+
{
91+
"family": "Morgenstern",
92+
"given": "Oskar"
93+
}
94+
],
95+
"citation-key": "VonNeumann2007",
96+
"collection-title": "A Princeton classic edition",
97+
"edition": "60. anniversary ed., 4. print., and 1. paperb. print",
98+
"event-place": "Princeton, NJ",
99+
"ISBN": "978-0-691-13061-3 978-1-4008-2946-0",
100+
"issued": {
101+
"date-parts": [
102+
[
103+
"2007"
104+
]
105+
]
106+
},
107+
"language": "eng",
108+
"number-of-pages": "739",
109+
"publisher": "Princeton University Press",
110+
"publisher-place": "Princeton, NJ",
111+
"source": "K10plus ISBN",
112+
"title": "Theory of games and economic behavior",
113+
"type": "book"
114+
},
115+
{
116+
"id": "MacLean2010",
117+
"author": [
118+
{
119+
"family": "MacLean",
120+
"given": "Leonard C"
121+
},
122+
{
123+
"family": "Chair",
124+
"given": "Herbert Lamb"
125+
},
126+
{
127+
"family": "Thorp",
128+
"given": "Edward O"
129+
},
130+
{
131+
"family": "Beach",
132+
"given": "Newport"
133+
},
134+
{
135+
"family": "Ziemba",
136+
"given": "William T"
137+
}
138+
],
139+
"issued": {
140+
"date-parts": [
141+
[
142+
"2010"
143+
]
144+
]
145+
},
146+
"citation-key": "MacLean2010",
147+
"language": "en",
148+
"source": "Zotero",
149+
"title": "Good and bad properties of the Kelly criterion",
150+
"type": "article-journal"
151+
}
152+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{ $bibEntries := .Site.Data.bib }}
2+
{{ $page := .Page }}
3+
{{ $citationList := $page.Store.Get "citationList" | default dict }}
4+
5+
{{ if and $bibEntries $citationList }}
6+
<section class="bibliography">
7+
<h2>References</h2>
8+
<ol>
9+
{{ range $bibentryId, $number := $citationList }}
10+
{{ $entry := where $bibEntries "id" "eq" $bibentryId | first 1 }}
11+
{{ if $entry }}
12+
{{ $entry = index $entry 0 }}
13+
<li id="ref-{{ $number }}">
14+
{{ $authorCount := len $entry.author }}
15+
{{ range $index, $author := $entry.author }}
16+
{{ if $index }}
17+
{{ if eq (add $index 1) $authorCount }} and {{ else }}, {{ end }}
18+
{{ end }}
19+
{{ $author.given }} {{ $author.family }}
20+
{{ end }}
21+
({{ index $entry.issued "date-parts" 0 0 }}).
22+
{{ if $entry.title }} <em>{{ $entry.title }}</em>.{{ end }}
23+
{{ if $entry.volume }} {{ $entry.volume }}{{ end }}
24+
{{ if $entry.issue }}({{ $entry.issue }}){{ end }}
25+
{{ if $entry.page }}: {{ $entry.page }}.{{ end }}
26+
{{ if $entry.DOI }} <a href="https://doi.org/{{ $entry.DOI }}">doi:{{ $entry.DOI }}</a>{{ end }}
27+
</li>
28+
{{ end }}
29+
{{ end }}
30+
</ol>
31+
</section>
32+
{{ else if $bibEntries }}
33+
<p>No citations found in this document.</p>
34+
{{ else }}
35+
<p>References not available.</p>
36+
{{ end }}

0 commit comments

Comments
 (0)