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
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
5 changed files with 36 additions and 29 deletions

View file

@ -8,7 +8,8 @@
<li>A full reference, with detailed explanations for each command</li> <li>A full reference, with detailed explanations for each command</li>
</ol> </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>
<section id="filter" class="panel-generic"> <section id="filter" class="panel-generic">

View file

@ -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) { module.exports = function parse_sections(source) {
const lines = source.split(/\r?\n/gi); const lines = source.split(/\r?\n/gi);
const result = []; const result = [];
let acc = []; let acc = [];
for(let line of lines) { for(let line of lines) {
if(line.startsWith(`#`) && !line.startsWith(`###`)) { if(line.startsWith(`#`) && !line.startsWith(`###`)) {
if(acc.length > 0)
if(acc.length > 0) { result.push(make_section(acc));
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"))
});
}
acc = [ line ]; acc = [ line ];
} }
else else
acc.push(line); acc.push(line);
} }
if(acc.length > 0)
result.push(make_section(acc));
return result; return result;
} }

View file

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

View file

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

View file

@ -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. 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>` ## `//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 ```weacmd
//farwand //farwand