Skip to content

Commit ff177a3

Browse files
authored
Merge pull request #17 from tobalsan/update-template-to-v1.61.3-6c5f64ab-0312-45e0-a39e-025d276bfdfa
Update template to version 1.61.3
2 parents 19f7585 + bce7931 commit ff177a3

File tree

2 files changed

+48
-68
lines changed

2 files changed

+48
-68
lines changed

.eleventy.js

+47-65
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ function transformImage(src, cls, alt, sizes, widths = ["500", "700", "auto"]) {
3030
}
3131

3232
function getAnchorLink(filePath, linkTitle) {
33-
const { attributes, innerHTML } = getAnchorAttributes(filePath, linkTitle);
34-
return `<a ${Object.keys(attributes)
35-
.map((key) => `${key}="${attributes[key]}"`)
36-
.join(" ")}>${innerHTML}</a>`;
33+
const {attributes, innerHTML} = getAnchorAttributes(filePath, linkTitle);
34+
return `<a ${Object.keys(attributes).map(key => `${key}="${attributes[key]}"`).join(" ")}>${innerHTML}</a>`;
3735
}
3836

3937
function getAnchorAttributes(filePath, linkTitle) {
@@ -75,22 +73,22 @@ function getAnchorAttributes(filePath, linkTitle) {
7573
if (deadLink) {
7674
return {
7775
attributes: {
78-
class: "internal-link is-unresolved",
79-
href: "/404",
80-
target: "",
76+
"class": "internal-link is-unresolved",
77+
"href": "/404",
78+
"target": "",
8179
},
8280
innerHTML: title,
83-
};
81+
}
8482
}
8583
return {
8684
attributes: {
87-
class: "internal-link",
88-
target: "",
85+
"class": "internal-link",
86+
"target": "",
8987
"data-note-icon": noteIcon,
90-
href: `${permalink}${headerLinkPath}`,
88+
"href": `${permalink}${headerLinkPath}`,
9189
},
9290
innerHTML: title,
93-
};
91+
}
9492
}
9593

