Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix newline issue #176

Merged
merged 3 commits into from
Feb 26, 2024
Merged

Fix newline issue #176

merged 3 commits into from
Feb 26, 2024

Conversation

pac48
Copy link
Collaborator

@pac48 pac48 commented Feb 24, 2024

Newlines were breaking the code generation for Python #170. This PR fixes the issue and reformats the C++ to print better with ros2 param describe... The following out shows the new format.

Parameter name: hover_override
  Type: integer
  Description: Override hover action:
    0: Hover
    1: Push
    2: Pull
    -1: Do not override
  Constraints:

The old format was like this

Parameter name: hover_override
  Type: integer
  Description: Override hover action: 0: Hover 1: Push 2: Pull -1: Do not override
  Constraints:

Signed-off-by: Paul Gesel <[email protected]>
@pac48 pac48 requested a review from sjahr February 24, 2024 18:01
Copy link
Collaborator

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine for me.

Fyi, I have to change the parameter description of joint_trajectory_controller because I used \pi inside the description for rendering with sphinx -> without replacement of all \ it throws warnings now. But it still works, and output of ros2 param describe looks way better.

@pac48
Copy link
Collaborator Author

pac48 commented Feb 24, 2024

Looks fine for me.

Fyi, I have to change the parameter description of joint_trajectory_controller because I used \pi inside the description for rendering with sphinx -> without replacement of all \ it throws warnings now. But it still works, and output of ros2 param describe looks way better.

@christophfroehlich Do you mind giving this PR an approval review once you have made the changes you need to make to the joint_trajectory_controller?

f'"{line}"' for line in filtered_description.splitlines()
)
return filtered_description
filtered_description = description.replace('\n', '\\n ')
Copy link
Collaborator

@christophfroehlich christophfroehlich Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or this should be fine too? This would fix your indent and also the markdown syntax I added to JTC.

Suggested change
filtered_description = description.replace('\n', '\\n ')
# remove possible markdown/rst syntax, but add proper indent for cpp-header files.
filtered_description = description.replace('\\', '\\\\').replace('`', '').replace('\\n', '\\n ')

Copy link
Collaborator Author

@pac48 pac48 Feb 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this change but made one small change. It should replace \n' with \n' for the new liens to render correctly.

Copy link
Collaborator

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it with joint_trajectory_controller, it works perfectly now.

@pac48 pac48 merged commit ed62aed into main Feb 26, 2024
7 checks passed
@delete-merged-branch delete-merged-branch bot deleted the pr-fix-newline-issue branch February 26, 2024 17:27
@saikishor
Copy link

Hello!

Thank you for fixing it. When can we expect to have this fix released upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants