Skip to content

Commit

Permalink
Fix toml parsing failing due to space in root names
Browse files Browse the repository at this point in the history
  • Loading branch information
ExcaliburZero committed Oct 9, 2023
1 parent 41c0f9f commit 60f18d9
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cbpickaxe_scripts/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
TEMPLATES_DIR = SOURCE_DIR / "templates"
MONSTER_FORM_TEMPLATE = TEMPLATES_DIR / "monster_form.html.template"

OFFICIAL_ROOT_NAME = "Cassette Beasts"
OFFICIAL_ROOT_NAME = "cassette_beasts"
OFFICIAL_MONSTER_FORM_PATHS = [
"res://data/monster_forms/",
"res://data/monster_forms_secret/",
Expand Down Expand Up @@ -131,7 +131,7 @@ def main(argv: List[str]) -> int:
build_parser = subparsers.add_parser(
"build", description="Build the documentation for the mod."
)
build_parser.add_argument("--config", nargs="+", default="docs.toml")
build_parser.add_argument("--config", default="docs.toml")
build_parser.add_argument("--locale", default="en")

_ = subparsers.add_parser(
Expand Down Expand Up @@ -204,7 +204,7 @@ def create_new_config(config_filepath: pathlib.Path) -> int:

current_dir_name = pathlib.Path().absolute().name

mod_name = input("Enter the name of your mod (spaces are allowed): ")
mod_name = input("Enter the name of your mod (no spaces, underscores allowed): ")
has_monsters_str = input(
"Does your mod add any new monster species [y/n]: "
).lower()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mod Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<style>
body {
font-family: 'Segoe UI', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Lato', 'Liberation Sans', 'Noto Sans', 'Helvetica Neue', 'Helvetica', sans-serif;
}

a {
color: #7629db;
text-decoration: none;
}

a:hover {
color: #382376;
}

a[href*='//'] {
color: #5d6abd;
}

a[href*='//']:hover {
color: #2c41bd;
}

.topbar {
background-color: #ab75e8;
padding-bottom: 8px;
}

.navbar {
padding-left: 12px;
}

.sidebar {
background-color: #ffffff;
border-left: 10px solid #ab75e8;
border-right: 10px solid #ab75e8;
border-top: 10px solid #ab75e8;
padding: 0px;
}

a.sidebar-root-link {
color: #ffffff;
font-size: 14pt;
font-family: 'Neu5Land', 'Segoe UI', 'Lato', 'Liberation Sans', 'Noto Sans', 'Helvetica Neue', 'Helvetica', sans-serif;
font-weight: bold;
}

a.sidebar-sub-link {
color: #000000;
font-size: 12pt;
font-family: 'Neu5Land', 'Segoe UI', 'Lato', 'Liberation Sans', 'Noto Sans', 'Helvetica Neue', 'Helvetica', sans-serif;
font-weight: bold;
}

.sidebar-root {
background-color: #ab75e8;
margin-top: 14px;
margin-right: 10px;
-webkit-clip-path: polygon(0 0, 100% 0%, 80% 100%, 0% 100%);
clip-path: polygon(0 0, 100% 0%, 80% 100%, 0% 100%);
}

.sidebar-root:hover {
background-color: #3fbb9f;
}

.sidebar-sub {
padding-top: 8px !important;
padding-bottom: 8px !important;
padding-left: 20px !important;
}

.sidebar-sub:hover {
background-color: #3fbb9f;
}
</style>
</head>

<body>
<div class="container-fluid">
<div class="row">
<div class="col-2 d-none d-lg-block min-vh-100 sidebar">
<div>

</div>
</div>
<div class="col-12 col-lg-10 d-flex flex-column min-vh-100">
<main class="wrapper flex-grow-1">


<div class="container">

</div>

</main>
<div class="container">
<footer class="pt-5 pb-2">
<p>Documentation generated using <a href="https://github.com/ExcaliburZero/cbpickaxe">cbpickaxe</a>
</p>
</footer>
</div>
</div>
</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output_directory = "docs"

[roots]
Cassette Beasts = "../my_cassette_beasts"
cassette_beasts = "../my_cassette_beasts"
Traffikrabdos = "."

[monsters]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output_directory = "docs"

[roots]
Cassette Beasts = "../my_cassette_beasts"
cassette_beasts = "../my_cassette_beasts"
Traffikrabdos = "."

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output_directory = "docs"

[roots]
Cassette Beasts = "../my_cassette_beasts"
cassette_beasts = "../my_cassette_beasts"
Traffikrabdos is Cool = "."

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output_directory = "docs"

[roots]
Cassette Beasts = "../my_cassette_beasts"
cassette_beasts = "../my_cassette_beasts"
Traffikrabdos = "."

[monsters]
Expand Down
4 changes: 4 additions & 0 deletions regression_tests/data/docs_empty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output_directory = "docs"

[roots]
cassette_beasts = "../../data/fake_cassette_beasts"
Empty file.
25 changes: 25 additions & 0 deletions regression_tests/test_regression_generate_docs_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pathlib
import inspect
import sys

from .util import Util, rel_data, update_baselines


class TestRegressionGenerateDocsBuildEmptyMod(Util.TestRegression):
name = "generate_docs_build_empty_mod"
command = [
"cbpickaxe_generate_docs",
"build",
"--config",
rel_data("docs_empty.toml"),
]
expected_files = ["docs/index.html"]


if __name__ == "__main__":
tests = []
for name, obj in inspect.getmembers(sys.modules[__name__]):
if inspect.isclass(obj) and obj != Util:
tests.append(obj)

update_baselines(tests)

0 comments on commit 60f18d9

Please sign in to comment.