9694
const tagRegex = /(^|\s|\>)(#[^\s!@#$%^&*()=+\.,\[{\]};:'"?><]+)(?!([^<]*>))/g;
@@ -155,28 +153,28 @@ module.exports = function (eleventyConfig) {
155153
}
156154
if (token.info.startsWith("ad-")) {
157155
const code = token.content.trim();
158-
const parts = code.split("\n");
156+
const parts = code.split("\n")
159157
let titleLine;
160158
let collapse;
161-
let collapsible = false;
162-
let collapsed = true;
159+
let collapsible = false
160+
let collapsed = true
163161
let icon;
164162
let color;
165-
let nbLinesToSkip = 0;
163+
let nbLinesToSkip = 0
166164
for (let i = 0; i < 4; i++) {
167165
if (parts[i] && parts[i].trim()) {
168-
let line = parts[i] && parts[i].trim().toLowerCase();
166+
let line = parts[i] && parts[i].trim().toLowerCase()
169167
if (line.startsWith("title:")) {
170168
titleLine = line.substring(6);
171169
nbLinesToSkip++;
172170
} else if (line.startsWith("icon:")) {
173171
icon = line.substring(5);
174172
nbLinesToSkip++;
175173
} else if (line.startsWith("collapse:")) {
176-
collapsible = true;
174+
collapsible = true
177175
collapse = line.substring(9);
178-
if (collapse && collapse.trim().toLowerCase() == "open") {
179-
collapsed = false;
176+
if (collapse && collapse.trim().toLowerCase() == 'open') {
177+
collapsed = false
180178
}
181179
nbLinesToSkip++;
182180
} else if (line.startsWith("color:")) {
@@ -185,28 +183,24 @@ module.exports = function (eleventyConfig) {
185183
}
186184
}
187185
}
188-
const foldDiv = collapsible
189-
? `<div class="callout-fold">
186+
const foldDiv = collapsible ? `<div class="callout-fold">
190187
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-chevron-down">
191188
<polyline points="6 9 12 15 18 9"></polyline>
192189
</svg>
193-
</div>`
194-
: "";
190+
</div>` : "";
195191
const titleDiv = titleLine
196192
? `<div class="callout-title"><div class="callout-title-inner">${titleLine}</div>${foldDiv}</div>`
197193
: "";
198-
let collapseClasses =
199-
titleLine && collapsible ? "is-collapsible" : "";
194+
let collapseClasses = titleLine && collapsible ? 'is-collapsible' : ''
200195
if (collapsible && collapsed) {
201-
collapseClasses += " is-collapsed";
196+
collapseClasses += " is-collapsed"
202197
}
203198

204-
let res = `<div data-callout-metadata class="callout ${collapseClasses}" data-callout="${token.info.substring(
205-
3,
206-
)}">${titleDiv}\n<div class="callout-content">${md.render(
207-
parts.slice(nbLinesToSkip).join("\n"),
208-
)}</div></div>`;
209-
return res;
199+
let res = `<div data-callout-metadata class="callout ${collapseClasses}" data-callout="${token.info.substring(3)
200+
}">${titleDiv}\n<div class="callout-content">${md.render(
201+
parts.slice(nbLinesToSkip).join("\n")
202+
)}</div></div>`;
203+
return res
210204
}
211205

212206
// Other languages
@@ -228,9 +222,7 @@ module.exports = function (eleventyConfig) {
228222

229223
let metaData = "";
230224
if (widthAndMetaData.length > 1) {
231-
metaData = widthAndMetaData
232-
.slice(0, widthAndMetaData.length - 1)
233-
.join(" ");
225+
metaData = widthAndMetaData.slice(0, widthAndMetaData.length - 1).join(" ");
234226
}
235227

236228
if (!lastValueIsNumber) {
@@ -334,12 +326,10 @@ module.exports = function (eleventyConfig) {
334326

335327
eleventyConfig.addTransform("dataview-js-links", function (str) {
336328
const parsed = parse(str);
337-
for (const dataViewJsLink of parsed.querySelectorAll(
338-
"a[data-href].internal-link",
339-
)) {
329+
for (const dataViewJsLink of parsed.querySelectorAll("a[data-href].internal-link")) {
340330
const notePath = dataViewJsLink.getAttribute("data-href");
341331
const title = dataViewJsLink.innerHTML;
342-
const { attributes, innerHTML } = getAnchorAttributes(notePath, title);
332+
const {attributes, innerHTML} = getAnchorAttributes(notePath, title);
343333
for (const key in attributes) {
344334
dataViewJsLink.setAttribute(key, attributes[key]);
345335
}
@@ -353,7 +343,7 @@ module.exports = function (eleventyConfig) {
353343
const parsed = parse(str);
354344

355345
const transformCalloutBlocks = (
356-
blockquotes = parsed.querySelectorAll("blockquote"),
346+
blockquotes = parsed.querySelectorAll("blockquote")
357347
) => {
358348
for (const blockquote of blockquotes) {
359349
transformCalloutBlocks(blockquote.querySelectorAll("blockquote"));
@@ -378,8 +368,8 @@ module.exports = function (eleventyConfig) {
378368
const titleText = title.replace(/(<\/{0,1}\w+>)/, "")
379369
? title
380370
: `${callout.charAt(0).toUpperCase()}${callout
381-
.substring(1)
382-
.toLowerCase()}`;
371+
.substring(1)
372+
.toLowerCase()}`;
383373
const fold = isCollapsable
384374
? `<div class="callout-fold"><i icon-name="chevron-down"></i></div>`
385375
: ``;
@@ -388,7 +378,7 @@ module.exports = function (eleventyConfig) {
388378
calloutMetaData = metaData;
389379
titleDiv = `<div class="callout-title"><div class="callout-title-inner">${titleText}</div>${fold}</div>`;
390380
return "";
391-
},
381+
}
392382
);
393383

394384
/* Hacky fix for callouts with only a title:
@@ -402,17 +392,14 @@ module.exports = function (eleventyConfig) {
402392
if (content === "\n<p>\n") {
403393
content = "";
404394
}
405-
let contentDiv = content
406-
? `\n<div class="callout-content">${content}</div>`
407-
: "";
395+
let contentDiv = content ? `\n<div class="callout-content">${content}</div>` : "";
408396

409397
blockquote.tagName = "div";
410398
blockquote.classList.add("callout");
411399
blockquote.classList.add(isCollapsable ? "is-collapsible" : "");
412400
blockquote.classList.add(isCollapsed ? "is-collapsed" : "");
413401
blockquote.setAttribute("data-callout", calloutType.toLowerCase());
414-
calloutMetaData &&
415-
blockquote.setAttribute("data-callout-metadata", calloutMetaData);
402+
calloutMetaData && blockquote.setAttribute("data-callout-metadata", calloutMetaData);
416403
blockquote.innerHTML = `${titleDiv}${contentDiv}`;
417404
}
418405
};
@@ -433,19 +420,19 @@ module.exports = function (eleventyConfig) {
433420
media="(max-width:480px)"
434421
srcset="${meta.jpeg[0].url}"
435422
/>
436-
`;
423+
`
437424
if (meta.webp && meta.webp[1] && meta.webp[1].url) {
438425
html += `<source
439426
media="(max-width:1920px)"
440427
srcset="${meta.webp[1].url}"
441428
type="image/webp"
442-
/>`;
429+
/>`
443430
}
444431
if (meta.jpeg && meta.jpeg[1] && meta.jpeg[1].url) {
445432
html += `<source
446433
media="(max-width:1920px)"
447434
srcset="${meta.jpeg[1].url}"
448-
/>`;
435+
/>`
449436
}
450437
html += `<img
451438
class="${cls.toString()}"
@@ -456,8 +443,9 @@ module.exports = function (eleventyConfig) {
456443
imageTag.innerHTML = html;
457444
}
458445

446+
459447
eleventyConfig.addTransform("picture", function (str) {
460-
if (process.env.USE_FULL_RESOLUTION_IMAGES === "true") {
448+
if(process.env.USE_FULL_RESOLUTION_IMAGES === "true"){
461449
return str;
462450
}
463451
const parsed = parse(str);
@@ -466,14 +454,14 @@ module.exports = function (eleventyConfig) {
466454
if (src && src.startsWith("/") && !src.endsWith(".svg")) {
467455
const cls = imageTag.classList.value;
468456
const alt = imageTag.getAttribute("alt");
469-
const width = imageTag.getAttribute("width") || "";
457+
const width = imageTag.getAttribute("width") || '';
470458

471459
try {
472460
const meta = transformImage(
473461
"./src/site" + decodeURI(imageTag.getAttribute("src")),
474462
cls.toString(),
475463
alt,
476-
["(max-width: 480px)", "(max-width: 1024px)"],
464+
["(max-width: 480px)", "(max-width: 1024px)"]
477465
);
478466

479467
if (meta) {
@@ -497,7 +485,7 @@ module.exports = function (eleventyConfig) {
497485
}
498486

499487
for (const t of parsed.querySelectorAll(
500-
".cm-s-obsidian > .block-language-dataview > table",
488+
".cm-s-obsidian > .block-language-dataview > table"
501489
)) {
502490
t.classList.add("dataview");
503491
t.classList.add("table-view-table");
@@ -515,8 +503,7 @@ module.exports = function (eleventyConfig) {
515503

516504
eleventyConfig.addTransform("htmlMinifier", (content, outputPath) => {
517505
if (
518-
(process.env.NODE_ENV === "production" ||
519-
process.env.ELEVENTY_ENV === "prod") &&
506+
(process.env.NODE_ENV === "production" || process.env.ELEVENTY_ENV === "prod") &&
520507
outputPath &&
521508
outputPath.endsWith(".html")
522509
) {
@@ -543,14 +530,15 @@ module.exports = function (eleventyConfig) {
543530
tags: ["h1", "h2", "h3", "h4", "h5", "h6"],
544531
});
545532

533+
546534
eleventyConfig.addFilter("dateToZulu", function (date) {
547535
try {
548536
return new Date(date).toISOString("dd-MM-yyyyTHH:mm:ssZ");
549537
} catch {
550538
return "";
551539
}
552540
});
553-
541+
554542
eleventyConfig.addFilter("jsonify", function (variable) {
555543
return JSON.stringify(variable) || '""';
556544
});
@@ -571,12 +559,6 @@ module.exports = function (eleventyConfig) {
571559
},
572560
});
573561

574-
eleventyConfig.addCollection("footerPages", function (collectionApi) {
575-
return collectionApi.getAll().filter(function (item) {
576-
return item.data["dg-footer"] === true;
577-
});
578-
});
579-
580562
userEleventySetup(eleventyConfig);
581563

582564
return {

src/site/_includes/components/pageheader.njk

+1-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
<link href="{{style}}" rel="stylesheet">
2929
{%- endfor -%}
3030

31-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simplelightbox/2.10.3/simple-lightbox.min.css">
32-
3331
{% favicons './src/site/favicon.svg', appleIconBgColor='#123' %}
3432

3533
{% if metatags %}
@@ -44,4 +42,4 @@
4442
</style>
4543
{% endif %}
4644
<style>
47-
</style>
45+
</style>

0 commit comments

Comments
 (0)