Skip to content

Commit

Permalink
add images
Browse files Browse the repository at this point in the history
  • Loading branch information
julsraemy committed Jan 10, 2025
1 parent 1deaab8 commit 3baf162
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 22 deletions.
50 changes: 29 additions & 21 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,40 @@ module.exports = function(eleventyConfig) {
});

eleventyConfig.addTransform("handleCitations", function(content, outputPath) {
if (outputPath?.endsWith(".html")) {
const dom = new JSDOM(content);
const bibliography = dom.window.document.querySelector("#bibliography");
if (!outputPath?.endsWith(".html")) return content;

const dom = new JSDOM(content);
const document = dom.window.document;
const bibliography = document.querySelector("#bibliography");

if (bibliography) {
const citationsArray = Array.from(bibliography.children);
const uniqueCitations = new Map();

if (bibliography) {
// Get all citations and convert to array immediately
const citationsArray = Array.from(bibliography.children);

// Create map with citation text as key for deduplication
const uniqueCitations = new Map();
citationsArray.forEach(citation => {
const citationText = citation.textContent.trim();
// Create bibliography entries with IDs
citationsArray.forEach((citation, index) => {
const citationText = citation.textContent.trim();
if (citationText && !citationText.startsWith('Bibliography')) {
const authorYear = citationText.match(/^([^,]+),\s*([^(.]+)/);
if (authorYear) {
const [_, author, year] = authorYear;
const cleanId = `${author.replace(/[^a-zA-Z]/g, '')}${year.trim()}`;
citation.id = cleanId;
}
if (!uniqueCitations.has(citationText)) {
uniqueCitations.set(citationText, citation.cloneNode(true));
}
});

// Sort and rebuild bibliography
bibliography.innerHTML = '';
Array.from(uniqueCitations.values())
.sort((a, b) => a.textContent.trim().localeCompare(b.textContent.trim()))
.forEach(citation => bibliography.appendChild(citation));
}
return dom.serialize();
}
});

// Sort and rebuild bibliography
bibliography.innerHTML = '<h2 id="bib-Bibliography">Bibliography</h2>';
Array.from(uniqueCitations.values())
.sort((a, b) => a.textContent.trim().localeCompare(b.textContent.trim()))
.forEach(citation => bibliography.appendChild(citation));
}
return content;

return dom.serialize();
});

eleventyConfig.addTransform("makeUrlsClickable", function(content, outputPath) {
Expand Down
Binary file added _site/data/Figures/SGV_10A_00031_027.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _site/data/Figures/SGV_12N_00716.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion _site/thesis.html

Large diffs are not rendered by default.

Binary file added src/data/Figures/SGV_10A_00031_027.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/Figures/SGV_12N_00716.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3baf162

Please sign in to comment.