Skip to content

Commit eed4576

Browse files
Add custom footer, improve citations, fix responsiveness, update theme a bit
1 parent cf49551 commit eed4576

File tree

12 files changed

+511
-253
lines changed

12 files changed

+511
-253
lines changed

_includes/brands.qmd

Lines changed: 0 additions & 73 deletions
This file was deleted.

_includes/citation/cite.qmd

Lines changed: 106 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
<h3 id="cite" class="pb-1 text-center">Turing.jl is an <a href="https://github.com/TuringLang/Turing.jl/blob/main/LICENCE" class="turing-license-link"><code>MIT</code></a> Licensed Open Source Project</h3>
44
<p class="text-center">If you use Turing.jl in your research, please consider citing our papers.</p>
55
6-
<ul class="citation-list">
7-
<li class="citation-entry box">
8-
<p class="citation-text">
9-
Fjelde, T. E., Xu, K., Widmann, D., Tarek, M., Pfiffer, C., Trapp, M., Axen, S. D., Sun, X., Hauru, M., Yong, P., Tebbutt, W., Ghahramani, Z., & Ge, H. (2025). <span class="citation-title">Turing.jl: a general-purpose probabilistic programming language.</span> <em>ACM Transactions on Probabilistic Machine Learning</em>. Just Accepted.
10-
</p>
11-
<div class="citation-actions">
12-
<a href="https://doi.org/10.1145/3711897" target="_blank" rel="noopener noreferrer" class="button">View Paper</a>
13-
<button class="button button--primary" onclick="copyBibtex(this)" aria-label="Copy BibTeX for the 2025 Turing.jl paper">Copy BibTeX</button>
14-
</div>
15-
<pre class="citation-bibtex-data">
16-
@article{Fjelde2025Turing,
6+
<ul id="citation-list" class="citation-list">
7+
<!-- Citations will be dynamically injected here -->
8+
</ul>
9+
</div>
10+
11+
<script>
12+
// DATA: Add new BibTeX entries here
13+
const bibtexData = [
14+
`@article{Fjelde2025Turing,
1715
author = {Fjelde, Tor Erlend and Xu, Kai and Widmann, David and Tarek, Mohamed and Pfiffer, Cameron and Trapp, Martin and Axen, Seth D. and Sun, Xianda and Hauru, Markus and Yong, Penelope and Tebbutt, Will and Ghahramani, Zoubin and Ge, Hong},
1816
title = {Turing.jl: a general-purpose probabilistic programming language},
1917
journal = {ACM Transactions on Probabilistic Machine Learning},
@@ -22,19 +20,8 @@
2220
doi = {10.1145/3711897},
2321
note = {Just Accepted},
2422
url = {https://doi.org/10.1145/3711897}
25-
}
26-
</pre>
27-
</li>
28-
<li class="citation-entry box">
29-
<p class="citation-text">
30-
Ge, H., Xu, K., & Ghahramani, Z. (2018). <span class="citation-title">Turing: a language for flexible probabilistic inference.</span> In <em>Proceedings of the 21st International Conference on Artificial Intelligence and Statistics (AISTATS)</em> (Vol. 84, pp. 1682-1690). PMLR.
31-
</p>
32-
<div class="citation-actions">
33-
<a href="http://proceedings.mlr.press/v84/ge18b.html" target="_blank" rel="noopener noreferrer" class="button">View Paper</a>
34-
<button class="button button--primary" onclick="copyBibtex(this)" aria-label="Copy BibTeX for the 2018 Turing paper">Copy BibTeX</button>
35-
</div>
36-
<pre class="citation-bibtex-data">
37-
@inproceedings{Ge2018Turing,
23+
}`,
24+
`@inproceedings{Ge2018Turing,
3825
author = {Ge, Hong and Xu, Kai and Ghahramani, Zoubin},
3926
title = {Turing: a language for flexible probabilistic inference},
4027
booktitle = {Proceedings of the 21st International Conference on Artificial Intelligence and Statistics (AISTATS)},
@@ -44,37 +31,94 @@
4431
year = {2018},
4532
publisher = {PMLR},
4633
url = {http://proceedings.mlr.press/v84/ge18b.html}
34+
}`
35+
];
36+
37+
/**
38+
* A BibTeX parser.
39+
* Extracts key-value pairs from a BibTeX string.
40+
* @param {string} bibtex - The raw BibTeX string.
41+
* @returns {object} - An object with parsed data.
42+
*/
43+
function parseBibtex(bibtex) {
44+
const data = { raw: bibtex };
45+
const regex = /(\w+)\s*=\s*[\{"']([^"'}]+)[\}"']/g;
46+
let match;
47+
while ((match = regex.exec(bibtex)) !== null) {
48+
data[match[1].toLowerCase()] = match[2];
49+
}
50+
return data;
4751
}
48-
</pre>
52+
53+
/**
54+
* Creates an HTML string for a single citation entry.
55+
* @param {object} bibData - The parsed BibTeX data.
56+
* @returns {string} - The HTML string for the list item.
57+
*/
58+
function generateCitationHTML(bibData) {
59+
const { author, title, journal, booktitle, year, note, url, doi, raw } = bibData;
60+
61+
let publicationInfo = '';
62+
if (journal) {
63+
publicationInfo += `<em>${journal}</em>.`;
64+
} else if (booktitle) {
65+
publicationInfo += `In <em>${booktitle}</em>.`;
66+
}
67+
if (note) {
68+
publicationInfo += ` ${note}.`;
69+
}
70+
71+
const viewUrl = url || (doi ? `https://doi.org/${doi}` : '#');
72+
73+
// The author string is now used directly from the bibtex data without formatting.
74+
const authorsFormatted = author || 'N/A';
75+
76+
return `
77+
<li class="citation-entry box">
78+
<div class="citation-content">
79+
<p class="citation-text">
80+
${authorsFormatted} (${year}). <span class="citation-title">${title}.</span> ${publicationInfo}
81+
</p>
82+
</div>
83+
<div class="citation-actions">
84+
<a href="${viewUrl}" target="_blank" rel="noopener noreferrer" class="citation-icon-btn" aria-label="View Paper: ${title}">
85+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>
86+
</a>
87+
<button class="citation-icon-btn copy-bibtex-btn" aria-label="Copy BibTeX for ${title}">
88+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/></svg>
89+
</button>
90+
</div>
91+
<pre class="citation-bibtex-data" style="display:none;">${raw}</pre>
4992
</li>
50-
</ul>
51-
</div>
93+
`;
94+
}
5295
53-
<script>
5496
function copyBibtex(buttonElement) {
55-
// Find the <pre> element which is the next sibling of the button's parent container
56-
const bibtexPreElement = buttonElement.parentElement.nextElementSibling;
97+
const citationEntry = buttonElement.closest('.citation-entry');
98+
if (!citationEntry) return;
99+
100+
const bibtexPreElement = citationEntry.querySelector('.citation-bibtex-data');
101+
if (!bibtexPreElement) return;
102+
57103
const bibtexText = bibtexPreElement.textContent.trim();
58104
59-
// Robust Clipboard Copy Logic
60105
if (navigator.clipboard && window.isSecureContext) {
61-
// Modern async clipboard API
62106
navigator.clipboard.writeText(bibtexText)
63107
.then(() => showSuccess(buttonElement))
64108
.catch(err => {
65109
console.error('Async copy failed, falling back:', err);
66110
fallbackCopy(bibtexText, buttonElement);
67111
});
68112
} else {
69-
// Fallback for older browsers or non-secure contexts
70113
fallbackCopy(bibtexText, buttonElement);
71114
}
72115
}
73116
74117
function fallbackCopy(text, buttonElement) {
75118
const textArea = document.createElement('textarea');
76119
textArea.value = text;
77-
textArea.style.position = 'absolute';
120+
textArea.style.position = 'fixed';
121+
textArea.style.top = '-9999px';
78122
textArea.style.left = '-9999px';
79123
document.body.appendChild(textArea);
80124
textArea.focus();
@@ -94,27 +138,42 @@ function fallbackCopy(text, buttonElement) {
94138
}
95139
96140
function showSuccess(buttonElement) {
97-
const originalText = buttonElement.innerHTML;
98-
buttonElement.innerHTML = '✅ Copied!';
99-
// Use your existing class for styling the copied state
100-
buttonElement.classList.add('citation-copied');
101-
buttonElement.disabled = true;
141+
const originalIcon = buttonElement.innerHTML;
142+
buttonElement.innerHTML = '✓';
143+
buttonElement.classList.add('citation-copied');
144+
buttonElement.disabled = true;
102145
103-
setTimeout(() => {
104-
buttonElement.innerHTML = originalText;
105-
buttonElement.classList.remove('citation-copied');
106-
buttonElement.disabled = false;
107-
}, 2000);
146+
setTimeout(() => {
147+
buttonElement.innerHTML = originalIcon;
148+
buttonElement.classList.remove('citation-copied');
149+
buttonElement.disabled = false;
150+
}, 2000);
108151
}
109152
110153
function showError(buttonElement) {
111-
const originalText = buttonElement.innerHTML;
112-
buttonElement.innerHTML = 'Error!';
154+
const originalIcon = buttonElement.innerHTML;
155+
buttonElement.innerHTML = 'X';
113156
buttonElement.disabled = true;
114157
setTimeout(() => {
115-
buttonElement.innerHTML = originalText;
158+
buttonElement.innerHTML = originalIcon;
116159
buttonElement.disabled = false;
117160
}, 2000);
118161
}
162+
163+
document.addEventListener('DOMContentLoaded', () => {
164+
const container = document.getElementById('citation-list');
165+
if (!container) return;
166+
167+
// Generate and inject HTML
168+
const allCitationsHTML = bibtexData.map(bib => generateCitationHTML(parseBibtex(bib))).join('');
169+
container.innerHTML = allCitationsHTML;
170+
171+
container.addEventListener('click', function(event) {
172+
const button = event.target.closest('.copy-bibtex-btn');
173+
if (button) {
174+
copyBibtex(button);
175+
}
176+
});
177+
});
119178
</script>
120179
```

_includes/featured-tutorials.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
- "Basics"
66
- "Getting Started"
77

8-
- title: "Introductory Concepts: Coin Flipping"
8+
- title: "Introductory Concepts"
99
href: "https://turinglang.org/docs/tutorials/coin-flipping/"
1010
description: "Learn the basic concepts of Bayesian modeling by working through a simple coin-flipping example."
1111
category:
1212
- "Basics"
1313
- "Modeling"
1414

15-
- title: "Bayesian Regression"
16-
href: "https://turinglang.org/docs/tutorials/02-bayesian-regression/"
17-
description: "Explore how to perform Bayesian linear and logistic regression using Turing.jl."
15+
- title: "Core Functionality"
16+
href: "https://turinglang.org/docs/core-functionality/"
17+
description: "This article provides an overview of the core functionality in Turing.jl, which are likely to be used across a wide range of models."
1818
category:
19-
- "Modeling"
20-
- "Regression"
19+
- "Basics"
20+
- "Features"

_quarto.yml

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,10 @@ website:
3535
- icon: github
3636
text: Turing GitHub
3737
href: https://github.com/TuringLang
38-
39-
page-footer:
40-
#background: "#073c44"
41-
left: |
42-
Turing is created by <a href="http://mlg.eng.cam.ac.uk/hong/" target="_blank">Hong Ge</a>, and maintained by the <a href="/team" target="_blank">core team of developers</a>. <br>
43-
© 2025 under the terms of the <a href="https://github.com/TuringLang/Turing.jl/blob/master/LICENCE" target="_blank">MIT License</a>.
4438

4539
back-to-top-navigation: true
4640
repo-url: https://github.com/TuringLang/turinglang.github.io/
47-
repo-actions: [edit, issue]
41+
# repo-actions: [edit, issue]
4842
repo-link-target: _blank
4943
page-navigation: true
5044

@@ -70,6 +64,52 @@ format:
7064
"url" : "https://turinglang.org/",
7165
}
7266
</script>
67+
include-after-body:
68+
- text: |
69+
<footer class="custom-footer">
70+
<div class="footer-container">
71+
<div class="footer-grid">
72+
<div class="footer-links-wrapper">
73+
<div class="footer-column footer-explore">
74+
<h5>Explore</h5>
75+
<a href="https://turinglang.org/docs/getting-started/">Get Started</a>
76+
<a href="https://turinglang.org/docs/tutorials/">Tutorials</a>
77+
<a href="/library">Libraries</a>
78+
<a href="/news">News</a>
79+
<a href="/team">Team</a>
80+
</div>
81+
82+
<div class="footer-column footer-connect">
83+
<h5>Connect</h5>
84+
<a href="https://github.com/TuringLang" target="_blank" rel="noopener"><i class="bi bi-github"></i> GitHub</a>
85+
<a href="https://x.com/TuringLang" target="_blank" rel="noopener"><i class="bi bi-twitter"></i> Twitter</a>
86+
<a href="https://julialang.slack.com/archives/CCYDC34A0" target="_blank" rel="noopener"><i class="bi bi-slack"></i> Slack</a>
87+
<a href="https://discourse.julialang.org/c/domain/probprog/48" target="_blank" rel="noopener"><i class="bi bi-chat-dots"></i> Discourse</a>
88+
</div>
89+
</div>
90+
91+
<div class="footer-column footer-brands">
92+
<h5>Supported by world-class institutions</h5>
93+
<p>Turing.jl is currently being developed at leading research organisations.</p>
94+
<div class="logo-grid">
95+
<a href="https://mlg.eng.cam.ac.uk/" class="partner-logo" target="_blank" rel="noopener">
96+
<img src="https://www.cam.ac.uk/sites/default/files/university-cambridge-logo-black-example-640x132.png" alt="University of Cambridge Logo" class="brands-light-mode-logo">
97+
<img src="https://www.cam.ac.uk/sites/default/files/university-cambridge-logo-white-example-640x133.png" alt="University of Cambridge Logo Dark" class="brands-dark-mode-logo">
98+
</a>
99+
<a href="https://www.turing.ac.uk/" class="partner-logo" target="_blank" rel="noopener">
100+
<img src="/assets/images/brands/Turing_Logo_1000x400px_Black.webp" alt="The Alan Turing Institute Logo" class="brands-light-mode-logo">
101+
<img src="/assets/images/brands/Turing_Logo_1000x400px_White.webp" alt="The Alan Turing Institute Logo Dark" class="brands-dark-mode-logo">
102+
</a>
103+
</div>
104+
</div>
105+
106+
</div>
107+
<div class="footer-bottom">
108+
<p>Turing is created by <a href="https://mlg.eng.cam.ac.uk/hong/" target="_blank" rel="noopener">Hong Ge</a>, and maintained by the core <a href="/team" target="_blank" rel="noopener">team</a> of developers and <a href="https://github.com/TuringLang/Turing.jl/graphs/contributors" target="_blank" rel="noopener">contributors</a>!<br>© 2025 The Turing Project Contributors. <a href="https://github.com/TuringLang/Turing.jl/blob/master/LICENCE" target="_blank" rel="noopener">MIT License</a>.</p>
109+
<a href="https://github.com/TuringLang/turinglang.github.io/" target="_blank" rel="noopener" class="footer-source-link"><i class="bi bi-github"></i> Website Source</a>
110+
</div>
111+
</div>
112+
</footer>
73113
74114
# Global Variables to use in any qmd files using:
75115
# {{< meta site-url >}}

0 commit comments

Comments
 (0)