Bugfix docs: fix last section not appearing in reference

This commit is contained in:
Starbeamrainbowlabs 2021-10-04 21:45:15 +01:00
parent 55982b2eab
commit 66a3244203
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
5 changed files with 36 additions and 29 deletions

@ -8,7 +8,8 @@
<li>A full reference, with detailed explanations for each command</li>
</ol>
<p>After the contents, there is a <a href="#filter">filter box</a> for filtering the detailed explanations to quickly find the one you're after.</p>
<p>There is also a <a href="#filter">filter box</a> for filtering the detailed explanations to quickly find the one you're after.</p>
</section>
<section id="filter" class="panel-generic">

@ -16,27 +16,33 @@ markdown.use(markdown_prism, {
}
});
function make_section(acc) {
let title = acc[0].match(/#+\s+(.+)\s*/)[1].replace(/^`*|`*$/g, "");
return {
title: htmlentities.encode(title),
slug: title.toLowerCase().replace(/[^a-z0-9-_\s]+/gi, "")
.replace(/\s+/g, "-")
.replace(/-.*$/, ""),
content: markdown.render(acc.slice(1).join("\n"))
};
}
module.exports = function parse_sections(source) {
const lines = source.split(/\r?\n/gi);
const result = [];
let acc = [];
for(let line of lines) {
if(line.startsWith(`#`) && !line.startsWith(`###`)) {
if(acc.length > 0) {
let title = acc[0].match(/#+\s+(.+)\s*/)[1].replace(/^`*|`*$/g, "");
result.push({
title: htmlentities.encode(title),
slug: title.toLowerCase().replace(/[^a-z0-9-_\s]+/gi, "")
.replace(/\s+/g, "-")
.replace(/-.*$/, ""),
content: markdown.render(acc.slice(1).join("\n"))
});
}
if(acc.length > 0)
result.push(make_section(acc));
acc = [ line ];
}
else
acc.push(line);
}
if(acc.length > 0)
result.push(make_section(acc));
return result;
}

@ -14,7 +14,7 @@
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-img": "^0.10.0",
"markdown-it-prism": "^2.2.0",
"markdown-it-prism": "^2.2.1",
"phin": "^3.6.0"
}
},
@ -2438,12 +2438,12 @@
}
},
"node_modules/markdown-it-prism": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/markdown-it-prism/-/markdown-it-prism-2.2.0.tgz",
"integrity": "sha512-GOcP+oOt5AJHwD/6hnrdLXCSw1ZfjCCGblsmrPEyc5zEuNtRYYUjOsDX2eH5xoWTddnRwWlTT2EL/yN6mDcDwQ==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/markdown-it-prism/-/markdown-it-prism-2.2.1.tgz",
"integrity": "sha512-Lo7nQxI+x+MXQkeEXVNIer7fWCGasuEEMxYU63HJCxZNF8bfzWrXDHGsxv0a/qD3mL4sYHj0jUFT0h4fG8WQVw==",
"dev": true,
"dependencies": {
"prismjs": "1.24.1"
"prismjs": "1.25.0"
},
"engines": {
"node": ">=6.0.0"
@ -3120,9 +3120,9 @@
}
},
"node_modules/prismjs": {
"version": "1.24.1",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow==",
"version": "1.25.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.25.0.tgz",
"integrity": "sha512-WCjJHl1KEWbnkQom1+SzftbtXMKQoezOCYs5rECqMN+jP+apI7ftoflyqigqzopSO3hMhTEb0mFClA8lkolgEg==",
"dev": true
},
"node_modules/process-nextick-args": {
@ -6542,12 +6542,12 @@
}
},
"markdown-it-prism": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/markdown-it-prism/-/markdown-it-prism-2.2.0.tgz",
"integrity": "sha512-GOcP+oOt5AJHwD/6hnrdLXCSw1ZfjCCGblsmrPEyc5zEuNtRYYUjOsDX2eH5xoWTddnRwWlTT2EL/yN6mDcDwQ==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/markdown-it-prism/-/markdown-it-prism-2.2.1.tgz",
"integrity": "sha512-Lo7nQxI+x+MXQkeEXVNIer7fWCGasuEEMxYU63HJCxZNF8bfzWrXDHGsxv0a/qD3mL4sYHj0jUFT0h4fG8WQVw==",
"dev": true,
"requires": {
"prismjs": "1.24.1"
"prismjs": "1.25.0"
}
},
"maximatch": {
@ -7048,9 +7048,9 @@
}
},
"prismjs": {
"version": "1.24.1",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow==",
"version": "1.25.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.25.0.tgz",
"integrity": "sha512-WCjJHl1KEWbnkQom1+SzftbtXMKQoezOCYs5rECqMN+jP+apI7ftoflyqigqzopSO3hMhTEb0mFClA8lkolgEg==",
"dev": true
},
"process-nextick-args": {

@ -22,7 +22,7 @@
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-img": "^0.10.0",
"markdown-it-prism": "^2.2.0",
"markdown-it-prism": "^2.2.1",
"phin": "^3.6.0"
},
"dependencies": {

@ -882,7 +882,7 @@ The far wand (`worldeditadditions:farwand`) is a variant on the traditional Worl
It functions very similarly to the regular WorldEdit wand, except that it has a _much_ longer range - which can be very useful for working on large-scale terrain for example. It also comes with an associated command to control it.
## `//farwand skip_liquid (true|false) | maxdist <number>`
This command helps control the behaviour of the [WorldEditAdditions far wand](#far-wand). Calling it without any arguments shows the current status:
This command helps control the behaviour of the [WorldEditAdditions far wand](#far-wand) and [cloud wand](#cloud-wand). Calling it without any arguments shows the current status:
```weacmd
//farwand