Skip to content

Commit b776191

Browse files
committed
Merge branch 'master' into update_rapier_0.21
2 parents 8c7e728 + 4bc8f3b commit b776191

File tree

11 files changed

+96
-9023
lines changed

11 files changed

+96
-9023
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
check-injection:
13+
build:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17-
- name: Run injection script locally
18-
run: find docs/user_guides/templates/ -type f -print0 | OUTPUT_FOLDER=docs/user_guides/templates_injected xargs -0 ./inject_code_in_user_guides.sh
17+
- name: User guides generation
18+
run: ./generate_user_guides.sh
19+
- name: yarn install
20+
run: corepack enable && yarn
21+
- name: yarn build
22+
run: PUBLISH_MODE=1 yarn build
23+
1924
test-code-snippets-rust:
2025
runs-on: ubuntu-latest
2126
steps:

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ yarn-error.log*
2323

2424
build
2525

26+
## For yarn 4: See https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
27+
.pnp.*
28+
.yarn/*
29+
!.yarn/patches
30+
!.yarn/plugins
31+
!.yarn/releases
32+
!.yarn/sdks
33+
!.yarn/versions
34+
2635
# Ignore these because they are generated automatically from docs/user_guides/templates
2736
docs/user_guides/rust
2837
docs/user_guides/bevy_plugin

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

docs-examples/3d/bevy/examples/basic_sim3.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ fn setup_physics(mut commands: Commands) {
3535
.insert(TransformBundle::from(Transform::from_xyz(0.0, 4.0, 0.0)));
3636
}
3737

38-
fn print_ball_altitude(mut positions: Query<&mut Transform, With<RigidBody>>) {
39-
for mut transform in positions.iter_mut() {
40-
dbg!(transform.rotation.to_axis_angle());
41-
transform.rotation = Quat::from_rotation_z(270_f32.to_radians());
42-
//println!("Ball altitude: {}", transform.translation.y);
38+
fn print_ball_altitude(positions: Query<&Transform, With<RigidBody>>) {
39+
for transform in positions.iter() {
40+
println!("Ball altitude: {}", transform.translation.y);
4341
}
4442
}
4543
// DOCUSAURUS: basic_sim stop

docs-examples/inject_file/src/main.rs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ pub struct InjectError<'a> {
6363
}
6464

6565
fn injected(source_text: &str, get_path: fn(&str) -> String) -> Result<String, InjectError> {
66+
let source_text = &source_text.replace("\r\n", "\n");
6667
let re = Regex::new(r"<load.*>").unwrap();
6768
let total_to_inject = re.find_iter(source_text).count();
6869
let mut injected_count = 0;
6970
// Regex to find "<load" tags and capture their info (path + marker)
70-
let re = Regex::new(r"<load path='(.*)'.*marker='(.*)'.*>[\r\n|\n]?").unwrap();
71+
let re = Regex::new(r"<load path='(.*)'.*marker='(.*)'.*>\n?").unwrap();
7172

7273
let mut error = InjectError {
7374
result: None,
@@ -85,12 +86,12 @@ fn injected(source_text: &str, get_path: fn(&str) -> String) -> Result<String, I
8586
error.errors.push(ErrorType::IncorrectPath(path));
8687
return "".to_string();
8788
};
88-
89+
let to_inject = to_inject.replace("\r\n", "\n");
8990
// Regex to find the markers inside comments, and only print what's inside
9091
// FIXME: I think we should just paste all the inside,
9192
// and then remove all "// DOCUSAURUS*"" lines, to allow reuse of a same file.
9293
let regex = format!(
93-
r"// DOCUSAURUS: {} start(?:\r\n|\n)((?:\s|.)*)\s+\/\/ DOCUSAURUS: {} stop",
94+
r"// DOCUSAURUS: {} start\n((?:\s|.)*)\s+\/\/ DOCUSAURUS: {} stop",
9495
infos[1], infos[1]
9596
);
9697
let re = Regex::new(&regex).unwrap();
@@ -115,15 +116,16 @@ fn injected(source_text: &str, get_path: fn(&str) -> String) -> Result<String, I
115116
filepath: infos[0].to_string(),
116117
}));
117118
}
118-
to_keep.join("")
119+
let mut result = to_keep.join("");
120+
result.push('\n');
121+
result
119122
});
120123
if (injected_count + error.errors.len()) != total_to_inject {
121124
error.errors.push(ErrorType::IncorrectTag);
122125
}
123126
if !error.errors.is_empty() {
124127
return Err(error);
125128
}
126-
let result = result.replace("\r\n", "\n");
127129
let re = Regex::new(r"(.*\/\/ DOCUSAURUS:.*\n)").unwrap();
128130
let result = re.replace_all(&result, |_: &Captures| "").to_string();
129131
Ok(result)
@@ -198,10 +200,11 @@ fn nest_removal() {
198200

199201
// Trimming end for cross platform, on windows I had \r finishing result.
200202
assert_eq!(
201-
result.expect("This should not error out").trim_end(),
203+
result.expect("This should not error out"),
202204
"correct data nest1
203205
correct data nested
204-
correct data nest2"
206+
correct data nest2
207+
"
205208
);
206209
}
207210

@@ -212,15 +215,17 @@ fn indent_removal_simple() {
212215
let result = remove_indent(
213216
" correct data indented 1
214217
correct data indented more
215-
correct data indented 2",
218+
correct data indented 2
219+
",
216220
);
217221

218222
// Trimming end for cross platform, on windows I had \r finishing result.
219223
assert_eq!(
220-
result.expect("This should not error out").trim_end(),
224+
result.expect("This should not error out"),
221225
"correct data indented 1
222226
correct data indented more
223-
correct data indented 2"
227+
correct data indented 2
228+
"
224229
);
225230
}
226231

@@ -286,8 +291,10 @@ fn simple_marker_error() {
286291
);
287292

288293
// Trimming end for cross platform, on windows I had \r finishing result.
289-
assert!(matches!(
290-
&result.expect_err("This should error out").errors[0],
291-
IncorrectMarker
292-
));
294+
match &result.expect_err("This should error out").errors[0] {
295+
ErrorType::IncorrectMarker(_) => {}
296+
invalid_value => {
297+
panic!("unexpected error type: {:?}", invalid_value);
298+
}
299+
}
293300
}

docusaurus.config.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const math = require('remark-math')
22
const katex = require('rehype-katex')
33

4-
module.exports = {
4+
const config = {
55
title: 'Rapier',
66
tagline: 'Fast 2D and 3D physics engine for the Rust programming language.',
77
url: 'https://rapier.rs',
@@ -13,7 +13,7 @@ module.exports = {
1313
themeConfig: {
1414
algolia: {
1515
apiKey: '2fb2392fe420e3f9cd94004bda27a775',
16-
appId: 'rapier',
16+
appId: 'MDOZU7PTCV',
1717
indexName: 'rapier',
1818
},
1919
prism: {
@@ -45,11 +45,11 @@ module.exports = {
4545
items: [
4646
{
4747
href: 'https://rapier.rs/demos2d/index.html', // FIXME: should depend on the base url.
48-
label: '2D Demos',
48+
label: '2D Demos',
4949
},
5050
{
5151
href: 'https://rapier.rs/demos3d/index.html', // FIXME: should depend on the base url.
52-
label: '3D Demos',
52+
label: '3D Demos',
5353
}
5454
],
5555
},
@@ -61,18 +61,18 @@ module.exports = {
6161
},
6262
{
6363
href: 'https://dimforge.com/blog',
64-
label: 'Blog',
64+
label: 'Blog',
6565
position: 'left',
6666
},
6767
{
68-
href: 'https://github.com/sponsors/dimforge',
69-
label: 'Donate ♥',
68+
value: '<a class="header-button-donate" href="https://github.com/sponsors/dimforge" target="_blank" rel="noopener noreferrer">Donate ♥</a>',
69+
className: 'header-button-donate',
7070
position: 'right',
71-
className: 'header-button-donate'
71+
type: 'html'
7272
},
7373
{
7474
href: 'https://dimforge.com',
75-
label: 'Dimforge',
75+
label: 'Dimforge',
7676
position: 'right',
7777
},
7878
{
@@ -100,11 +100,11 @@ module.exports = {
100100
to: 'docs/',
101101
},
102102
{
103-
label: 'Demos 2D',
103+
label: 'Demos 2D',
104104
href: 'https://rapier.rs/demos2d/index.html',
105105
},
106106
{
107-
label: 'Demos 3D',
107+
label: 'Demos 3D',
108108
href: 'https://rapier.rs/demos3d/index.html',
109109
},
110110
],
@@ -181,3 +181,5 @@ module.exports = {
181181
'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css'
182182
]
183183
};
184+
185+
export default config;

generate_user_guides.sh

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/bash
22
set -v
33

4+
if [ gsed -v ]; then
5+
gsed=gsed
6+
else
7+
# Hopefully installed sed is the gnu one.
8+
# note: aliases work poorly with xargs.
9+
gsed=sed
10+
fi
11+
412
mkdir -p docs/user_guides/rust/
513
mkdir -p docs/user_guides/bevy_plugin/
614
mkdir -p docs/user_guides/javascript/
@@ -12,28 +20,28 @@ cp -r docs/user_guides/templates_injected/* docs/user_guides/bevy_plugin/.
1220
cp -r docs/user_guides/templates_injected/* docs/user_guides/javascript/.
1321

1422
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<rapier>[^<]*</rapier>' -v ORS= '1'
15-
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 sed -i '/<rapier>/,/<\/rapier>/d'
23+
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 $gsed -i '/<rapier>/,/<\/rapier>/d'
1624
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<js>[^<]*</js>' -v ORS= '1'
17-
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 sed -i '/<js>/,/<\/js>/d'
18-
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 sed -i 's\<bevy>\\g'
19-
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 sed -i 's\</bevy>\\g'
20-
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 sed -i 's\<notjs>\\g'
21-
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 sed -i 's\</notjs>\\g'
25+
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 $gsed -i '/<js>/,/<\/js>/d'
26+
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 $gsed -i 's\<bevy>\\g'
27+
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 $gsed -i 's\</bevy>\\g'
28+
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 $gsed -i 's\<notjs>\\g'
29+
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 $gsed -i 's\</notjs>\\g'
2230

2331
find docs/user_guides/rust/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<bevy>[^<]*</bevy>' -v ORS= '1'
24-
find docs/user_guides/rust/ -type f -print0 | xargs -0 sed -i '/<bevy>/,/<\/bevy>/d'
32+
find docs/user_guides/rust/ -type f -print0 | xargs -0 $gsed -i '/<bevy>/,/<\/bevy>/d'
2533
find docs/user_guides/rust/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<js>[^<]*</js>' -v ORS= '1'
26-
find docs/user_guides/rust/ -type f -print0 | xargs -0 sed -i '/<js>/,/<\/js>/d'
27-
find docs/user_guides/rust/ -type f -print0 | xargs -0 sed -i 's\<rapier>\\g'
28-
find docs/user_guides/rust/ -type f -print0 | xargs -0 sed -i 's\</rapier>\\g'
29-
find docs/user_guides/rust/ -type f -print0 | xargs -0 sed -i 's\<notjs>\\g'
30-
find docs/user_guides/rust/ -type f -print0 | xargs -0 sed -i 's\</notjs>\\g'
34+
find docs/user_guides/rust/ -type f -print0 | xargs -0 $gsed -i '/<js>/,/<\/js>/d'
35+
find docs/user_guides/rust/ -type f -print0 | xargs -0 $gsed -i 's\<rapier>\\g'
36+
find docs/user_guides/rust/ -type f -print0 | xargs -0 $gsed -i 's\</rapier>\\g'
37+
find docs/user_guides/rust/ -type f -print0 | xargs -0 $gsed -i 's\<notjs>\\g'
38+
find docs/user_guides/rust/ -type f -print0 | xargs -0 $gsed -i 's\</notjs>\\g'
3139

3240
find docs/user_guides/javascript/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<rapier>[^<]*</rapier>' -v ORS= '1'
33-
find docs/user_guides/javascript/ -type f -print0 | xargs -0 sed -i '/<rapier>/,/<\/rapier>/d'
41+
find docs/user_guides/javascript/ -type f -print0 | xargs -0 $gsed -i '/<rapier>/,/<\/rapier>/d'
3442
find docs/user_guides/javascript/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<bevy>[^<]*</bevy>' -v ORS= '1'
35-
find docs/user_guides/javascript/ -type f -print0 | xargs -0 sed -i '/<bevy>/,/<\/bevy>/d'
43+
find docs/user_guides/javascript/ -type f -print0 | xargs -0 $gsed -i '/<bevy>/,/<\/bevy>/d'
3644
find docs/user_guides/javascript/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<notjs>[^<]*</notjs>' -v ORS= '1'
37-
find docs/user_guides/javascript/ -type f -print0 | xargs -0 sed -i '/<notjs>/,/<\/notjs>/d'
38-
find docs/user_guides/javascript/ -type f -print0 | xargs -0 sed -i 's\<js>\\g'
39-
find docs/user_guides/javascript/ -type f -print0 | xargs -0 sed -i 's\</js>\\g'
45+
find docs/user_guides/javascript/ -type f -print0 | xargs -0 $gsed -i '/<notjs>/,/<\/notjs>/d'
46+
find docs/user_guides/javascript/ -type f -print0 | xargs -0 $gsed -i 's\<js>\\g'
47+
find docs/user_guides/javascript/ -type f -print0 | xargs -0 $gsed -i 's\</js>\\g'

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"clsx": "^1.1.1",
2222
"react": "^18.2",
2323
"react-dom": "^18.2",
24-
"rehype-katex": "^3.1.0",
25-
"remark-math": "^2.0.1",
24+
"rehype-katex": "7",
25+
"remark-math": "6",
2626
"terminus": "^1.1.0"
2727
},
2828
"browserslist": {
@@ -37,5 +37,5 @@
3737
"last 1 safari version"
3838
]
3939
},
40-
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
41-
}
40+
"packageManager": "yarn@4.3.1"
41+
}

sidebar_community.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
module.exports = {
1+
const config = {
22
community: [
33
'support',
44
'acknowledgements'
55
],
66
};
7+
8+
export default config;

sidebar_docs.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if (!process.env.PUBLISH_MODE) {
7575
}
7676

7777

78-
module.exports = {
78+
const config = {
7979
docs: [
8080
'about_rapier',
8181
{
@@ -87,35 +87,37 @@ module.exports = {
8787
'api/javascript/JavaScript3D',
8888
{
8989
type: 'link',
90-
label: 'bevy_rapier2d',
90+
label: 'bevy_rapier2d',
9191
href: 'https://docs.rs/bevy_rapier2d'
9292
},
9393
{
9494
type: 'link',
95-
label: 'bevy_rapier3d',
95+
label: 'bevy_rapier3d',
9696
href: 'https://docs.rs/bevy_rapier3d'
9797
},
9898
{
9999
type: 'link',
100-
label: 'rapier2d',
100+
label: 'rapier2d',
101101
href: 'https://docs.rs/rapier2d'
102102
},
103103
{
104104
type: 'link',
105-
label: 'rapier3d',
105+
label: 'rapier3d',
106106
href: 'https://docs.rs/rapier3d'
107107
},
108108
{
109109
type: 'link',
110-
label: 'rapier2d-f64',
110+
label: 'rapier2d-f64',
111111
href: 'https://docs.rs/rapier2d-f64'
112112
},
113113
{
114114
type: 'link',
115-
label: 'rapier3d-f64',
115+
label: 'rapier3d-f64',
116116
href: 'https://docs.rs/rapier3d-f64'
117117
},
118118
],
119119
}
120120
],
121121
};
122+
123+
export default config;

0 commit comments

Comments
 (0)