mirror of
https://github.com/mfocko/blog.git
synced 2024-11-22 04:53:47 +01:00
chore: refactor config
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
bca52fdc0e
commit
b94c33faaa
1 changed files with 41 additions and 56 deletions
|
@ -9,13 +9,19 @@ const katex = require("rehype-katex");
|
|||
|
||||
require("dotenv").config();
|
||||
|
||||
function constructDocs(subject) {
|
||||
class Subject {
|
||||
constructor(subject, description) {
|
||||
this.subject = subject;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
docs() {
|
||||
return [
|
||||
"@docusaurus/plugin-content-docs",
|
||||
{
|
||||
id: subject,
|
||||
path: subject,
|
||||
routeBasePath: subject,
|
||||
id: this.subject,
|
||||
path: this.subject,
|
||||
routeBasePath: this.subject,
|
||||
sidebarPath: require.resolve("./sidebars.js"),
|
||||
editUrl: "https://gitlab.fi.muni.cz/xfocko/kb/tree/main",
|
||||
remarkPlugins: [math],
|
||||
|
@ -24,6 +30,26 @@ function constructDocs(subject) {
|
|||
];
|
||||
}
|
||||
|
||||
navbar() {
|
||||
return {
|
||||
type: "doc",
|
||||
docId: `${this.subject}-intro`,
|
||||
docsPluginId: this.subject,
|
||||
position: "left",
|
||||
label: `${this.subject.toUpperCase()}: ${this.description}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const subjects = [
|
||||
new Subject("ib002", "Algorithms"),
|
||||
// new Subject("ib015", "Non-imperative programming"),
|
||||
// new Subject("ib110", "Introduction to informatics"),
|
||||
// new Subject("ib111", "Foundations of programming"),
|
||||
new Subject("pb071", "C"),
|
||||
new Subject("pb161", "C++"),
|
||||
];
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: "Additional materials by mf",
|
||||
|
@ -53,7 +79,7 @@ const config = {
|
|||
],
|
||||
],
|
||||
|
||||
plugins: ["ib002", "ib015", "ib110", "ib111", "pb071", "pb161"].map(constructDocs),
|
||||
plugins: subjects.map(s => s.docs()),
|
||||
|
||||
stylesheets: [
|
||||
{
|
||||
|
@ -71,48 +97,7 @@ const config = {
|
|||
navbar: {
|
||||
title: "Additional materials by mf",
|
||||
items: [
|
||||
{
|
||||
type: "doc",
|
||||
docId: "ib002-intro",
|
||||
docsPluginId: "ib002",
|
||||
position: "left",
|
||||
label: "IB002: Algorithms",
|
||||
},
|
||||
// {
|
||||
// type: "doc",
|
||||
// docId: "ib015-intro",
|
||||
// docsPluginId: "ib015",
|
||||
// position: "left",
|
||||
// label: "IB015: Non-imperative programming",
|
||||
// },
|
||||
// {
|
||||
// type: "doc",
|
||||
// docId: "ib110-intro",
|
||||
// docsPluginId: "ib110",
|
||||
// position: "left",
|
||||
// label: "IB110: Introduction to informatics",
|
||||
// },
|
||||
// {
|
||||
// type: "doc",
|
||||
// docId: "ib111-intro",
|
||||
// docsPluginId: "ib111",
|
||||
// position: "left",
|
||||
// label: "IB111: Foundations of programming",
|
||||
// },
|
||||
{
|
||||
type: "doc",
|
||||
docId: "pb071-intro",
|
||||
docsPluginId: "pb071",
|
||||
position: "left",
|
||||
label: "PB071: C",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
docId: "pb161-intro",
|
||||
docsPluginId: "pb161",
|
||||
position: "left",
|
||||
label: "PB161: C++",
|
||||
},
|
||||
...subjects.map(s => s.navbar()),
|
||||
{
|
||||
href: "https://gitlab.fi.muni.cz/xfocko/fi",
|
||||
label: "GitLab",
|
||||
|
|
Loading…
Reference in a new issue