Skip to content

Commit

Permalink
fix scoped paths in python docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Dec 6, 2024
1 parent 5021e46 commit 3b5a3d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
13 changes: 8 additions & 5 deletions crates/build/re_types_builder/src/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,14 @@ mod doclink_translation {
}
}
Target::Python => {
let mut path = format!("{kind}.{type_name}");
if !scope.is_empty() {
path = format!("{scope}.{path}");
}
if let Some(field_or_enum_name) = field_or_enum_name {
format!("[`{kind}.{type_name}.{field_or_enum_name}`][rerun.{kind}.{type_name}.{field_or_enum_name}]")
} else {
format!("[`{kind}.{type_name}`][rerun.{kind}.{type_name}]")
path.push_str(&format!(".{field_or_enum_name}"));
}
format!("[`{path}`][rerun.{path}]")
}
Target::WebDocsMarkdown => {
// For instance, https://rerun.io/docs/reference/types/views/spatial2d_view
Expand Down Expand Up @@ -530,7 +533,7 @@ mod doclink_translation {
input,
Target::Python
),
"A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`][rerun.views.Spatial2DView] and a [url](www.rerun.io)."
"A vector `[1, 2, 3]` and a doclink [`blueprint.views.Spatial2DView`][rerun.blueprint.views.Spatial2DView] and a [url](www.rerun.io)."
);

assert_eq!(
Expand Down Expand Up @@ -579,7 +582,7 @@ mod doclink_translation {
input,
Target::Python
),
"A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView.position`][rerun.views.Spatial2DView.position] and a [url](www.rerun.io)."
"A vector `[1, 2, 3]` and a doclink [`blueprint.views.Spatial2DView.position`][rerun.blueprint.views.Spatial2DView.position] and a [url](www.rerun.io)."
);

assert_eq!(
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b5a3d7

Please sign in to comment.