Spaces:
Running
Running
File size: 2,450 Bytes
8ad38af |
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 |
const projects = [
"policy",
"environment",
"evaluation",
"legal",
"data",
];
const topics = [
"understanding",
"developing",
"deciding",
"shaping",
"environment",
"systems",
"individuals",
"discussing",
];
const team = [
"yacine",
"sasha",
"irene",
"giada",
"avijit",
"lucie",
]
function fetchAndParseYAML(filePath, callback) {
fetch(filePath)
.then(response => response.text())
.then(yamlText => {
const yamlData = jsyaml.load(yamlText);
callback(yamlData); // Pass the parsed YAML data to your callback
})
.catch(error => console.error('Error fetching or parsing YAML:', error));
}
function renderDocument(documentObject) {
let projectName = documentObject["document-id"];
for (nli of navbarListItems) {
if (nli.id === `navbar-top-${projectName}`) {
nli.style.backgroundColor = "#b8c8c0";
} else {
nli.style.backgroundColor = "#cbf5e1";
}
}
documentText.innerHTML = "";
documentSidebar.innerHTML = "";
documentText.appendChild(Object.assign(document.createElement('h3'), {innerHTML: documentObject["title-long"]}));
documentText.appendChild(Object.assign(document.createElement('section'), {innerHTML: documentObject["introduction"]}));
for (section of documentObject.sections) {
documentSidebar.appendChild(Object.assign(document.createElement('li'), {innerHTML: section["section-title"]}));
documentText.appendChild(Object.assign(document.createElement('h4'), {innerHTML: section["section-title"]}));
documentText.appendChild(Object.assign(document.createElement('section'), {innerHTML: section["section-text"]}));
}
documentSidebar.appendChild(Object.assign(document.createElement('li'), {innerHTML: "Resources"}));
documentText.appendChild(Object.assign(document.createElement('h3'), {innerHTML: "Resources"}));
const resourceList = document.createElement('ul');
for (resource of documentObject.resources){
resourceList.appendChild(
Object.assign(
document.createElement('li'),
{innerHTML: `<a href="${resource['resource-url']}">${resource['resource-name']}</a>`}
)
);
}
documentText.appendChild(resourceList);
documentCredit.innerHTML = `<p style="margin: 0px">${documentObject.contributions}</p>`
} |