From 3765378f99d29a0481e0268a76edf283a6167a48 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 26 Apr 2025 14:06:27 +0200 Subject: Use .md suffix in docs links so they work on github. --- README.md | 4 ++-- docs/index.md | 30 +++++++++++++++--------------- docs/module/rules.md | 2 +- docs/overview/architecture.md | 2 +- docs/overview/module.md | 2 +- server.js | 12 +++++++++--- views/about.pug | 6 +++--- views/tm_list.pug | 2 +- views/tm_seed.pug | 2 +- 9 files changed, 34 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 492c746..c30c694 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ and/or publisher for any necessary permissions. ## Documentation -See public/docs/index.html +See [docs/index.md](docs/index.md) ## Installing and getting started -See public/docs/install.html +See [docs/server/install.md](docs/server/install.md) diff --git a/docs/index.md b/docs/index.md index 254cc74..b9ade23 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,32 +6,32 @@ server instance and how to create new modules. ## For players -* [Tips & Tricks](/docs/tips) -* [Tournaments](/docs/tournaments) +* [Tips & Tricks](tips.md) +* [Tournaments](tournaments.md) ## For developers -* [Installing the server](/docs/server/install) -* [Running a public server](/docs/server/production) -* [Toolbox](/docs/server/toolbox) +* [Installing the server](server/install.md) +* [Running a public server](server/production.md) +* [Toolbox](server/toolbox.md) ## System overview -* [Server architecture](/docs/overview/architecture) -* [Database schema](/docs/overview/database) -* [Module architecture](/docs/overview/module) +* [Server architecture](overview/architecture.md) +* [Database schema](overview/database.md) +* [Module architecture](overview/module.md) ## Module implementation -* [General tips and where to start](/docs/module/guide) -* [Rules framework](/docs/module/rules) - * [Script syntax](/docs/module/script) - * [Utility library](/docs/module/library) +* [General tips and where to start](module/guide.md) +* [Rules framework](module/rules.md) + * [Script syntax](module/script.md) + * [Utility library](module/library.md) * Create the user interface (todo) * Prepare the art assets (todo) -* [Test with the Fuzzer](/docs/module/fuzzer) +* [Test with the Fuzzer](module/fuzzer.md) diff --git a/docs/module/rules.md b/docs/module/rules.md index a2135f1..ed99188 100644 --- a/docs/module/rules.md +++ b/docs/module/rules.md @@ -7,7 +7,7 @@ This is exposed to the system via a handful of exported properties and functions All of the board state is represented as a plain JS object that is passed to and returned from these functions. -See the [module overview](/docs/overview/module) for the details. +See the [module overview](../overview/module.md) for the details. ## Copy & Paste diff --git a/docs/overview/architecture.md b/docs/overview/architecture.md index 6413386..5865de8 100644 --- a/docs/overview/architecture.md +++ b/docs/overview/architecture.md @@ -11,7 +11,7 @@ The "join" page is the most complicated, and also uses javascript and server sen ## Database -See the [database overview](/docs/overview/database) for a brief introduction to the tables involved. +See the [database overview](database.md) for a brief introduction to the tables involved. ## Client/Server diff --git a/docs/overview/module.md b/docs/overview/module.md index 2a12461..ca1bd63 100644 --- a/docs/overview/module.md +++ b/docs/overview/module.md @@ -233,7 +233,7 @@ See rommel-in-the-desert and wilderness-war for examples of using the query mech The rules.js script is loaded by the server. Certain properties and functions must be provided by the rules module. -> NOTE: See the [module rules](/docs/module/rules) documentation if you want to +> NOTE: See the [module rules](../module/rules.md) documentation if you want to > use the shared rules framework that provides a structured approach to > implementing game rules. diff --git a/server.js b/server.js index b315886..7070442 100644 --- a/server.js +++ b/server.js @@ -4100,20 +4100,26 @@ function render_markdown(path) { } app.get("/docs", function (req, res) { - res.send(render_markdown("docs/index.md")) + res.redirect("/docs/index") }) app.get("/docs/:file", function (req, res) { + var file = req.params.file + if (!file.endsWith(".md")) + file += ".md" try { - res.send(render_markdown("docs/" + req.params.file + ".md")) + res.send(render_markdown("docs/" + file)) } catch (err) { res.status(404).send(err.message) } }) app.get("/docs/:dir/:file", function (req, res) { + var file = req.params.file + if (!file.endsWith(".md")) + file += ".md" try { - res.send(render_markdown("docs/" + req.params.dir + "/" + req.params.file + ".md")) + res.send(render_markdown("docs/" + req.params.dir + "/" + file)) } catch (err) { res.status(404).send(err.message) } diff --git a/views/about.pug b/views/about.pug index ee94352..6b423d9 100644 --- a/views/about.pug +++ b/views/about.pug @@ -22,9 +22,9 @@ html h2 About ul - li Read the Tips & Tricks before playing! - li Read the tournament information before joining a tournament. - li Study the developer documentation if you want to create modules. + li Read the Tips & Tricks before playing! + li Read the tournament information before joining a tournament. + li Study the developer documentation if you want to create modules. p. The source code is available on #[a(href="https://git.rally-the-troops.com/") git.rally-the-troops.com]. diff --git a/views/tm_list.pug b/views/tm_list.pug index 7c25d69..88fe9cf 100644 --- a/views/tm_list.pug +++ b/views/tm_list.pug @@ -9,6 +9,6 @@ html article h1 Tournaments - p See tournament information. + p See tournament information. +seedlist(seeds, "Mini Cup") diff --git a/views/tm_seed.pug b/views/tm_seed.pug index 65c213d..45659c5 100644 --- a/views/tm_seed.pug +++ b/views/tm_seed.pug @@ -25,7 +25,7 @@ html tr td Format td - a(href="/docs/tournaments") Mini Cup + a(href="/docs/tournaments.md") Mini Cup if seed.scenario !== "Standard" tr td Scenario -- cgit v1.2.3