mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 17:12:59 +00:00
docs: add Lua API to site via moondoc!
Ref https://github.com/sbrl/moondoc
This commit is contained in:
parent
1ca524bbc3
commit
15a52deea1
7 changed files with 1395 additions and 153 deletions
|
@ -10,6 +10,7 @@ const phin = require("phin");
|
||||||
const CleanCSS = require("clean-css");
|
const CleanCSS = require("clean-css");
|
||||||
const { minify: minify_html } = require("html-minifier-terser");
|
const { minify: minify_html } = require("html-minifier-terser");
|
||||||
|
|
||||||
|
const moondoc_runner = require("./lib/moondoc_runner.js");
|
||||||
const HTMLPicture = require("./lib/HTMLPicture.js");
|
const HTMLPicture = require("./lib/HTMLPicture.js");
|
||||||
const FileFetcher = require("./lib/FileFetcher.js");
|
const FileFetcher = require("./lib/FileFetcher.js");
|
||||||
|
|
||||||
|
@ -120,6 +121,10 @@ async function do_minify_html(source, output_path) {
|
||||||
if(is_production) console.log("Production environment detected, minifying content");
|
if(is_production) console.log("Production environment detected, minifying content");
|
||||||
|
|
||||||
module.exports = function(eleventyConfig) {
|
module.exports = function(eleventyConfig) {
|
||||||
|
moondoc_runner(
|
||||||
|
path.resolve(__dirname, "_site/api/index.html")
|
||||||
|
);
|
||||||
|
|
||||||
eleventyConfig.addTransform("cssmin", do_minify_css);
|
eleventyConfig.addTransform("cssmin", do_minify_css);
|
||||||
eleventyConfig.addTransform("htmlmin", do_minify_html);
|
eleventyConfig.addTransform("htmlmin", do_minify_html);
|
||||||
|
|
||||||
|
@ -140,4 +145,5 @@ module.exports = function(eleventyConfig) {
|
||||||
eleventyConfig.addPassthroughCopy({
|
eleventyConfig.addPassthroughCopy({
|
||||||
"node_modules/keen-slider/keen-slider.es.js": "./keen-slider.es.js"
|
"node_modules/keen-slider/keen-slider.es.js": "./keen-slider.es.js"
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<main>
|
<main>
|
||||||
<section class="panel-generic">
|
<section class="panel-generic">
|
||||||
<h1 id="#reference">Reference</h1>
|
<h1 id="#reference">Reference</h1>
|
||||||
<p>This is the full chat command reference for WorldEditAdditions. It has 2 parts:</p>
|
<p>This is the full chat command reference for WorldEditAdditions. It has 3 parts:</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>A contents list of commands and their syntax</li>
|
<li>A contents list of commands and their syntax</li>
|
||||||
<li>A full reference, with detailed explanations for each command</li>
|
<li>A full reference, with detailed explanations for each command</li>
|
||||||
|
<li>The <a href="/api/">Lua API</a>, which may be useful for mod authors or those wishing to hack on the WorldEditAdditions codebase.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>There is also a <a href="#filter">filter box</a> for filtering everything to quickly find the one you're after.</p>
|
<p>There is also a <a href="#filter">filter box</a> for filtering everything to quickly find the one you're after.</p>
|
||||||
|
|
|
@ -262,7 +262,8 @@ footer {
|
||||||
margin: 3em 0 0 0;
|
margin: 3em 0 0 0;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: var(--pattern-jigsaw-green),
|
background: linear-gradient(to left, #fff2, #fff2),
|
||||||
|
var(--pattern-jigsaw-green),
|
||||||
var(--bg-bright);
|
var(--bg-bright);
|
||||||
/* color: var(--text-bright); */
|
/* color: var(--text-bright); */
|
||||||
}
|
}
|
||||||
|
|
22
.docs/lib/moondoc_runner.js
Normal file
22
.docs/lib/moondoc_runner.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const promisify = require("util").promisify;
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const child_process = require("child_process");
|
||||||
|
|
||||||
|
const filepath_moondoc = path.resolve(__dirname, `../node_modules/.bin/moondoc`);
|
||||||
|
const dirpath_root = path.resolve(__dirname, `../..`);
|
||||||
|
|
||||||
|
module.exports = function moondoc_runner(filepath_output) {
|
||||||
|
const dirpath = path.dirname(filepath_output);
|
||||||
|
if(!fs.existsSync(dirpath)) {
|
||||||
|
fs.mkdirSync(dirpath, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
child_process.execFileSync(filepath_moondoc, [
|
||||||
|
"build",
|
||||||
|
"--input", dirpath_root,
|
||||||
|
"--output", filepath_output
|
||||||
|
]);
|
||||||
|
}
|
1499
.docs/package-lock.json
generated
1499
.docs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -29,8 +29,9 @@
|
||||||
"html-minifier-terser": "^7.0.0-beta.0",
|
"html-minifier-terser": "^7.0.0-beta.0",
|
||||||
"imagickal": "^5.0.1",
|
"imagickal": "^5.0.1",
|
||||||
"keen-slider": "^6.8.6",
|
"keen-slider": "^6.8.6",
|
||||||
"markdown-it-github-alerts": "^0.1.2",
|
"markdown-it-github-alerts": "^0.2.0",
|
||||||
"markdown-it-prism": "^2.3.0",
|
"markdown-it-prism": "^2.3.0",
|
||||||
|
"moondoc": "^1.0.1",
|
||||||
"p-memoize": "^7.1.1",
|
"p-memoize": "^7.1.1",
|
||||||
"p-queue": "^7.3.4",
|
"p-queue": "^7.3.4",
|
||||||
"phin": "^3.7.0",
|
"phin": "^3.7.0",
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
--- WorldEditAdditions
|
--- WorldEditAdditions Lua API
|
||||||
|
--
|
||||||
|
-- This is the documentation for the Lua API of WorldEditAdditions. It was generated automatically from comments spread across the codebase with [moondoc](https://github.com/sbrl/moondoc).
|
||||||
|
--
|
||||||
|
-- **Current version:** 1.15-dev
|
||||||
|
--
|
||||||
|
-- These docs are a work-in-progress. **Not all functions are documented here yet.** If anything is unclear, please [open an issue](https://github.com/sbrl/Minetest-WorldEditAdditions/issues/new).
|
||||||
|
--
|
||||||
|
-- © 2023 Starbeamrainbowlabs and contributors. Licenced under the Mozilla Public License 2.0.
|
||||||
-- @namespace worldeditadditions
|
-- @namespace worldeditadditions
|
||||||
-- @release 1.14.5
|
-- @release 1.14.5
|
||||||
-- @copyright 2023 Starbeamrainbowlabs
|
-- @copyright 2023 Starbeamrainbowlabs and contributors
|
||||||
-- @license Mozilla Public License, 2.0
|
-- @license Mozilla Public License, 2.0
|
||||||
-- @author Starbeamrainbowlabs
|
-- @author Starbeamrainbowlabs
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue