Skip to content

Commit bbdcea2

Browse files
committed
feat(book): ✨ added versions for book
Actions workflow not yet ready.
1 parent 5a787c4 commit bbdcea2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1632
-4
lines changed

bonnie.toml

+27-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,35 @@ build = "cargo build"
2828
test = "cargo watch -x \"test\""
2929
check = "cargo check && cargo fmt -- --check && cargo clippy && cargo test" # This will be run on CI as well
3030
# Hosts the book locally
31-
doc.cmd = [
32-
"cd docs",
31+
docs.cmd = [
32+
"cd docs/next",
3333
"mdbook serve"
3434
]
35-
doc.desc = "hosts the book locally at http://localhost:3000"
35+
docs.desc = "hosts the latest version of the book locally at http://localhost:3000"
36+
docs.subcommands.version.cmd = [
37+
"cd docs/%version",
38+
"mdbook serve"
39+
]
40+
docs.subcommands.version.args = [ "version" ]
41+
docs.subcommands.version.desc = "hosts the given version of the book locally at http://localhost:3000"
42+
docs.subcommands.deprecate.cmd = [
43+
"cd docs/%version",
44+
"mkdir theme",
45+
"ln -s ../../common/index.hbs theme/index.hbs",
46+
"ln -s ../../common/header_old.hbs theme/header.hbs"
47+
]
48+
docs.subcommands.deprecate.args = [ "version" ]
49+
docs.subcommands.deprecate.desc = "marks the given version of the docs as old and links to the latest"
50+
docs.subcommands.create.cmd = [
51+
"mkdir docs/%version",
52+
"cd docs/%version",
53+
"ln -s ../common/book.toml book.toml",
54+
"cp -r ../next/src src",
55+
"cd ../",
56+
"sed -i -E 's/perseus\\/(.+)\"/perseus\\/0.2.x\"/' stable.html"
57+
]
58+
docs.subcommands.create.args = [ "version" ]
59+
docs.subcommands.create.desc = "creates documentation for a new version from `next` and marks it as stable (doesn't deprecate old versions though)"
3660

3761
# Releases the project (maintainers only)
3862
# We commit all staged files so we can manually bump the Cargo version

docs/0.1.x/book.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../common/book.toml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/book.toml renamed to docs/common/book.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ src = "src"
66
title = "Perseus Book"
77

88
[rust]
9-
edition = "2018"
9+
edition = "2018"

docs/common/header_old.hbs

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<style>
2+
header.warning {
3+
background-color: rgb(242, 222, 222);
4+
border-bottom-color: rgb(238, 211, 215);
5+
border-bottom-left-radius: 4px;
6+
border-bottom-right-radius: 4px;
7+
border-bottom-style: solid;
8+
border-bottom-width: 0.666667px;
9+
border-image-outset: 0 0 0 0;
10+
border-image-repeat: stretch stretch;
11+
border-image-slice: 100% 100% 100% 100%;
12+
border-image-source: none;
13+
border-image-width: 1 1 1 1;
14+
border-left-color: rgb(238, 211, 215);
15+
border-left-style: solid;
16+
border-left-width: 0.666667px;
17+
border-right-color: rgb(238, 211, 215);
18+
border-right-style: solid;
19+
border-right-width: 0.666667px;
20+
border-top-color: rgb(238, 211, 215);
21+
border-top-left-radius: 4px;
22+
border-top-right-radius: 4px;
23+
border-top-style: solid;
24+
border-top-width: 0.666667px;
25+
color: rgb(185, 74, 72);
26+
padding-bottom: 8px;
27+
padding-left: 14px;
28+
padding-right: 35px;
29+
padding-top: 8px;
30+
text-align: center;
31+
margin-bottom: 0px;
32+
margin-left: 0px;
33+
margin-right: 0px;
34+
margin-top: 30px;
35+
}
36+
</style>
37+
<header class="warning">
38+
This documentation is for an <strong>outdated</strong> version of Perseus.
39+
<br>
40+
You can find the documentation for the latest version
41+
<a href="https://arctic-hen7.github.io/perseus/stable.html">here</a>.
42+
</header>

0 commit comments

Comments
 (0)