Skip to content

Commit a919151

Browse files
committed
20.0 beta
[general] - new templates that support other changes - style tweaks and fixes [index] - rework links and link in title - auto link to content for projects (if present) [projects] - small description changes - remove unused frontmatter - other minor changes [quiz/gti] - make gti code abstract and allow it to run with other json data - new web quiz - quiz landing page - quiz template - rework scripts [404] - new look
1 parent c7e1974 commit a919151

26 files changed

Lines changed: 314 additions & 116 deletions

.eleventy.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ function findFileInDir(dir, filename) {
2121
return null;
2222
}
2323

24+
function getBlocksFromJson(json) {
25+
let blocks = [];
26+
for (const key in json) {
27+
if (json.hasOwnProperty(key)) {
28+
const element = json[key];
29+
if (element['questions']) {
30+
blocks.push(key);
31+
}
32+
}
33+
}
34+
return blocks
35+
}
36+
2437
function findSelfInNavPages(navPages, url) {
2538
for (const page of navPages) {
2639
if (page.key == url) {
@@ -108,22 +121,28 @@ module.exports = function (eleventyConfig) {
108121
return `<span id="top" class="button topbtn">top ↑</span>`;
109122
});
110123

111-
eleventyConfig.addShortcode("questions", function(json) {
112-
let blocks = ['socrative', 'otros'];
124+
eleventyConfig.addShortcode("quizButtons", function(json) {
125+
let blocks = getBlocksFromJson(json);
126+
if (blocks.length == 0 || blocks.length == 1) return '';
127+
113128
let template = `<div id="block-selection"> <h3>preguntas.</h3> <ul>`;
114129
blocks.forEach(b => {
115130
template += `<li><code>${b}</code>: ${json[b]['info']}</li>`;
116131
});
117-
template += '<li><code>examen:</code> selección de preguntas que aparecieron en el examen de 23-24</li>'
118132
template += '<li><code>todas</code>: todas las preguntas</li></ul>';
119133

120134
blocks.forEach((b) => {
121135
template += `<span class="button select-block" id="${b}">${b}</span>`
122136
});
123137

124-
template += '<span class="button select-block" id="exam">examen</span>'
125138
template += '<span class="button select-block" id="all">todas</span>';
126-
template += '</div> <hr> <div id="questions">';
139+
template += '</div>';
140+
return template;
141+
});
142+
143+
eleventyConfig.addShortcode("quizQuestions", function(json) {
144+
let blocks = getBlocksFromJson(json);
145+
let template = '<div id="questions">';
127146

128147
blocks.forEach((block) => {
129148
let questions = json[block]['questions'];

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/404.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
2-
title: mier (404)
3-
layout: navigated.njk
2+
title: 404
3+
layout: generic.njk
44
permalink: /404.html
55
eleventyNavigation:
66
key: 404
77
---
88

9-
# 404
109
couldn't find this page. are you sure it exists?
1110

1211
[back to index](/)

src/content/collections/projects/backup.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: backup
33
desc: collection of repositories of computer engineering subjects at EPI Gijón.
44
source: https://github.com/miermontoto/backup
55
permalink: /backup/
6-
demo: /backup
76
keywords: backup, backup carrera, epi, epi gijón, asignaturas, giitin, informática, ingeniería informática, ingeniería, engineering, computer engineering, gijón
87
icons: [markdown, github]
98
star: star

src/content/collections/projects/epicalendar.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: epiCalendar
33
desc: web (and python) app that downloads your personal University of Oviedo calendar in ICS or CSV format.
44
source: https://github.com/miermontoto/epiCalendar
5-
links: [{icon: 'ⓘ', url: "/epiCalendar", "name": "readme"}]
65
demo: https://epicalendar.mier.info
76
permalink: /epiCalendar/
87
redirect_from: /epicalendar/

src/content/collections/projects/gti.njk

Lines changed: 0 additions & 42 deletions
This file was deleted.
File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: quizzes
3+
emoji: 📝
4+
permalink: /quizzes/
5+
lang: es
6+
desc: quizzes for different software engineering courses.
7+
eleventyNavigation:
8+
key: quizzes
9+
---
10+
11+
{% for quiz in collections.quiz %}
12+
<div id="{{ quiz.data.title }}" class="quiz hoverborder">
13+
<h2><a href="/{{ quiz.fileSlug }}">{{ quiz.fileSlug }}</a></h2>
14+
<p>→ {{ quiz.data.desc | safe }}</p>
15+
</div>
16+
{% endfor %}

src/content/collections/projects/webutils.njk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
title: webutils
3-
desc: 'small collection of web utilities: md5, base64, url encode/decode, etc.'
3+
desc: 'collection of various small utilities (converters, generators...)'
44
icons: [js]
55
permalink: /webutils/
6-
demo: /webutils/
76
emoji: 🖇️
87
eleventyNavigation:
98
key: webutils

0 commit comments

Comments
 (0)