diff --git a/_includes/program.njk b/_includes/program.njk new file mode 100644 index 0000000..eafbad0 --- /dev/null +++ b/_includes/program.njk @@ -0,0 +1,71 @@ +---js +{ + layout: "page.njk", + getLocalized: function(item) { + if (typeof item === "string") return item; + return item[this.ctx.lang]; + }, + toDate: function(dateStr) { + return new Date(dateStr); + } +} +--- +{{ content | safe }} + +{% for date, events in program %} +
+

+ {{ toDate(date).toLocaleDateString(lang, { weekday: 'long', month: 'short', day: 'numeric' }) }} +

+ +{% endfor %} + +{% css %} +.timeslot { + display: block; +} +{% endcss %} diff --git a/content/_data/program.yaml b/content/_data/program.yaml new file mode 100644 index 0000000..d19a912 --- /dev/null +++ b/content/_data/program.yaml @@ -0,0 +1,51 @@ +"2024-10-07": # NOTE: quoting dates is important + - start: "09:00" + end: "10:30" + title: + de: "Begrüßung" + en: "Grand Opening" + description: + de: "blabla" + en: "bibibababubu" + location: "HSZ/004" + # annotation: null + checkin_link: "https://kurse.ifsr.de/..." + livestream: true + - start: "10:30" + end: "14:00" + title: + de: "Tutorien und Mittagessen" + en: "Tutorial and lunch" + description: + de: "hocus" + en: "pocus" + location: "Start: HSZ" + annotation: + de: "Der Stream verzögert sich um 20 Minuten" + en: "The Livesream will be delayed by 20 minutes." + # checkin_link: null + # livestream: false # NOTE: can be omitted +"2024-10-08": + - start: "10:30" + end: "16:00" + title: "Nerd101" # NOTE: same value for all langs + description: + de: "coole vorträge" + en: "cool talks" + location: "Andreas-Pfitzmann-Bau (APB)" + # annotation: null + checkin_link: "/campus/" # NOTE: local url (needs to exist) + livestream: true + - start: "19:00" + end: null # NOTE: open end + title: + de: "Clubwanderung" + en: "Club tour" + description: + de: "lorem" + en: "ipsum" + location: "Start: APB" + annotation: + de: "Bargeld mitbringen!!!!11!1" + en: "Bring cash!!!!11!1" + checkin_link: "https://kurse.ifsr.de/..." diff --git a/content/de/program.md b/content/de/program.md index d5c20de..5290416 100644 --- a/content/de/program.md +++ b/content/de/program.md @@ -1,5 +1,5 @@ --- -layout: page.njk +layout: program.njk title: Programm tags: mainNav eleventyNavigation: diff --git a/content/en/program.md b/content/en/program.md index ee5a8ab..1847849 100644 --- a/content/en/program.md +++ b/content/en/program.md @@ -1,5 +1,5 @@ --- -layout: page.njk +layout: program.njk title: Program tags: mainNav eleventyNavigation: diff --git a/eleventy.config.js b/eleventy.config.js index 1cc875e..be6f043 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -2,6 +2,7 @@ const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy") const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); const bundlerPlugin = require("@11ty/eleventy-plugin-bundle"); const pluginIcons = require('eleventy-plugin-icons'); +const yaml = require("js-yaml"); const fs = require('fs'); // update this :) @@ -24,6 +25,8 @@ module.exports = function(eleventyConfig) { ], }); + eleventyConfig.addDataExtension("yaml, yml", yaml.load); + eleventyConfig.addGlobalData("year", year); eleventyConfig.addGlobalData("eseColor", eseColor); @@ -53,7 +56,6 @@ module.exports = function(eleventyConfig) { dir: { input: "content", includes: "../_includes", - data: "../_data", }, pathPrefix: `/${year}/`, } diff --git a/package-lock.json b/package-lock.json index 513b17d..f6885d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,8 @@ "@11ty/eleventy-navigation": "^0.3.5", "@11ty/eleventy-plugin-bundle": "^1.0.5", "@fortawesome/fontawesome-free": "^6.6.0", - "eleventy-plugin-icons": "^4.5.1" + "eleventy-plugin-icons": "^4.5.1", + "js-yaml": "^4.1.0" } }, "node_modules/@11ty/dependency-tree": { @@ -387,14 +388,11 @@ } }, "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } + "license": "Python-2.0" }, "node_modules/array-differ": { "version": "3.0.0", @@ -1226,6 +1224,30 @@ "node": ">=6.0" } }, + "node_modules/gray-matter/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/gray-matter/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/hamljs": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/hamljs/-/hamljs-0.6.2.tgz", @@ -1576,14 +1598,13 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "license": "MIT", "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" @@ -1723,13 +1744,6 @@ "markdown-it": "bin/markdown-it.js" } }, - "node_modules/markdown-it/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, "node_modules/maximatch": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz", diff --git a/package.json b/package.json index e01909b..2f192e1 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@11ty/eleventy-navigation": "^0.3.5", "@11ty/eleventy-plugin-bundle": "^1.0.5", "@fortawesome/fontawesome-free": "^6.6.0", - "eleventy-plugin-icons": "^4.5.1" + "eleventy-plugin-icons": "^4.5.1", + "js-yaml": "^4.1.0" } }