-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
89 lines (73 loc) · 2.97 KB
/
.eleventy.js
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
77
78
79
80
81
82
83
84
85
86
87
88
89
const pluginBetterSlug = require("@borisschapira/eleventy-plugin-better-slug");
const pluginSass = require("eleventy-plugin-sass");
const markdownIt = require("markdown-it");
const markdownItAttrs = require("markdown-it-attrs");
const pluginSassSettings = {
watch: ['_src/**/*.{scss,sass}', '!node_modules/**']
};
const markdownItSettings = {
html: true,
breaks: true,
linkify: true,
};
const markdownItAttrsSettings = {
leftDelimiter: "{",
rightDelimiter: "}",
allowedAttributes: ["class"],
};
const markdownLib = markdownIt(markdownItSettings).use(markdownItAttrs, markdownItAttrsSettings);
module.exports = (function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("_src/img");
eleventyConfig.addPassthroughCopy("_src/js");
eleventyConfig.addPassthroughCopy("_src/css/fonts");
eleventyConfig.addPlugin(pluginBetterSlug);
eleventyConfig.addPlugin(pluginSass, pluginSassSettings);
eleventyConfig.addShortcode("chestParse", function(chestList) {
return `There are ${chestList.length} total chests in this world.`;
})
eleventyConfig.addShortcode("otherCheckParse", function(checkList) {
let defaultChecks = [];
let optionalChecks = {};
for (const check of checkList) {
const enabledBy = check.enabledBy;
if (enabledBy == 'Default') {
defaultChecks.push(check);
} else if (optionalChecks.hasOwnProperty(enabledBy)) {
optionalChecks[enabledBy].push(check);
} else {
optionalChecks[enabledBy] = [check];
}
}
let output = `By default, there are ${defaultChecks.length} other checks--they are as follows:`;
for (const check of defaultChecks) {
output += `\n* ${check.description} (${check.type})`;
}
for (const enabledBy in optionalChecks) {
const checks = optionalChecks[enabledBy];
const s = (checks.length == 1) ? "" : "s";
output += `\n\nIf the ${enabledBy} checks are enabled, ${checks.length} additional check${s} could be important:`;
for (const check of checks) {
output += `\n* ${check.description} (${check.type})`;
}
}
return output;
})
eleventyConfig.addShortcode("levelCheckIdTable", function(levels) {
let output = `| Level | Sword | Shield | Staff |\n`;
output += `|:-----:|:--------:|:--------:|:--------:|\n`;
for (const level of levels) {
output += `| ${level.level.toString().padEnd(6, " ")}`;
output += `| ${level.swordId} `;
output += `| ${level.shieldId} `;
output += `| ${level.staffId} |\n`
}
return output;
})
eleventyConfig.setLibrary("md", markdownLib);
return {
dir: {
input: "_src",
output: "public",
}
};
});