2021-10-17 02:00:24 +00:00
|
|
|
"use strict";
|
|
|
|
|
2021-06-20 00:51:55 +00:00
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
2021-10-17 02:00:24 +00:00
|
|
|
|
|
|
|
const columnify = require("columnify");
|
|
|
|
const htmlentities = require("html-entities");
|
|
|
|
|
|
|
|
const a = require("./lib/Ansi.js");
|
2021-06-20 00:51:55 +00:00
|
|
|
const parse_sections = require("./lib/parse_sections.js");
|
|
|
|
|
2021-10-05 01:02:53 +00:00
|
|
|
let { sections, categories } = parse_sections(fs.readFileSync(
|
|
|
|
path.resolve(
|
|
|
|
__dirname,
|
|
|
|
`../Chat-Command-Reference.md`
|
|
|
|
),
|
|
|
|
"utf-8"
|
|
|
|
))
|
2021-06-20 00:51:55 +00:00
|
|
|
|
2023-07-10 23:52:04 +00:00
|
|
|
sections = sections.sort((a, b) => a.title.replace(/^\/+/g, "").localeCompare(
|
2021-10-05 01:02:53 +00:00
|
|
|
b.title.replace(/^\/+/g, "")));
|
2021-06-20 00:51:55 +00:00
|
|
|
|
2021-10-05 01:02:53 +00:00
|
|
|
|
|
|
|
console.log(`REFERENCE SECTION TITLES`)
|
2021-10-17 02:00:24 +00:00
|
|
|
console.log(columnify(sections.map(s => { return {
|
|
|
|
category: `${a.hicol}${a.fyellow}${s.category}${a.reset}`,
|
|
|
|
command: `${a.hicol}${a.fmagenta}${htmlentities.decode(s.title)}${a.reset}`
|
|
|
|
} })));
|
|
|
|
// console.log(sections
|
|
|
|
// .map(s => `${a.fyellow}${a.hicol}${s.category}${a.reset}\t${a.fmagenta}${a.hicol}${s.title}${a.reset}`).join(`\n`));
|
2021-10-05 01:02:53 +00:00
|
|
|
console.log(`************************`);
|
|
|
|
|
2021-10-17 02:00:24 +00:00
|
|
|
console.log(`REFERENCE SECTION COLOURS`);
|
|
|
|
console.log(columnify(Array.from(categories).map(el => { return {
|
|
|
|
category: el[0],
|
|
|
|
colour: el[1]
|
|
|
|
} })));
|
|
|
|
|
2021-06-20 00:51:55 +00:00
|
|
|
module.exports = {
|
|
|
|
layout: "theme.njk",
|
|
|
|
title: "Reference",
|
|
|
|
tags: "navigable",
|
|
|
|
date: "2001-01-01",
|
|
|
|
section_intro: sections[0],
|
2021-10-05 01:02:53 +00:00
|
|
|
sections_help: sections, // Remove the very beginning bit
|
|
|
|
categories: [...categories.keys()].join("|")
|
2021-06-20 00:51:55 +00:00
|
|
|
}
|